Add CMP error reason 'missing reference cert'
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Fri, 17 Apr 2020 11:34:11 +0000 (13:34 +0200)
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_client.c
crypto/cmp/cmp_err.c
crypto/cmp/cmp_msg.c
crypto/err/openssl.txt
include/openssl/cmperr.h

index 07535e55bdb6ac16cd3502eb69bf5d9c1debfd93..b2238fb55dbdc8506377d987cf9a9d26400f906d 100644 (file)
@@ -754,6 +754,10 @@ X509 *OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx)
         CMPerr(0, CMP_R_INVALID_ARGS);
         return 0;
     }
+    if (ctx->oldCert == NULL) {
+        CMPerr(0, CMP_R_MISSING_REFERENCE_CERT);
+        return 0;
+    }
     ctx->status = -1;
 
     /* OSSL_CMP_rr_new() also checks if all necessary options are set */
index 0f06fb3b42d81f957ec9eb186fb4739cebe504d9..0c3547c0138caa2d6b3c8041e506d8b557b9b848 100644 (file)
@@ -90,6 +90,8 @@ static const ERR_STRING_DATA CMP_str_reasons[] = {
     {ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_PRIVATE_KEY),
     "missing private key"},
     {ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_PROTECTION), "missing protection"},
+    {ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_REFERENCE_CERT),
+    "missing reference cert"},
     {ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_SENDER_IDENTIFICATION),
     "missing sender identification"},
     {ERR_PACK(ERR_LIB_CMP, 0, CMP_R_MISSING_TRUST_STORE),
index 73a9d7a267835351d52bec34ccb0397367ebd056..fbf6c8fd4fc947be14701e9644fa0d6b0c2f316e 100644 (file)
@@ -226,7 +226,7 @@ static OSSL_CRMF_MSG *crm_new(OSSL_CMP_CTX *ctx, int bodytype, int rid)
 #endif
     }
     if (bodytype == OSSL_CMP_PKIBODY_KUR && refcert == NULL) {
-        CMPerr(0, CMP_R_INVALID_ARGS);
+        CMPerr(0, CMP_R_MISSING_REFERENCE_CERT);
         return NULL;
     }
     if ((crm = OSSL_CRMF_MSG_new()) == NULL)
index 793473684c046d72906cf49176dfa4a609d55a54..122542f6b6610daae0d9f75d4991d52a5b8abbc0 100644 (file)
@@ -2122,6 +2122,7 @@ CMP_R_MISSING_KEY_INPUT_FOR_CREATING_PROTECTION:130:\
 CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE:142:missing key usage digitalsignature
 CMP_R_MISSING_PRIVATE_KEY:131:missing private key
 CMP_R_MISSING_PROTECTION:143:missing protection
+CMP_R_MISSING_REFERENCE_CERT:168:missing reference cert
 CMP_R_MISSING_SENDER_IDENTIFICATION:111:missing sender identification
 CMP_R_MISSING_TRUST_STORE:144:missing trust store
 CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED:161:multiple requests not supported
index 312fa5293210550084b0969b7abdeeaca6cab32e..31fa43cd9281388e227d67053d14b72303e6b6e3 100644 (file)
@@ -76,6 +76,7 @@ int ERR_load_CMP_strings(void);
 #  define CMP_R_MISSING_KEY_USAGE_DIGITALSIGNATURE         142
 #  define CMP_R_MISSING_PRIVATE_KEY                        131
 #  define CMP_R_MISSING_PROTECTION                         143
+#  define CMP_R_MISSING_REFERENCE_CERT                     168
 #  define CMP_R_MISSING_SENDER_IDENTIFICATION              111
 #  define CMP_R_MISSING_TRUST_STORE                        144
 #  define CMP_R_MULTIPLE_REQUESTS_NOT_SUPPORTED            161