diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-03-24 10:33:16 +0100 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-04-18 19:54:17 +0200 |
commit | e599d0aecd3e9419d1558628cb42db9cf0fa5fd0 (patch) | |
tree | 09744b062a8d0f7f04251f1e13ee7deaee5ccf38 /crypto/cmp/cmp_client.c | |
parent | a81151bd56d55d52c40865f2f135355a2164062e (diff) |
Add CMP fuzzing to fuzz/cmp.c, including a couple of helpers in crypto/cmp/
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11386)
Diffstat (limited to 'crypto/cmp/cmp_client.c')
-rw-r--r-- | crypto/cmp/cmp_client.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c index 604b4ce9a1..07535e55bd 100644 --- a/crypto/cmp/cmp_client.c +++ b/crypto/cmp/cmp_client.c @@ -764,10 +764,17 @@ X509 *OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx) goto end; rrep = rp->body->value.rp; +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION if (sk_OSSL_CMP_PKISI_num(rrep->status) != num_RevDetails) { CMPerr(0, CMP_R_WRONG_RP_COMPONENT_COUNT); goto end; } +#else + if (sk_OSSL_CMP_PKISI_num(rrep->status) < 1) { + CMPerr(0, CMP_R_WRONG_RP_COMPONENT_COUNT); + goto end; + } +#endif /* evaluate PKIStatus field */ si = ossl_cmp_revrepcontent_get_pkisi(rrep, rsid); @@ -822,15 +829,19 @@ X509 *OSSL_CMP_exec_RR_ses(OSSL_CMP_CTX *ctx) goto err; } if (X509_NAME_cmp(issuer, OSSL_CRMF_CERTID_get0_issuer(cid)) != 0) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION CMPerr(0, CMP_R_WRONG_CERTID_IN_RP); result = NULL; goto err; +#endif } if (ASN1_INTEGER_cmp(serial, OSSL_CRMF_CERTID_get0_serialNumber(cid)) != 0) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION CMPerr(0, CMP_R_WRONG_SERIAL_IN_RP); result = NULL; goto err; +#endif } } |