Rename CMP_PROTECTEDPART to OSSL_CMP_PROTECTEDPART for consistency
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Mon, 23 Mar 2020 13:42:34 +0000 (14:42 +0100)
committerDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 18 Apr 2020 17:54:17 +0000 (19:54 +0200)
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)

crypto/cmp/cmp_asn.c
crypto/cmp/cmp_local.h
crypto/cmp/cmp_protect.c
crypto/cmp/cmp_vfy.c
test/cmp_protect_test.c

index e02076bb12c9ece5e52e97c501a8c8d5aaf4aa9a..42473f79f21278d9844ad3d491844f531b288ad0 100644 (file)
@@ -396,11 +396,11 @@ ASN1_SEQUENCE(OSSL_CMP_PKIHEADER) = {
 } ASN1_SEQUENCE_END(OSSL_CMP_PKIHEADER)
 IMPLEMENT_ASN1_FUNCTIONS(OSSL_CMP_PKIHEADER)
 
-ASN1_SEQUENCE(CMP_PROTECTEDPART) = {
+ASN1_SEQUENCE(OSSL_CMP_PROTECTEDPART) = {
     ASN1_SIMPLE(OSSL_CMP_MSG, header, OSSL_CMP_PKIHEADER),
     ASN1_SIMPLE(OSSL_CMP_MSG, body, OSSL_CMP_PKIBODY)
-} ASN1_SEQUENCE_END(CMP_PROTECTEDPART)
-IMPLEMENT_ASN1_FUNCTIONS(CMP_PROTECTEDPART)
+} ASN1_SEQUENCE_END(OSSL_CMP_PROTECTEDPART)
+IMPLEMENT_ASN1_FUNCTIONS(OSSL_CMP_PROTECTEDPART)
 
 ASN1_SEQUENCE(OSSL_CMP_MSG) = {
     ASN1_SIMPLE(OSSL_CMP_MSG, header, OSSL_CMP_PKIHEADER),
index c3a080f2bdbec2e12732f4115961863136583c9a..e7219b08792599d504d8abc9f028831d33d9f5b6 100644 (file)
@@ -674,11 +674,11 @@ DECLARE_ASN1_FUNCTIONS(OSSL_CMP_MSG)
  * body      PKIBody
  * }
  */
-typedef struct cmp_protectedpart_st {
+typedef struct ossl_cmp_protectedpart_st {
     OSSL_CMP_PKIHEADER *header;
     OSSL_CMP_PKIBODY *body;
-} CMP_PROTECTEDPART;
-DECLARE_ASN1_FUNCTIONS(CMP_PROTECTEDPART)
+} OSSL_CMP_PROTECTEDPART;
+DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PROTECTEDPART)
 
 /*-
  *  this is not defined here as it is already in CRMF:
index ce20ef203ea076bb624a39c42540c350b369b94d..2101a6c46e66753dd9ae4a6944ad768368a25c20 100644 (file)
@@ -35,7 +35,7 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_MSG *msg,
                                           EVP_PKEY *pkey)
 {
     ASN1_BIT_STRING *prot = NULL;
-    CMP_PROTECTEDPART prot_part;
+    OSSL_CMP_PROTECTEDPART prot_part;
     const ASN1_OBJECT *algorOID = NULL;
     int len;
     size_t prot_part_der_len;
@@ -58,7 +58,7 @@ ASN1_BIT_STRING *ossl_cmp_calc_protection(const OSSL_CMP_MSG *msg,
     prot_part.header = msg->header;
     prot_part.body = msg->body;
 
-    len = i2d_CMP_PROTECTEDPART(&prot_part, &prot_part_der);
+    len = i2d_OSSL_CMP_PROTECTEDPART(&prot_part, &prot_part_der);
     if (len < 0 || prot_part_der == NULL) {
         CMPerr(0, CMP_R_ERROR_CALCULATING_PROTECTION);
         goto end;
index 11688059da210b7fa960c44886a5926b7c871b5c..1ee1b3325e3b9fc7dbfed50750fb2c60cfd01fdf 100644 (file)
@@ -32,7 +32,7 @@ static int verify_signature(const OSSL_CMP_CTX *cmp_ctx,
                             const OSSL_CMP_MSG *msg, X509 *cert)
 {
     EVP_MD_CTX *ctx = NULL;
-    CMP_PROTECTEDPART prot_part;
+    OSSL_CMP_PROTECTEDPART prot_part;
     int digest_nid, pk_nid;
     const EVP_MD *digest = NULL;
     EVP_PKEY *pubkey = NULL;
@@ -62,7 +62,7 @@ static int verify_signature(const OSSL_CMP_CTX *cmp_ctx,
     prot_part.header = msg->header;
     prot_part.body = msg->body;
 
-    len = i2d_CMP_PROTECTEDPART(&prot_part, &prot_part_der);
+    len = i2d_OSSL_CMP_PROTECTEDPART(&prot_part, &prot_part_der);
     if (len < 0 || prot_part_der == NULL)
         goto end;
     prot_part_der_len = (size_t) len;
index a506ec33ea323f3682f1f80b9d490e9d81324e6b..bd9ae3b230b46a8b5a1f1e2367b73e118e8f1008 100644 (file)
@@ -101,7 +101,7 @@ static int verify_signature(OSSL_CMP_MSG *msg,
                             ASN1_BIT_STRING *protection,
                             EVP_PKEY *pkey, int digest_nid)
 {
-    CMP_PROTECTEDPART prot_part;
+    OSSL_CMP_PROTECTEDPART prot_part;
     unsigned char *prot_part_der = NULL;
     int len;
     EVP_MD_CTX *ctx = NULL;
@@ -110,8 +110,9 @@ static int verify_signature(OSSL_CMP_MSG *msg,
 
     prot_part.header = OSSL_CMP_MSG_get0_header(msg);
     prot_part.body = msg->body;
+    len = i2d_OSSL_CMP_PROTECTEDPART(&prot_part, &prot_part_der);
     res =
-        TEST_int_ge(len = i2d_CMP_PROTECTEDPART(&prot_part, &prot_part_der), 0)
+        TEST_int_ge(len, 0)
         && TEST_ptr(ctx = EVP_MD_CTX_new())
         && TEST_true(EVP_DigestVerifyInit(ctx, NULL, digest, NULL, pkey))
         && TEST_int_eq(EVP_DigestVerify(ctx, protection->data,