diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-05-15 00:00:41 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-05-18 18:38:42 +0100 |
commit | 6c5b6cb035666d46495ccbe4a4f3d5e3a659cd40 (patch) | |
tree | c0e8c07829de8bf6846da39017af431ba8eb20e2 /crypto/asn1/f_int.c | |
parent | 978327bcadb738b7bc7a52f74c7b4c5f56bda4a6 (diff) | |
download | openssl-6c5b6cb035666d46495ccbe4a4f3d5e3a659cd40.tar.gz |
ASN1 INTEGER refactor.
Rewrite and tidy ASN1_INTEGER and ASN1_ENUMERATED handling.
Remove code duplication.
New functions to convert between int64_t and ASN.1 types without the
quirks of the old long conversion functions.
Add documentation.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/asn1/f_int.c')
-rw-r--r-- | crypto/asn1/f_int.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c index 61029fa586..9a0928ecbc 100644 --- a/crypto/asn1/f_int.c +++ b/crypto/asn1/f_int.c @@ -204,3 +204,16 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size) ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE); return 0; } + +int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a) +{ + return i2a_ASN1_INTEGER(bp, a); +} + +int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) +{ + int rv = a2i_ASN1_INTEGER(bp, bs, buf, size); + if (rv == 1) + bs->type = V_ASN1_INTEGER | (bs->type & V_ASN1_NEG); + return rv; +} |