summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/tasn_enc.c
diff options
context:
space:
mode:
authorjob <>2023-04-28 17:59:53 +0000
committerjob <>2023-04-28 17:59:53 +0000
commit24aa308331dbfa98b78086598d448798f4dc2ab7 (patch)
tree622fd7644d641978f518ce745f3569afb0dc3cb2 /src/lib/libcrypto/asn1/tasn_enc.c
parent34e3c561c803320bc7ec429ea359bc540095d11c (diff)
downloadopenbsd-24aa308331dbfa98b78086598d448798f4dc2ab7.tar.gz
openbsd-24aa308331dbfa98b78086598d448798f4dc2ab7.tar.bz2
openbsd-24aa308331dbfa98b78086598d448798f4dc2ab7.zip
Remove preservation and use of cached DER/BER encodings in the d2i/i2d paths
A long time ago a workflow was envisioned for X509, X509_CRL, and X509_REQ structures in which only fields modified after deserialization would need to be re-encoded upon serialization. Unfortunately, over the years, authors would sometimes forget to add code in setter functions to trigger invalidation of previously cached DER encodings. The presence of stale versions of structures can lead to very hard-to-debug issues and cause immense sorrow. Fully removing the concept of caching DER encodings ensures stale versions of structures can never rear their ugly heads again. OK tb@ jsing@
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_enc.c')
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
index 6e0524c39f..430e8e1e8e 100644
--- a/src/lib/libcrypto/asn1/tasn_enc.c
+++ b/src/lib/libcrypto/asn1/tasn_enc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_enc.c,v 1.29 2023/03/06 12:00:27 tb Exp $ */ 1/* $OpenBSD: tasn_enc.c,v 1.30 2023/04/28 17:59:53 job Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -210,14 +210,6 @@ ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it,
210 /* fall through */ 210 /* fall through */
211 211
212 case ASN1_ITYPE_SEQUENCE: 212 case ASN1_ITYPE_SEQUENCE:
213 i = asn1_enc_restore(&seqcontlen, out, pval, it);
214 /* An error occurred */
215 if (i < 0)
216 return 0;
217 /* We have a valid cached encoding... */
218 if (i > 0)
219 return seqcontlen;
220 /* Otherwise carry on */
221 seqcontlen = 0; 213 seqcontlen = 0;
222 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */ 214 /* If no IMPLICIT tagging set to SEQUENCE, UNIVERSAL */
223 if (tag == -1) { 215 if (tag == -1) {