Switch M_ASN1_TIME macros within the library. There is no ASN1_TIME_dup, so switch M_ASN1_TIME_dup to ASN1_STRING_dup as upstream does. Switch M_ASN1_TIME_free to ASN1_TIME_free, also matching upstream. This is a no-op, but less obviously so: ASN1_TIME is an MSTRING defined in a_time.c. This defines an MSTRING ASN1_ITEM. The new/free functions are then generated with IMPLEMENT_ASN1_FUNCTIONS, which walks the ASN1_ITEM. ASN1_TIME_free then goes through table-based free function, eventually running ASN1_primitive_free, which calls ASN1_STRING_free on MSTRINGs. Change-Id: I1765848a5301ecceeb74f91457351c969b741bb1 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44046 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c index 6141af0..5f17851 100644 --- a/crypto/x509/x509_set.c +++ b/crypto/x509/x509_set.c
@@ -125,9 +125,9 @@ return (0); in = x->cert_info->validity->notBefore; if (in != tm) { - in = M_ASN1_TIME_dup(tm); + in = ASN1_STRING_dup(tm); if (in != NULL) { - M_ASN1_TIME_free(x->cert_info->validity->notBefore); + ASN1_TIME_free(x->cert_info->validity->notBefore); x->cert_info->validity->notBefore = in; } } @@ -168,9 +168,9 @@ return (0); in = x->cert_info->validity->notAfter; if (in != tm) { - in = M_ASN1_TIME_dup(tm); + in = ASN1_STRING_dup(tm); if (in != NULL) { - M_ASN1_TIME_free(x->cert_info->validity->notAfter); + ASN1_TIME_free(x->cert_info->validity->notAfter); x->cert_info->validity->notAfter = in; } }
diff --git a/crypto/x509/x509cset.c b/crypto/x509/x509cset.c index 04f1f87..f207a25 100644 --- a/crypto/x509/x509cset.c +++ b/crypto/x509/x509cset.c
@@ -87,9 +87,9 @@ return (0); in = x->crl->lastUpdate; if (in != tm) { - in = M_ASN1_TIME_dup(tm); + in = ASN1_STRING_dup(tm); if (in != NULL) { - M_ASN1_TIME_free(x->crl->lastUpdate); + ASN1_TIME_free(x->crl->lastUpdate); x->crl->lastUpdate = in; } } @@ -104,9 +104,9 @@ return (0); in = x->crl->nextUpdate; if (in != tm) { - in = M_ASN1_TIME_dup(tm); + in = ASN1_STRING_dup(tm); if (in != NULL) { - M_ASN1_TIME_free(x->crl->nextUpdate); + ASN1_TIME_free(x->crl->nextUpdate); x->crl->nextUpdate = in; } } @@ -202,9 +202,9 @@ return (0); in = x->revocationDate; if (in != tm) { - in = M_ASN1_TIME_dup(tm); + in = ASN1_STRING_dup(tm); if (in != NULL) { - M_ASN1_TIME_free(x->revocationDate); + ASN1_TIME_free(x->revocationDate); x->revocationDate = in; } }