ts_check_signing_certs(): Make sure both ESSCertID and ESSCertIDv2 are checked
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Fri, 12 Mar 2021 14:54:34 +0000 (15:54 +0100)
committerDr. David von Oheimb <dev@ddvo.net>
Thu, 18 Mar 2021 06:03:53 +0000 (07:03 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14503)

CHANGES.md
crypto/ts/ts_rsp_verify.c

index ad6b7edd29ef3bfcd5aae22fd30bef1e47e7efb7..cb074f2ff0c47040023f3a904754e137d325dd52 100644 (file)
@@ -60,6 +60,7 @@ OpenSSL 3.0
 
  * Improved adherence to Enhanced Security Services (ESS, RFC 2634 and RFC 5035)
    for the TSP implementation.
+   As required by RFC 5035 check both ESSCertID and ESSCertIDv2 if both present.
    Correct the semantics of checking the validation chain in case ESSCertID{,v2}
    contains more than one certificate identifier: This means that all
    certificates referenced there MUST be part of the validation chain.
index 6884360869a69084e96477644c8cebc7c7b848a1..6798fc8263bc32b7783a3ac62bb1e6fb3b419c90 100644 (file)
@@ -214,23 +214,21 @@ static int ts_check_signing_certs(PKCS7_SIGNER_INFO *si,
      * Check if first ESSCertIDs matches signer cert
      * and each further ESSCertIDs matches any cert in the chain.
      */
-    if (ss != NULL) {
+    if (ss != NULL)
         for (i = 0; i < sk_ESS_CERT_ID_num(ss->cert_ids); i++) {
             j = ossl_ess_find_cid(chain, sk_ESS_CERT_ID_value(ss->cert_ids, i),
                                   NULL);
             if (j < 0 || (i == 0 && j != 0))
                 goto err;
         }
-        ret = 1;
-    } else if (ssv2 != NULL) {
+    if (ssv2 != NULL)
         for (i = 0; i < sk_ESS_CERT_ID_V2_num(ssv2->cert_ids); i++) {
             j = ossl_ess_find_cid(chain, NULL,
                                   sk_ESS_CERT_ID_V2_value(ssv2->cert_ids, i));
             if (j < 0 || (i == 0 && j != 0))
                 goto err;
         }
-        ret = 1;
-    }
+    ret = 1;
 
  err:
     if (!ret)