diff options
author | jsing <> | 2021-12-25 08:52:44 +0000 |
---|---|---|
committer | jsing <> | 2021-12-25 08:52:44 +0000 |
commit | a1aa360082915390f4dce8cb202c7a908f0801d7 (patch) | |
tree | deb13cf3156e23b9aed2e7ab7fcc949a90f0b8a0 /src/lib/libcrypto/asn1/a_bitstr.c | |
parent | 9bcf656c985ee0377aa1efaa225459e511cda945 (diff) | |
download | openbsd-a1aa360082915390f4dce8cb202c7a908f0801d7.tar.gz openbsd-a1aa360082915390f4dce8cb202c7a908f0801d7.tar.bz2 openbsd-a1aa360082915390f4dce8cb202c7a908f0801d7.zip |
Consolidate code/templates for ASN.1 types.
Where an ASN.1 type has its own file, move the ASN.1 item template and
template related functions into the file.
Discussed with tb@
Diffstat (limited to 'src/lib/libcrypto/asn1/a_bitstr.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 207d80ab38..4ffafd5f86 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_bitstr.c,v 1.32 2021/12/25 07:48:09 jsing Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.33 2021/12/25 08:52:44 jsing 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 | * |
@@ -60,10 +60,29 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | 61 | ||
62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
63 | #include <openssl/asn1t.h> | ||
63 | #include <openssl/conf.h> | 64 | #include <openssl/conf.h> |
64 | #include <openssl/err.h> | 65 | #include <openssl/err.h> |
65 | #include <openssl/x509v3.h> | 66 | #include <openssl/x509v3.h> |
66 | 67 | ||
68 | const ASN1_ITEM ASN1_BIT_STRING_it = { | ||
69 | .itype = ASN1_ITYPE_PRIMITIVE, | ||
70 | .utype = V_ASN1_BIT_STRING, | ||
71 | .sname = "ASN1_BIT_STRING", | ||
72 | }; | ||
73 | |||
74 | ASN1_BIT_STRING * | ||
75 | ASN1_BIT_STRING_new(void) | ||
76 | { | ||
77 | return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it); | ||
78 | } | ||
79 | |||
80 | void | ||
81 | ASN1_BIT_STRING_free(ASN1_BIT_STRING *a) | ||
82 | { | ||
83 | ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it); | ||
84 | } | ||
85 | |||
67 | int | 86 | int |
68 | ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) | 87 | ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len) |
69 | { | 88 | { |
@@ -313,3 +332,16 @@ c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **pp, long len) | |||
313 | 332 | ||
314 | return (NULL); | 333 | return (NULL); |
315 | } | 334 | } |
335 | |||
336 | int | ||
337 | i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out) | ||
338 | { | ||
339 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it); | ||
340 | } | ||
341 | |||
342 | ASN1_BIT_STRING * | ||
343 | d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len) | ||
344 | { | ||
345 | return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
346 | &ASN1_BIT_STRING_it); | ||
347 | } | ||