From 7cdab4ac84140a9f0e46eecaf9cf91a4fa4bd7b2 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 25 Jun 2016 20:43:01 -0400 Subject: [PATCH] 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 --- decrepit/obj/obj_decrepit.c | 2 ++ include/openssl/obj.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/decrepit/obj/obj_decrepit.c b/decrepit/obj/obj_decrepit.c index 06051f11..8ea2e0aa 100644 --- a/decrepit/obj/obj_decrepit.c +++ b/decrepit/obj/obj_decrepit.c @@ -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); } diff --git a/include/openssl/obj.h b/include/openssl/obj.h index 7e24820c..367cfdc9 100644 --- a/include/openssl/obj.h +++ b/include/openssl/obj.h @@ -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