obj_decrepit.c
Go to the documentation of this file.
1 /* Copyright (c) 2016, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #include <openssl/obj.h>
16 
17 #include <assert.h>
18 #include <string.h>
19 
20 #include <openssl/evp.h>
21 
22 #include "../../crypto/internal.h"
23 
24 
25 struct wrapped_callback {
26  void (*callback)(const OBJ_NAME *, void *arg);
27  void *arg;
28 };
29 
30 static void cipher_callback(const EVP_CIPHER *cipher, const char *name,
31  const char *unused, void *arg) {
32  const struct wrapped_callback *wrapped = (struct wrapped_callback *)arg;
33  OBJ_NAME obj_name;
34 
35  OPENSSL_memset(&obj_name, 0, sizeof(obj_name));
37  obj_name.name = name;
38  obj_name.data = (const char *)cipher;
39 
40  wrapped->callback(&obj_name, wrapped->arg);
41 }
42 
43 static void md_callback(const EVP_MD *md, const char *name, const char *unused,
44  void *arg) {
45  const struct wrapped_callback *wrapped = (struct wrapped_callback*) arg;
46  OBJ_NAME obj_name;
47 
48  OPENSSL_memset(&obj_name, 0, sizeof(obj_name));
49  obj_name.type = OBJ_NAME_TYPE_MD_METH;
50  obj_name.name = name;
51  obj_name.data = (const char *)md;
52 
53  wrapped->callback(&obj_name, wrapped->arg);
54 }
55 
57  void (*callback)(const OBJ_NAME *, void *arg),
58  void *arg) {
60  wrapped.callback = callback;
61  wrapped.arg = arg;
62 
65  } else if (type == OBJ_NAME_TYPE_MD_METH) {
67  } else {
68  assert(0);
69  }
70 }
71 
72 void OBJ_NAME_do_all(int type, void (*callback)(const OBJ_NAME *, void *arg),
73  void *arg) {
75 }
wrapped_callback
Definition: dh_decrepit.c:57
env_md_st
Definition: third_party/boringssl-with-bazel/src/crypto/fipsmodule/digest/internal.h:67
evp.h
obj_name_st::data
const char * data
Definition: obj.h:224
obj_name_st::type
int type
Definition: obj.h:221
string.h
setup.name
name
Definition: setup.py:542
OPENSSL_memset
static void * OPENSSL_memset(void *dst, int c, size_t n)
Definition: third_party/boringssl-with-bazel/src/crypto/internal.h:835
OBJ_NAME_do_all
void OBJ_NAME_do_all(int type, void(*callback)(const OBJ_NAME *, void *arg), void *arg)
Definition: obj_decrepit.c:72
evp_cipher_st
Definition: cipher.h:585
arg
Definition: cmdline.cc:40
EVP_CIPHER_do_all_sorted
void EVP_CIPHER_do_all_sorted(void(*callback)(const EVP_CIPHER *cipher, const char *name, const char *unused, void *arg), void *arg)
Definition: evp_do_all.c:18
cipher_callback
static void cipher_callback(const EVP_CIPHER *cipher, const char *name, const char *unused, void *arg)
Definition: obj_decrepit.c:30
callback
static void callback(void *arg, int status, int timeouts, struct hostent *host)
Definition: acountry.c:224
OBJ_NAME_TYPE_MD_METH
#define OBJ_NAME_TYPE_MD_METH
Definition: obj.h:227
OBJ_NAME_do_all_sorted
void OBJ_NAME_do_all_sorted(int type, void(*callback)(const OBJ_NAME *, void *arg), void *arg)
Definition: obj_decrepit.c:56
obj_name_st::name
const char * name
Definition: obj.h:223
wrapped_callback::arg
void * arg
Definition: dh_decrepit.c:59
EVP_MD_do_all_sorted
void EVP_MD_do_all_sorted(void(*callback)(const EVP_MD *cipher, const char *name, const char *unused, void *arg), void *arg)
Definition: evp_do_all.c:70
benchmark.md
md
Definition: benchmark.py:86
wrapped
grpc_call * wrapped
Definition: src/php/ext/grpc/call.h:32
wrapped_callback::callback
void(* callback)(int, int, void *)
Definition: dh_decrepit.c:58
md_callback
static void md_callback(const EVP_MD *md, const char *name, const char *unused, void *arg)
Definition: obj_decrepit.c:43
arg
struct arg arg
obj.h
OBJ_NAME_TYPE_CIPHER_METH
#define OBJ_NAME_TYPE_CIPHER_METH
Definition: obj.h:228
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
obj_name_st
Definition: obj.h:220


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:43