Make OBJ_NAME_do_all more OpenSSL-compatible.

OBJ_NAME in OpenSSL has an 'alias' field which some code consumes. We never
report anything OpenSSL considers an alias, so just leave it zero. It also has
a 'data' field which, confusingly, is a pointer to the EVP_CIPHER or EVP_MD
despite being a char pointer.

See calls to and implementation of OBJ_NAME_add in OpenSSL for comparison.

Change-Id: Ifc5c70424569db8783deb2fda7736c1954b5dd3a
Reviewed-on: https://boringssl-review.googlesource.com/8515
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2016-06-25 20:43:01 -04:00 committed by Adam Langley
parent bb076e334c
commit 7cdab4ac84
2 changed files with 4 additions and 0 deletions

View File

@ -33,6 +33,7 @@ static void cipher_callback(const EVP_CIPHER *cipher, const char *name,
memset(&obj_name, 0, sizeof(obj_name));
obj_name.type = OBJ_NAME_TYPE_CIPHER_METH;
obj_name.name = name;
obj_name.data = (const char *)cipher;
wrapped->callback(&obj_name, wrapped->arg);
}
@ -45,6 +46,7 @@ static void md_callback(const EVP_MD *md, const char *name, const char *unused,
memset(&obj_name, 0, sizeof(obj_name));
obj_name.type = OBJ_NAME_TYPE_MD_METH;
obj_name.name = name;
obj_name.data = (const char *)md;
wrapped->callback(&obj_name, wrapped->arg);
}

View File

@ -193,7 +193,9 @@ OPENSSL_EXPORT int OBJ_find_sigid_by_algs(int *out_sign_nid, int digest_nid,
typedef struct obj_name_st {
int type;
int alias;
const char *name;
const char *data;
} OBJ_NAME;
#define OBJ_NAME_TYPE_MD_METH 1