diff options
| author | job <> | 2023-04-25 10:18:39 +0000 |
|---|---|---|
| committer | job <> | 2023-04-25 10:18:39 +0000 |
| commit | a7ab3f86f72f0e59addfebe37655ccb1adf3ede5 (patch) | |
| tree | a445ea785167ae55b14b10639b10b1ebbb6348a0 /src/lib/libc | |
| parent | 4816834ca1952fbad0408a54896fa639a391d151 (diff) | |
| download | openbsd-a7ab3f86f72f0e59addfebe37655ccb1adf3ede5.tar.gz openbsd-a7ab3f86f72f0e59addfebe37655ccb1adf3ede5.tar.bz2 openbsd-a7ab3f86f72f0e59addfebe37655ccb1adf3ede5.zip | |
Invalidate the DER cache earlier on in X509 setter functions
Note that it is important to invalidate the cache before returning,
as the return might bubble up an error.
OK tb@ jsing@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_set.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c index 19e0f2b55f..cd12c9ec2f 100644 --- a/src/lib/libcrypto/x509/x509_set.c +++ b/src/lib/libcrypto/x509/x509_set.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: x509_set.c,v 1.24 2023/02/23 18:12:32 job Exp $ */ | 1 | /* $OpenBSD: x509_set.c,v 1.25 2023/04/25 10:18:39 job Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -88,6 +88,7 @@ X509_set_version(X509 *x, long version) | |||
| 88 | if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL) | 88 | if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL) |
| 89 | return (0); | 89 | return (0); |
| 90 | } | 90 | } |
| 91 | x->cert_info->enc.modified = 1; | ||
| 91 | return (ASN1_INTEGER_set(x->cert_info->version, version)); | 92 | return (ASN1_INTEGER_set(x->cert_info->version, version)); |
| 92 | } | 93 | } |
| 93 | LCRYPTO_ALIAS(X509_set_version); | 94 | LCRYPTO_ALIAS(X509_set_version); |
| @@ -110,6 +111,7 @@ X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial) | |||
| 110 | if (in != serial) { | 111 | if (in != serial) { |
| 111 | in = ASN1_INTEGER_dup(serial); | 112 | in = ASN1_INTEGER_dup(serial); |
| 112 | if (in != NULL) { | 113 | if (in != NULL) { |
| 114 | x->cert_info->enc.modified = 1; | ||
| 113 | ASN1_INTEGER_free(x->cert_info->serialNumber); | 115 | ASN1_INTEGER_free(x->cert_info->serialNumber); |
| 114 | x->cert_info->serialNumber = in; | 116 | x->cert_info->serialNumber = in; |
| 115 | } | 117 | } |
| @@ -123,6 +125,7 @@ X509_set_issuer_name(X509 *x, X509_NAME *name) | |||
| 123 | { | 125 | { |
| 124 | if ((x == NULL) || (x->cert_info == NULL)) | 126 | if ((x == NULL) || (x->cert_info == NULL)) |
| 125 | return (0); | 127 | return (0); |
| 128 | x->cert_info->enc.modified = 1; | ||
| 126 | return (X509_NAME_set(&x->cert_info->issuer, name)); | 129 | return (X509_NAME_set(&x->cert_info->issuer, name)); |
| 127 | } | 130 | } |
| 128 | LCRYPTO_ALIAS(X509_set_issuer_name); | 131 | LCRYPTO_ALIAS(X509_set_issuer_name); |
| @@ -132,6 +135,7 @@ X509_set_subject_name(X509 *x, X509_NAME *name) | |||
| 132 | { | 135 | { |
| 133 | if (x == NULL || x->cert_info == NULL) | 136 | if (x == NULL || x->cert_info == NULL) |
| 134 | return (0); | 137 | return (0); |
| 138 | x->cert_info->enc.modified = 1; | ||
| 135 | return (X509_NAME_set(&x->cert_info->subject, name)); | 139 | return (X509_NAME_set(&x->cert_info->subject, name)); |
| 136 | } | 140 | } |
| 137 | LCRYPTO_ALIAS(X509_set_subject_name); | 141 | LCRYPTO_ALIAS(X509_set_subject_name); |
| @@ -163,6 +167,7 @@ X509_set_notBefore(X509 *x, const ASN1_TIME *tm) | |||
| 163 | if (in != tm) { | 167 | if (in != tm) { |
| 164 | in = ASN1_STRING_dup(tm); | 168 | in = ASN1_STRING_dup(tm); |
| 165 | if (in != NULL) { | 169 | if (in != NULL) { |
| 170 | x->cert_info->enc.modified = 1; | ||
| 166 | ASN1_TIME_free(x->cert_info->validity->notBefore); | 171 | ASN1_TIME_free(x->cert_info->validity->notBefore); |
| 167 | x->cert_info->validity->notBefore = in; | 172 | x->cert_info->validity->notBefore = in; |
| 168 | } | 173 | } |
| @@ -205,6 +210,7 @@ X509_set_notAfter(X509 *x, const ASN1_TIME *tm) | |||
| 205 | if (in != tm) { | 210 | if (in != tm) { |
| 206 | in = ASN1_STRING_dup(tm); | 211 | in = ASN1_STRING_dup(tm); |
| 207 | if (in != NULL) { | 212 | if (in != NULL) { |
| 213 | x->cert_info->enc.modified = 1; | ||
| 208 | ASN1_TIME_free(x->cert_info->validity->notAfter); | 214 | ASN1_TIME_free(x->cert_info->validity->notAfter); |
| 209 | x->cert_info->validity->notAfter = in; | 215 | x->cert_info->validity->notAfter = in; |
| 210 | } | 216 | } |
| @@ -225,6 +231,7 @@ X509_set_pubkey(X509 *x, EVP_PKEY *pkey) | |||
| 225 | { | 231 | { |
| 226 | if ((x == NULL) || (x->cert_info == NULL)) | 232 | if ((x == NULL) || (x->cert_info == NULL)) |
| 227 | return (0); | 233 | return (0); |
| 234 | x->cert_info->enc.modified = 1; | ||
| 228 | return (X509_PUBKEY_set(&(x->cert_info->key), pkey)); | 235 | return (X509_PUBKEY_set(&(x->cert_info->key), pkey)); |
| 229 | } | 236 | } |
| 230 | LCRYPTO_ALIAS(X509_set_pubkey); | 237 | LCRYPTO_ALIAS(X509_set_pubkey); |
