diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2015-02-09 16:04:47 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2015-02-09 16:04:47 +0000 |
commit | 2e98c50d1cab09e899f8ee544ffa8ca3a9ebfff0 (patch) | |
tree | 3261b53bc8160c974d27f6f4dd8a5fd9a9f934a4 /lib/libcrypto/gost | |
parent | 8d8292131b2ae2efd5982152b95618b052468217 (diff) |
Expand the IMPLEMENT_ASN1_FUNCTIONS macro so that the code is visible and
functions can be readily located.
Change has been scripted and there is no change to the generated assembly.
Discussed with beck@ miod@ tedu@
Diffstat (limited to 'lib/libcrypto/gost')
-rw-r--r-- | lib/libcrypto/gost/gost_asn1.c | 130 |
1 files changed, 125 insertions, 5 deletions
diff --git a/lib/libcrypto/gost/gost_asn1.c b/lib/libcrypto/gost/gost_asn1.c index b8ed244e492..5d7fb51177e 100644 --- a/lib/libcrypto/gost/gost_asn1.c +++ b/lib/libcrypto/gost/gost_asn1.c @@ -21,20 +21,92 @@ ASN1_NDEF_SEQUENCE(GOST_KEY_TRANSPORT) = { ASN1_SIMPLE(GOST_KEY_TRANSPORT, key_info, GOST_KEY_INFO), ASN1_IMP(GOST_KEY_TRANSPORT, key_agreement_info, GOST_KEY_AGREEMENT_INFO, 0) } ASN1_NDEF_SEQUENCE_END(GOST_KEY_TRANSPORT) -IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_TRANSPORT) + +GOST_KEY_TRANSPORT * +d2i_GOST_KEY_TRANSPORT(GOST_KEY_TRANSPORT **a, const unsigned char **in, long len) +{ + return (GOST_KEY_TRANSPORT *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &GOST_KEY_TRANSPORT_it); +} + +int +i2d_GOST_KEY_TRANSPORT(GOST_KEY_TRANSPORT *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_KEY_TRANSPORT_it); +} + +GOST_KEY_TRANSPORT * +GOST_KEY_TRANSPORT_new(void) +{ + return (GOST_KEY_TRANSPORT *)ASN1_item_new(&GOST_KEY_TRANSPORT_it); +} + +void +GOST_KEY_TRANSPORT_free(GOST_KEY_TRANSPORT *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &GOST_KEY_TRANSPORT_it); +} ASN1_NDEF_SEQUENCE(GOST_KEY_INFO) = { ASN1_SIMPLE(GOST_KEY_INFO, encrypted_key, ASN1_OCTET_STRING), ASN1_SIMPLE(GOST_KEY_INFO, imit, ASN1_OCTET_STRING) } ASN1_NDEF_SEQUENCE_END(GOST_KEY_INFO) -IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_INFO) + +GOST_KEY_INFO * +d2i_GOST_KEY_INFO(GOST_KEY_INFO **a, const unsigned char **in, long len) +{ + return (GOST_KEY_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &GOST_KEY_INFO_it); +} + +int +i2d_GOST_KEY_INFO(GOST_KEY_INFO *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_KEY_INFO_it); +} + +GOST_KEY_INFO * +GOST_KEY_INFO_new(void) +{ + return (GOST_KEY_INFO *)ASN1_item_new(&GOST_KEY_INFO_it); +} + +void +GOST_KEY_INFO_free(GOST_KEY_INFO *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &GOST_KEY_INFO_it); +} ASN1_NDEF_SEQUENCE(GOST_KEY_AGREEMENT_INFO) = { ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, cipher, ASN1_OBJECT), ASN1_IMP_OPT(GOST_KEY_AGREEMENT_INFO, ephem_key, X509_PUBKEY, 0), ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, eph_iv, ASN1_OCTET_STRING) } ASN1_NDEF_SEQUENCE_END(GOST_KEY_AGREEMENT_INFO) -IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO) + +GOST_KEY_AGREEMENT_INFO * +d2i_GOST_KEY_AGREEMENT_INFO(GOST_KEY_AGREEMENT_INFO **a, const unsigned char **in, long len) +{ + return (GOST_KEY_AGREEMENT_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &GOST_KEY_AGREEMENT_INFO_it); +} + +int +i2d_GOST_KEY_AGREEMENT_INFO(GOST_KEY_AGREEMENT_INFO *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_KEY_AGREEMENT_INFO_it); +} + +GOST_KEY_AGREEMENT_INFO * +GOST_KEY_AGREEMENT_INFO_new(void) +{ + return (GOST_KEY_AGREEMENT_INFO *)ASN1_item_new(&GOST_KEY_AGREEMENT_INFO_it); +} + +void +GOST_KEY_AGREEMENT_INFO_free(GOST_KEY_AGREEMENT_INFO *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &GOST_KEY_AGREEMENT_INFO_it); +} ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) = { @@ -42,12 +114,60 @@ ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) = { ASN1_SIMPLE(GOST_KEY_PARAMS, hash_params, ASN1_OBJECT), ASN1_OPT(GOST_KEY_PARAMS, cipher_params, ASN1_OBJECT), } ASN1_NDEF_SEQUENCE_END(GOST_KEY_PARAMS) -IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_PARAMS) + +GOST_KEY_PARAMS * +d2i_GOST_KEY_PARAMS(GOST_KEY_PARAMS **a, const unsigned char **in, long len) +{ + return (GOST_KEY_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &GOST_KEY_PARAMS_it); +} + +int +i2d_GOST_KEY_PARAMS(GOST_KEY_PARAMS *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_KEY_PARAMS_it); +} + +GOST_KEY_PARAMS * +GOST_KEY_PARAMS_new(void) +{ + return (GOST_KEY_PARAMS *)ASN1_item_new(&GOST_KEY_PARAMS_it); +} + +void +GOST_KEY_PARAMS_free(GOST_KEY_PARAMS *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &GOST_KEY_PARAMS_it); +} ASN1_NDEF_SEQUENCE(GOST_CIPHER_PARAMS) = { ASN1_SIMPLE(GOST_CIPHER_PARAMS, iv, ASN1_OCTET_STRING), ASN1_SIMPLE(GOST_CIPHER_PARAMS, enc_param_set, ASN1_OBJECT), } ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS) -IMPLEMENT_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS) + +GOST_CIPHER_PARAMS * +d2i_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS **a, const unsigned char **in, long len) +{ + return (GOST_CIPHER_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &GOST_CIPHER_PARAMS_it); +} + +int +i2d_GOST_CIPHER_PARAMS(GOST_CIPHER_PARAMS *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &GOST_CIPHER_PARAMS_it); +} + +GOST_CIPHER_PARAMS * +GOST_CIPHER_PARAMS_new(void) +{ + return (GOST_CIPHER_PARAMS *)ASN1_item_new(&GOST_CIPHER_PARAMS_it); +} + +void +GOST_CIPHER_PARAMS_free(GOST_CIPHER_PARAMS *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &GOST_CIPHER_PARAMS_it); +} #endif |