diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-06-17 08:12:19 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-06-22 16:39:26 +0200 |
commit | 11baa470a21b514ab247071e80273ddc0a80c504 (patch) | |
tree | 2cf15bc701207631d43d319f1eb2f670aa8abec6 /crypto/crmf | |
parent | e197158bd5b5a5674b8ea67e838bac47395c66f9 (diff) |
Fix CMP -days option range checking and test failing with enable-ubsan
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12175)
Diffstat (limited to 'crypto/crmf')
-rw-r--r-- | crypto/crmf/crmf_lib.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index c20a6da0f2..7530120ff3 100644 --- a/crypto/crmf/crmf_lib.c +++ b/crypto/crmf/crmf_lib.c @@ -244,35 +244,23 @@ OSSL_CRMF_CERTTEMPLATE *OSSL_CRMF_MSG_get0_tmpl(const OSSL_CRMF_MSG *crm) } -int OSSL_CRMF_MSG_set_validity(OSSL_CRMF_MSG *crm, time_t from, time_t to) +int OSSL_CRMF_MSG_set0_validity(OSSL_CRMF_MSG *crm, + ASN1_TIME *notBefore, ASN1_TIME *notAfter) { - OSSL_CRMF_OPTIONALVALIDITY *vld = NULL; - ASN1_TIME *from_asn = NULL; - ASN1_TIME *to_asn = NULL; + OSSL_CRMF_OPTIONALVALIDITY *vld; OSSL_CRMF_CERTTEMPLATE *tmpl = OSSL_CRMF_MSG_get0_tmpl(crm); if (tmpl == NULL) { /* also crm == NULL implies this */ - CRMFerr(CRMF_F_OSSL_CRMF_MSG_SET_VALIDITY, CRMF_R_NULL_ARGUMENT); + CRMFerr(CRMF_F_OSSL_CRMF_MSG_SET0_VALIDITY, CRMF_R_NULL_ARGUMENT); return 0; } - if (from != 0 && ((from_asn = ASN1_TIME_set(NULL, from)) == NULL)) - goto err; - if (to != 0 && ((to_asn = ASN1_TIME_set(NULL, to)) == NULL)) - goto err; if ((vld = OSSL_CRMF_OPTIONALVALIDITY_new()) == NULL) - goto err; - - vld->notBefore = from_asn; - vld->notAfter = to_asn; - + return 0; + vld->notBefore = notBefore; + vld->notAfter = notAfter; tmpl->validity = vld; - return 1; - err: - ASN1_TIME_free(from_asn); - ASN1_TIME_free(to_asn); - return 0; } |