summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r--src/lib/libcrypto/asn1/a_type.c4
-rw-r--r--src/lib/libcrypto/asn1/asn1_local.h8
-rw-r--r--src/lib/libcrypto/asn1/asn1t.h9
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c20
-rw-r--r--src/lib/libcrypto/asn1/tasn_enc.c10
-rw-r--r--src/lib/libcrypto/asn1/tasn_fre.c4
-rw-r--r--src/lib/libcrypto/asn1/tasn_new.c4
7 files changed, 15 insertions, 44 deletions
diff --git a/src/lib/libcrypto/asn1/a_type.c b/src/lib/libcrypto/asn1/a_type.c
index e1506cdcb4..ef0a76e810 100644
--- a/src/lib/libcrypto/asn1/a_type.c
+++ b/src/lib/libcrypto/asn1/a_type.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_type.c,v 1.26 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: a_type.c,v 1.27 2023/07/28 10:00:10 tb 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 *
@@ -62,6 +62,8 @@
62#include <openssl/err.h> 62#include <openssl/err.h>
63#include <openssl/objects.h> 63#include <openssl/objects.h>
64 64
65#include "asn1_local.h"
66
65typedef struct { 67typedef struct {
66 ASN1_INTEGER *num; 68 ASN1_INTEGER *num;
67 ASN1_OCTET_STRING *value; 69 ASN1_OCTET_STRING *value;
diff --git a/src/lib/libcrypto/asn1/asn1_local.h b/src/lib/libcrypto/asn1/asn1_local.h
index 0ef5101fcb..566ace798b 100644
--- a/src/lib/libcrypto/asn1/asn1_local.h
+++ b/src/lib/libcrypto/asn1/asn1_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_local.h,v 1.3 2023/07/28 09:58:30 tb Exp $ */ 1/* $OpenBSD: asn1_local.h,v 1.4 2023/07/28 10:00:10 tb 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 2006. 3 * project 2006.
4 */ 4 */
@@ -263,4 +263,10 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
263 const ASN1_ITEM *it); 263 const ASN1_ITEM *it);
264ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it); 264ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
265 265
266int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
267void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
268
269int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
270void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
271
266__END_HIDDEN_DECLS 272__END_HIDDEN_DECLS
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h
index bb49be286f..4d79f82ec7 100644
--- a/src/lib/libcrypto/asn1/asn1t.h
+++ b/src/lib/libcrypto/asn1/asn1t.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1t.h,v 1.22 2022/09/03 16:01:23 jsing Exp $ */ 1/* $OpenBSD: asn1t.h,v 1.23 2023/07/28 10:00:10 tb 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 */
@@ -896,17 +896,10 @@ DECLARE_STACK_OF(ASN1_VALUE)
896 896
897int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it); 897int ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
898void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it); 898void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
899int ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
900int ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);
901
902void ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);
903int ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt);
904int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, 899int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,
905 int tag, int aclass, char opt, ASN1_TLC *ctx); 900 int tag, int aclass, char opt, ASN1_TLC *ctx);
906 901
907int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); 902int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);
908int ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt);
909void ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);
910 903
911#ifdef __cplusplus 904#ifdef __cplusplus
912} 905}
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index 553cab2494..31b9efee54 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_dec.c,v 1.87 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.88 2023/07/28 10:00:10 tb 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 */
@@ -1258,21 +1258,3 @@ ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long inlen,
1258 return ret; 1258 return ret;
1259} 1259}
1260LCRYPTO_ALIAS(ASN1_item_ex_d2i); 1260LCRYPTO_ALIAS(ASN1_item_ex_d2i);
1261
1262int
1263ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
1264 const ASN1_TEMPLATE *at)
1265{
1266 CBS cbs;
1267 int ret;
1268
1269 if (len < 0)
1270 return 0;
1271
1272 CBS_init(&cbs, *in, len);
1273 if ((ret = asn1_template_d2i(pval, &cbs, at, 0, 0)) == 1)
1274 *in = CBS_data(&cbs);
1275
1276 return ret;
1277}
1278LCRYPTO_ALIAS(ASN1_template_d2i);
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c
index be0579f840..b71993a139 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.32 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: tasn_enc.c,v 1.33 2023/07/28 10:00:10 tb 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 */
@@ -271,14 +271,6 @@ ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it,
271} 271}
272LCRYPTO_ALIAS(ASN1_item_ex_i2d); 272LCRYPTO_ALIAS(ASN1_item_ex_i2d);
273 273
274int
275ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out,
276 const ASN1_TEMPLATE *tt)
277{
278 return asn1_template_ex_i2d(pval, out, tt, -1, 0);
279}
280LCRYPTO_ALIAS(ASN1_template_i2d);
281
282static int 274static int
283asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out, 275asn1_template_ex_i2d(ASN1_VALUE **pval, unsigned char **out,
284 const ASN1_TEMPLATE *tt, int tag, int iclass) 276 const ASN1_TEMPLATE *tt, int tag, int iclass)
diff --git a/src/lib/libcrypto/asn1/tasn_fre.c b/src/lib/libcrypto/asn1/tasn_fre.c
index eb205dd6ab..83c073b55d 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.22 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: tasn_fre.c,v 1.23 2023/07/28 10:00:10 tb 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 */
@@ -185,7 +185,6 @@ ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
185 } else 185 } else
186 asn1_item_free(pval, tt->item); 186 asn1_item_free(pval, tt->item);
187} 187}
188LCRYPTO_ALIAS(ASN1_template_free);
189 188
190void 189void
191ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it) 190ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
@@ -242,4 +241,3 @@ ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
242 } 241 }
243 *pval = NULL; 242 *pval = NULL;
244} 243}
245LCRYPTO_ALIAS(ASN1_primitive_free);
diff --git a/src/lib/libcrypto/asn1/tasn_new.c b/src/lib/libcrypto/asn1/tasn_new.c
index 555267c48f..10c1137dbf 100644
--- a/src/lib/libcrypto/asn1/tasn_new.c
+++ b/src/lib/libcrypto/asn1/tasn_new.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_new.c,v 1.24 2023/07/05 21:23:36 beck Exp $ */ 1/* $OpenBSD: tasn_new.c,v 1.25 2023/07/28 10:00:10 tb 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 */
@@ -248,7 +248,6 @@ ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
248 done: 248 done:
249 return ret; 249 return ret;
250} 250}
251LCRYPTO_ALIAS(ASN1_template_new);
252 251
253static void 252static void
254asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 253asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
@@ -318,7 +317,6 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
318 return 1; 317 return 1;
319 return 0; 318 return 0;
320} 319}
321LCRYPTO_ALIAS(ASN1_primitive_new);
322 320
323static void 321static void
324asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it) 322asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)