summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/tasn_fre.c
diff options
context:
space:
mode:
authorjsing <>2022-05-10 05:19:23 +0000
committerjsing <>2022-05-10 05:19:23 +0000
commit81177611f2a8ffaea5e7c83a10826026186d8d8f (patch)
tree3e26f1150af9c6dd479ad5ca7947582f1c29cffe /src/lib/libcrypto/asn1/tasn_fre.c
parent295acdc1d1b92f8bf9f9e729590d5598c3bd0333 (diff)
downloadopenbsd-81177611f2a8ffaea5e7c83a10826026186d8d8f.tar.gz
openbsd-81177611f2a8ffaea5e7c83a10826026186d8d8f.tar.bz2
openbsd-81177611f2a8ffaea5e7c83a10826026186d8d8f.zip
Remove ASN.1 combining.
This was an option used to combine ASN.1 into a single structure, which was only ever used by DSAPublicKey and X509_ATTRIBUTE. Since they no longer use it we can mop this up and simplify all of the related code. ok tb@
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_fre.c')
-rw-r--r--src/lib/libcrypto/asn1/tasn_fre.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c
index 64d3856360..dbf6bf1e8e 100644
--- a/src/lib/libcrypto/asn1/tasn_fre.c
+++ b/src/lib/libcrypto/asn1/tasn_fre.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_fre.c,v 1.18 2022/01/07 12:24:17 tb Exp $ */ 1/* $OpenBSD: tasn_fre.c,v 1.19 2022/05/10 05:19:22 jsing 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 */
@@ -64,25 +64,24 @@
64 64
65#include "asn1_locl.h" 65#include "asn1_locl.h"
66 66
67static void asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, 67static void asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
68 int combine);
69 68
70/* Free up an ASN1 structure */ 69/* Free up an ASN1 structure */
71 70
72void 71void
73ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) 72ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
74{ 73{
75 asn1_item_combine_free(&val, it, 0); 74 asn1_item_free(&val, it);
76} 75}
77 76
78void 77void
79ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) 78ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
80{ 79{
81 asn1_item_combine_free(pval, it, 0); 80 asn1_item_free(pval, it);
82} 81}
83 82
84static void 83static void
85asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine) 84asn1_item_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
86{ 85{
87 const ASN1_TEMPLATE *tt = NULL, *seqtt; 86 const ASN1_TEMPLATE *tt = NULL, *seqtt;
88 const ASN1_EXTERN_FUNCS *ef; 87 const ASN1_EXTERN_FUNCS *ef;
@@ -126,10 +125,8 @@ asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
126 } 125 }
127 if (asn1_cb) 126 if (asn1_cb)
128 asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); 127 asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
129 if (!combine) { 128 free(*pval);
130 free(*pval); 129 *pval = NULL;
131 *pval = NULL;
132 }
133 break; 130 break;
134 131
135 case ASN1_ITYPE_EXTERN: 132 case ASN1_ITYPE_EXTERN:
@@ -164,10 +161,8 @@ asn1_item_combine_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int combine)
164 } 161 }
165 if (asn1_cb) 162 if (asn1_cb)
166 asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL); 163 asn1_cb(ASN1_OP_FREE_POST, pval, it, NULL);
167 if (!combine) { 164 free(*pval);
168 free(*pval); 165 *pval = NULL;
169 *pval = NULL;
170 }
171 break; 166 break;
172 } 167 }
173} 168}
@@ -181,14 +176,12 @@ ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
181 for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) { 176 for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) {
182 ASN1_VALUE *vtmp; 177 ASN1_VALUE *vtmp;
183 vtmp = sk_ASN1_VALUE_value(sk, i); 178 vtmp = sk_ASN1_VALUE_value(sk, i);
184 asn1_item_combine_free(&vtmp, tt->item, 179 asn1_item_free(&vtmp, tt->item);
185 0);
186 } 180 }
187 sk_ASN1_VALUE_free(sk); 181 sk_ASN1_VALUE_free(sk);
188 *pval = NULL; 182 *pval = NULL;
189 } else 183 } else
190 asn1_item_combine_free(pval, tt->item, 184 asn1_item_free(pval, tt->item);
191 tt->flags & ASN1_TFLG_COMBINE);
192} 185}
193 186
194void 187void