diff options
-rw-r--r-- | lib/libcrypto/asn1/a_time.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/nsseq.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/p5_pbe.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/p5_pbev2.c | 54 | ||||
-rw-r--r-- | lib/libcrypto/asn1/p8_pkey.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/tasn_typ.c | 392 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_algor.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_attrib.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_crl.c | 80 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_exten.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_name.c | 54 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_nx509.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_pubkey.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_req.c | 54 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_sig.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_spki.c | 54 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_val.c | 28 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_x509.c | 54 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_x509a.c | 54 |
19 files changed, 1044 insertions, 60 deletions
diff --git a/lib/libcrypto/asn1/a_time.c b/lib/libcrypto/asn1/a_time.c index c5e882a4f69..95481fc4c6f 100644 --- a/lib/libcrypto/asn1/a_time.c +++ b/lib/libcrypto/asn1/a_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_time.c,v 1.22 2015/02/07 13:19:15 doug Exp $ */ +/* $OpenBSD: a_time.c,v 1.23 2015/02/09 15:05:59 jsing Exp $ */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * @@ -71,7 +71,31 @@ IMPLEMENT_ASN1_MSTRING(ASN1_TIME, B_ASN1_TIME) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_TIME) + +ASN1_TIME * +d2i_ASN1_TIME(ASN1_TIME **a, const unsigned char **in, long len) +{ + return (ASN1_TIME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_TIME_it); +} + +int +i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_TIME_it); +} + +ASN1_TIME * +ASN1_TIME_new(void) +{ + return (ASN1_TIME *)ASN1_item_new(&ASN1_TIME_it); +} + +void +ASN1_TIME_free(ASN1_TIME *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_TIME_it); +} ASN1_TIME * ASN1_TIME_set(ASN1_TIME *s, time_t t) diff --git a/lib/libcrypto/asn1/nsseq.c b/lib/libcrypto/asn1/nsseq.c index 97af462dc0f..ceab3992fd6 100644 --- a/lib/libcrypto/asn1/nsseq.c +++ b/lib/libcrypto/asn1/nsseq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nsseq.c,v 1.7 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: nsseq.c,v 1.8 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -80,4 +80,28 @@ ASN1_SEQUENCE_cb(NETSCAPE_CERT_SEQUENCE, nsseq_cb) = { ASN1_EXP_SEQUENCE_OF_OPT(NETSCAPE_CERT_SEQUENCE, certs, X509, 0) } ASN1_SEQUENCE_END_cb(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE) -IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE) + +NETSCAPE_CERT_SEQUENCE * +d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, const unsigned char **in, long len) +{ + return (NETSCAPE_CERT_SEQUENCE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &NETSCAPE_CERT_SEQUENCE_it); +} + +int +i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_CERT_SEQUENCE_it); +} + +NETSCAPE_CERT_SEQUENCE * +NETSCAPE_CERT_SEQUENCE_new(void) +{ + return (NETSCAPE_CERT_SEQUENCE *)ASN1_item_new(&NETSCAPE_CERT_SEQUENCE_it); +} + +void +NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_CERT_SEQUENCE_it); +} diff --git a/lib/libcrypto/asn1/p5_pbe.c b/lib/libcrypto/asn1/p5_pbe.c index 44fbb648bea..7491a5bdc7f 100644 --- a/lib/libcrypto/asn1/p5_pbe.c +++ b/lib/libcrypto/asn1/p5_pbe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_pbe.c,v 1.17 2014/10/22 13:02:03 jsing Exp $ */ +/* $OpenBSD: p5_pbe.c,v 1.18 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -71,7 +71,31 @@ ASN1_SEQUENCE(PBEPARAM) = { ASN1_SIMPLE(PBEPARAM, iter, ASN1_INTEGER) } ASN1_SEQUENCE_END(PBEPARAM) -IMPLEMENT_ASN1_FUNCTIONS(PBEPARAM) + +PBEPARAM * +d2i_PBEPARAM(PBEPARAM **a, const unsigned char **in, long len) +{ + return (PBEPARAM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &PBEPARAM_it); +} + +int +i2d_PBEPARAM(PBEPARAM *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &PBEPARAM_it); +} + +PBEPARAM * +PBEPARAM_new(void) +{ + return (PBEPARAM *)ASN1_item_new(&PBEPARAM_it); +} + +void +PBEPARAM_free(PBEPARAM *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &PBEPARAM_it); +} /* Set an algorithm identifier for a PKCS#5 PBE algorithm */ diff --git a/lib/libcrypto/asn1/p5_pbev2.c b/lib/libcrypto/asn1/p5_pbev2.c index 09479652192..1189e7e26b0 100644 --- a/lib/libcrypto/asn1/p5_pbev2.c +++ b/lib/libcrypto/asn1/p5_pbev2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p5_pbev2.c,v 1.18 2014/10/22 13:02:03 jsing Exp $ */ +/* $OpenBSD: p5_pbev2.c,v 1.19 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999-2004. */ @@ -71,7 +71,31 @@ ASN1_SEQUENCE(PBE2PARAM) = { ASN1_SIMPLE(PBE2PARAM, encryption, X509_ALGOR) } ASN1_SEQUENCE_END(PBE2PARAM) -IMPLEMENT_ASN1_FUNCTIONS(PBE2PARAM) + +PBE2PARAM * +d2i_PBE2PARAM(PBE2PARAM **a, const unsigned char **in, long len) +{ + return (PBE2PARAM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &PBE2PARAM_it); +} + +int +i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &PBE2PARAM_it); +} + +PBE2PARAM * +PBE2PARAM_new(void) +{ + return (PBE2PARAM *)ASN1_item_new(&PBE2PARAM_it); +} + +void +PBE2PARAM_free(PBE2PARAM *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &PBE2PARAM_it); +} ASN1_SEQUENCE(PBKDF2PARAM) = { ASN1_SIMPLE(PBKDF2PARAM, salt, ASN1_ANY), @@ -80,7 +104,31 @@ ASN1_SEQUENCE(PBKDF2PARAM) = { ASN1_OPT(PBKDF2PARAM, prf, X509_ALGOR) } ASN1_SEQUENCE_END(PBKDF2PARAM) -IMPLEMENT_ASN1_FUNCTIONS(PBKDF2PARAM) + +PBKDF2PARAM * +d2i_PBKDF2PARAM(PBKDF2PARAM **a, const unsigned char **in, long len) +{ + return (PBKDF2PARAM *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &PBKDF2PARAM_it); +} + +int +i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &PBKDF2PARAM_it); +} + +PBKDF2PARAM * +PBKDF2PARAM_new(void) +{ + return (PBKDF2PARAM *)ASN1_item_new(&PBKDF2PARAM_it); +} + +void +PBKDF2PARAM_free(PBKDF2PARAM *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &PBKDF2PARAM_it); +} /* Return an algorithm identifier for a PKCS#5 v2.0 PBE algorithm: * yes I know this is horrible! diff --git a/lib/libcrypto/asn1/p8_pkey.c b/lib/libcrypto/asn1/p8_pkey.c index 3aacecb8fb4..f8688ebc176 100644 --- a/lib/libcrypto/asn1/p8_pkey.c +++ b/lib/libcrypto/asn1/p8_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p8_pkey.c,v 1.12 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: p8_pkey.c,v 1.13 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -82,7 +82,31 @@ ASN1_SEQUENCE_cb(PKCS8_PRIV_KEY_INFO, pkey_cb) = { ASN1_IMP_SET_OF_OPT(PKCS8_PRIV_KEY_INFO, attributes, X509_ATTRIBUTE, 0) } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) -IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) + +PKCS8_PRIV_KEY_INFO * +d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, const unsigned char **in, long len) +{ + return (PKCS8_PRIV_KEY_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &PKCS8_PRIV_KEY_INFO_it); +} + +int +i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &PKCS8_PRIV_KEY_INFO_it); +} + +PKCS8_PRIV_KEY_INFO * +PKCS8_PRIV_KEY_INFO_new(void) +{ + return (PKCS8_PRIV_KEY_INFO *)ASN1_item_new(&PKCS8_PRIV_KEY_INFO_it); +} + +void +PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &PKCS8_PRIV_KEY_INFO_it); +} int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, int version, diff --git a/lib/libcrypto/asn1/tasn_typ.c b/lib/libcrypto/asn1/tasn_typ.c index 04d9c84180b..2f44b4229bb 100644 --- a/lib/libcrypto/asn1/tasn_typ.c +++ b/lib/libcrypto/asn1/tasn_typ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_typ.c,v 1.6 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: tasn_typ.c,v 1.7 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -63,51 +63,411 @@ IMPLEMENT_ASN1_TYPE(ASN1_INTEGER) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_INTEGER) + +ASN1_INTEGER * +d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len) +{ + return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_INTEGER_it); +} + +int +i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it); +} + +ASN1_INTEGER * +ASN1_INTEGER_new(void) +{ + return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it); +} + +void +ASN1_INTEGER_free(ASN1_INTEGER *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it); +} IMPLEMENT_ASN1_TYPE(ASN1_ENUMERATED) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_ENUMERATED) + +ASN1_ENUMERATED * +d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len) +{ + return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_ENUMERATED_it); +} + +int +i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it); +} + +ASN1_ENUMERATED * +ASN1_ENUMERATED_new(void) +{ + return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it); +} + +void +ASN1_ENUMERATED_free(ASN1_ENUMERATED *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it); +} IMPLEMENT_ASN1_TYPE(ASN1_BIT_STRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_BIT_STRING) + +ASN1_BIT_STRING * +d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len) +{ + return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_BIT_STRING_it); +} + +int +i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it); +} + +ASN1_BIT_STRING * +ASN1_BIT_STRING_new(void) +{ + return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it); +} + +void +ASN1_BIT_STRING_free(ASN1_BIT_STRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_OCTET_STRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_OCTET_STRING) + +ASN1_OCTET_STRING * +d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, const unsigned char **in, long len) +{ + return (ASN1_OCTET_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_OCTET_STRING_it); +} + +int +i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_OCTET_STRING_it); +} + +ASN1_OCTET_STRING * +ASN1_OCTET_STRING_new(void) +{ + return (ASN1_OCTET_STRING *)ASN1_item_new(&ASN1_OCTET_STRING_it); +} + +void +ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_OCTET_STRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_NULL) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_NULL) + +ASN1_NULL * +d2i_ASN1_NULL(ASN1_NULL **a, const unsigned char **in, long len) +{ + return (ASN1_NULL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_NULL_it); +} + +int +i2d_ASN1_NULL(ASN1_NULL *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_NULL_it); +} + +ASN1_NULL * +ASN1_NULL_new(void) +{ + return (ASN1_NULL *)ASN1_item_new(&ASN1_NULL_it); +} + +void +ASN1_NULL_free(ASN1_NULL *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_NULL_it); +} IMPLEMENT_ASN1_TYPE(ASN1_OBJECT) IMPLEMENT_ASN1_TYPE(ASN1_UTF8STRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_UTF8STRING) + +ASN1_UTF8STRING * +d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, const unsigned char **in, long len) +{ + return (ASN1_UTF8STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_UTF8STRING_it); +} + +int +i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_UTF8STRING_it); +} + +ASN1_UTF8STRING * +ASN1_UTF8STRING_new(void) +{ + return (ASN1_UTF8STRING *)ASN1_item_new(&ASN1_UTF8STRING_it); +} + +void +ASN1_UTF8STRING_free(ASN1_UTF8STRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_UTF8STRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_PRINTABLESTRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING) + +ASN1_PRINTABLESTRING * +d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a, const unsigned char **in, long len) +{ + return (ASN1_PRINTABLESTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_PRINTABLESTRING_it); +} + +int +i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_PRINTABLESTRING_it); +} + +ASN1_PRINTABLESTRING * +ASN1_PRINTABLESTRING_new(void) +{ + return (ASN1_PRINTABLESTRING *)ASN1_item_new(&ASN1_PRINTABLESTRING_it); +} + +void +ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_PRINTABLESTRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_T61STRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_T61STRING) + +ASN1_T61STRING * +d2i_ASN1_T61STRING(ASN1_T61STRING **a, const unsigned char **in, long len) +{ + return (ASN1_T61STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_T61STRING_it); +} + +int +i2d_ASN1_T61STRING(ASN1_T61STRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_T61STRING_it); +} + +ASN1_T61STRING * +ASN1_T61STRING_new(void) +{ + return (ASN1_T61STRING *)ASN1_item_new(&ASN1_T61STRING_it); +} + +void +ASN1_T61STRING_free(ASN1_T61STRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_T61STRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_IA5STRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_IA5STRING) + +ASN1_IA5STRING * +d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, const unsigned char **in, long len) +{ + return (ASN1_IA5STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_IA5STRING_it); +} + +int +i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_IA5STRING_it); +} + +ASN1_IA5STRING * +ASN1_IA5STRING_new(void) +{ + return (ASN1_IA5STRING *)ASN1_item_new(&ASN1_IA5STRING_it); +} + +void +ASN1_IA5STRING_free(ASN1_IA5STRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_IA5STRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_GENERALSTRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_GENERALSTRING) + +ASN1_GENERALSTRING * +d2i_ASN1_GENERALSTRING(ASN1_GENERALSTRING **a, const unsigned char **in, long len) +{ + return (ASN1_GENERALSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_GENERALSTRING_it); +} + +int +i2d_ASN1_GENERALSTRING(ASN1_GENERALSTRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_GENERALSTRING_it); +} + +ASN1_GENERALSTRING * +ASN1_GENERALSTRING_new(void) +{ + return (ASN1_GENERALSTRING *)ASN1_item_new(&ASN1_GENERALSTRING_it); +} + +void +ASN1_GENERALSTRING_free(ASN1_GENERALSTRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_GENERALSTRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_UTCTIME) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_UTCTIME) + +ASN1_UTCTIME * +d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, const unsigned char **in, long len) +{ + return (ASN1_UTCTIME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_UTCTIME_it); +} + +int +i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_UTCTIME_it); +} + +ASN1_UTCTIME * +ASN1_UTCTIME_new(void) +{ + return (ASN1_UTCTIME *)ASN1_item_new(&ASN1_UTCTIME_it); +} + +void +ASN1_UTCTIME_free(ASN1_UTCTIME *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_UTCTIME_it); +} IMPLEMENT_ASN1_TYPE(ASN1_GENERALIZEDTIME) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME) + +ASN1_GENERALIZEDTIME * +d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a, const unsigned char **in, long len) +{ + return (ASN1_GENERALIZEDTIME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_GENERALIZEDTIME_it); +} + +int +i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_GENERALIZEDTIME_it); +} + +ASN1_GENERALIZEDTIME * +ASN1_GENERALIZEDTIME_new(void) +{ + return (ASN1_GENERALIZEDTIME *)ASN1_item_new(&ASN1_GENERALIZEDTIME_it); +} + +void +ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_GENERALIZEDTIME_it); +} IMPLEMENT_ASN1_TYPE(ASN1_VISIBLESTRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_VISIBLESTRING) + +ASN1_VISIBLESTRING * +d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a, const unsigned char **in, long len) +{ + return (ASN1_VISIBLESTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_VISIBLESTRING_it); +} + +int +i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_VISIBLESTRING_it); +} + +ASN1_VISIBLESTRING * +ASN1_VISIBLESTRING_new(void) +{ + return (ASN1_VISIBLESTRING *)ASN1_item_new(&ASN1_VISIBLESTRING_it); +} + +void +ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_VISIBLESTRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_UNIVERSALSTRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING) + +ASN1_UNIVERSALSTRING * +d2i_ASN1_UNIVERSALSTRING(ASN1_UNIVERSALSTRING **a, const unsigned char **in, long len) +{ + return (ASN1_UNIVERSALSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_UNIVERSALSTRING_it); +} + +int +i2d_ASN1_UNIVERSALSTRING(ASN1_UNIVERSALSTRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_UNIVERSALSTRING_it); +} + +ASN1_UNIVERSALSTRING * +ASN1_UNIVERSALSTRING_new(void) +{ + return (ASN1_UNIVERSALSTRING *)ASN1_item_new(&ASN1_UNIVERSALSTRING_it); +} + +void +ASN1_UNIVERSALSTRING_free(ASN1_UNIVERSALSTRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_UNIVERSALSTRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_BMPSTRING) -IMPLEMENT_ASN1_FUNCTIONS(ASN1_BMPSTRING) + +ASN1_BMPSTRING * +d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, const unsigned char **in, long len) +{ + return (ASN1_BMPSTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &ASN1_BMPSTRING_it); +} + +int +i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BMPSTRING_it); +} + +ASN1_BMPSTRING * +ASN1_BMPSTRING_new(void) +{ + return (ASN1_BMPSTRING *)ASN1_item_new(&ASN1_BMPSTRING_it); +} + +void +ASN1_BMPSTRING_free(ASN1_BMPSTRING *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &ASN1_BMPSTRING_it); +} IMPLEMENT_ASN1_TYPE(ASN1_ANY) diff --git a/lib/libcrypto/asn1/x_algor.c b/lib/libcrypto/asn1/x_algor.c index 71aeaaade07..7d264f9fd3a 100644 --- a/lib/libcrypto/asn1/x_algor.c +++ b/lib/libcrypto/asn1/x_algor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_algor.c,v 1.13 2015/01/28 04:14:31 beck Exp $ */ +/* $OpenBSD: x_algor.c,v 1.14 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -70,7 +70,31 @@ ASN1_ITEM_TEMPLATE(X509_ALGORS) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, algorithms, X509_ALGOR) ASN1_ITEM_TEMPLATE_END(X509_ALGORS) -IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR) + +X509_ALGOR * +d2i_X509_ALGOR(X509_ALGOR **a, const unsigned char **in, long len) +{ + return (X509_ALGOR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_ALGOR_it); +} + +int +i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ALGOR_it); +} + +X509_ALGOR * +X509_ALGOR_new(void) +{ + return (X509_ALGOR *)ASN1_item_new(&X509_ALGOR_it); +} + +void +X509_ALGOR_free(X509_ALGOR *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_ALGOR_it); +} IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS) IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR) diff --git a/lib/libcrypto/asn1/x_attrib.c b/lib/libcrypto/asn1/x_attrib.c index 1efbb98bbd7..aafd5dd4851 100644 --- a/lib/libcrypto/asn1/x_attrib.c +++ b/lib/libcrypto/asn1/x_attrib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_attrib.c,v 1.9 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_attrib.c,v 1.10 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -93,7 +93,31 @@ ASN1_SEQUENCE(X509_ATTRIBUTE) = { ASN1_EX_COMBINE(0, 0, X509_ATTRIBUTE_SET) } ASN1_SEQUENCE_END(X509_ATTRIBUTE) -IMPLEMENT_ASN1_FUNCTIONS(X509_ATTRIBUTE) + +X509_ATTRIBUTE * +d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, const unsigned char **in, long len) +{ + return (X509_ATTRIBUTE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_ATTRIBUTE_it); +} + +int +i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_ATTRIBUTE_it); +} + +X509_ATTRIBUTE * +X509_ATTRIBUTE_new(void) +{ + return (X509_ATTRIBUTE *)ASN1_item_new(&X509_ATTRIBUTE_it); +} + +void +X509_ATTRIBUTE_free(X509_ATTRIBUTE *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_ATTRIBUTE_it); +} IMPLEMENT_ASN1_DUP_FUNCTION(X509_ATTRIBUTE) X509_ATTRIBUTE * diff --git a/lib/libcrypto/asn1/x_crl.c b/lib/libcrypto/asn1/x_crl.c index bdec50dc800..2539fd92c40 100644 --- a/lib/libcrypto/asn1/x_crl.c +++ b/lib/libcrypto/asn1/x_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_crl.c,v 1.18 2014/07/11 13:54:41 miod Exp $ */ +/* $OpenBSD: x_crl.c,v 1.19 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -337,9 +337,81 @@ ASN1_SEQUENCE_ref(X509_CRL, crl_cb, CRYPTO_LOCK_X509_CRL) = { ASN1_SIMPLE(X509_CRL, signature, ASN1_BIT_STRING) } ASN1_SEQUENCE_END_ref(X509_CRL, X509_CRL) -IMPLEMENT_ASN1_FUNCTIONS(X509_REVOKED) -IMPLEMENT_ASN1_FUNCTIONS(X509_CRL_INFO) -IMPLEMENT_ASN1_FUNCTIONS(X509_CRL) + +X509_REVOKED * +d2i_X509_REVOKED(X509_REVOKED **a, const unsigned char **in, long len) +{ + return (X509_REVOKED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_REVOKED_it); +} + +int +i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_REVOKED_it); +} + +X509_REVOKED * +X509_REVOKED_new(void) +{ + return (X509_REVOKED *)ASN1_item_new(&X509_REVOKED_it); +} + +void +X509_REVOKED_free(X509_REVOKED *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_REVOKED_it); +} + +X509_CRL_INFO * +d2i_X509_CRL_INFO(X509_CRL_INFO **a, const unsigned char **in, long len) +{ + return (X509_CRL_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_CRL_INFO_it); +} + +int +i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CRL_INFO_it); +} + +X509_CRL_INFO * +X509_CRL_INFO_new(void) +{ + return (X509_CRL_INFO *)ASN1_item_new(&X509_CRL_INFO_it); +} + +void +X509_CRL_INFO_free(X509_CRL_INFO *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_CRL_INFO_it); +} + +X509_CRL * +d2i_X509_CRL(X509_CRL **a, const unsigned char **in, long len) +{ + return (X509_CRL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_CRL_it); +} + +int +i2d_X509_CRL(X509_CRL *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CRL_it); +} + +X509_CRL * +X509_CRL_new(void) +{ + return (X509_CRL *)ASN1_item_new(&X509_CRL_it); +} + +void +X509_CRL_free(X509_CRL *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_CRL_it); +} IMPLEMENT_ASN1_DUP_FUNCTION(X509_CRL) static int diff --git a/lib/libcrypto/asn1/x_exten.c b/lib/libcrypto/asn1/x_exten.c index a3fa88498b1..40c521ec800 100644 --- a/lib/libcrypto/asn1/x_exten.c +++ b/lib/libcrypto/asn1/x_exten.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_exten.c,v 1.9 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: x_exten.c,v 1.10 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -71,6 +71,30 @@ ASN1_ITEM_TEMPLATE(X509_EXTENSIONS) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, Extension, X509_EXTENSION) ASN1_ITEM_TEMPLATE_END(X509_EXTENSIONS) -IMPLEMENT_ASN1_FUNCTIONS(X509_EXTENSION) + +X509_EXTENSION * +d2i_X509_EXTENSION(X509_EXTENSION **a, const unsigned char **in, long len) +{ + return (X509_EXTENSION *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_EXTENSION_it); +} + +int +i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_EXTENSION_it); +} + +X509_EXTENSION * +X509_EXTENSION_new(void) +{ + return (X509_EXTENSION *)ASN1_item_new(&X509_EXTENSION_it); +} + +void +X509_EXTENSION_free(X509_EXTENSION *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_EXTENSION_it); +} IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) IMPLEMENT_ASN1_DUP_FUNCTION(X509_EXTENSION) diff --git a/lib/libcrypto/asn1/x_name.c b/lib/libcrypto/asn1/x_name.c index 7c77ceea3bb..a7f0e14d130 100644 --- a/lib/libcrypto/asn1/x_name.c +++ b/lib/libcrypto/asn1/x_name.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_name.c,v 1.20 2014/07/12 11:25:25 miod Exp $ */ +/* $OpenBSD: x_name.c,v 1.21 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -92,7 +92,31 @@ ASN1_SEQUENCE(X509_NAME_ENTRY) = { ASN1_SIMPLE(X509_NAME_ENTRY, value, ASN1_PRINTABLE) } ASN1_SEQUENCE_END(X509_NAME_ENTRY) -IMPLEMENT_ASN1_FUNCTIONS(X509_NAME_ENTRY) + +X509_NAME_ENTRY * +d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, const unsigned char **in, long len) +{ + return (X509_NAME_ENTRY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_NAME_ENTRY_it); +} + +int +i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_NAME_ENTRY_it); +} + +X509_NAME_ENTRY * +X509_NAME_ENTRY_new(void) +{ + return (X509_NAME_ENTRY *)ASN1_item_new(&X509_NAME_ENTRY_it); +} + +void +X509_NAME_ENTRY_free(X509_NAME_ENTRY *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_NAME_ENTRY_it); +} IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME_ENTRY) /* For the "Name" type we need a SEQUENCE OF { SET OF X509_NAME_ENTRY } @@ -125,7 +149,31 @@ const ASN1_EXTERN_FUNCS x509_name_ff = { IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff) -IMPLEMENT_ASN1_FUNCTIONS(X509_NAME) + +X509_NAME * +d2i_X509_NAME(X509_NAME **a, const unsigned char **in, long len) +{ + return (X509_NAME *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_NAME_it); +} + +int +i2d_X509_NAME(X509_NAME *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_NAME_it); +} + +X509_NAME * +X509_NAME_new(void) +{ + return (X509_NAME *)ASN1_item_new(&X509_NAME_it); +} + +void +X509_NAME_free(X509_NAME *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_NAME_it); +} IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME) static int diff --git a/lib/libcrypto/asn1/x_nx509.c b/lib/libcrypto/asn1/x_nx509.c index eebeb9206f7..9738560c196 100644 --- a/lib/libcrypto/asn1/x_nx509.c +++ b/lib/libcrypto/asn1/x_nx509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_nx509.c,v 1.3 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: x_nx509.c,v 1.4 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2005. */ @@ -68,4 +68,28 @@ ASN1_SEQUENCE(NETSCAPE_X509) = { ASN1_OPT(NETSCAPE_X509, cert, X509) } ASN1_SEQUENCE_END(NETSCAPE_X509) -IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_X509) + +NETSCAPE_X509 * +d2i_NETSCAPE_X509(NETSCAPE_X509 **a, const unsigned char **in, long len) +{ + return (NETSCAPE_X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &NETSCAPE_X509_it); +} + +int +i2d_NETSCAPE_X509(NETSCAPE_X509 *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_X509_it); +} + +NETSCAPE_X509 * +NETSCAPE_X509_new(void) +{ + return (NETSCAPE_X509 *)ASN1_item_new(&NETSCAPE_X509_it); +} + +void +NETSCAPE_X509_free(NETSCAPE_X509 *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_X509_it); +} diff --git a/lib/libcrypto/asn1/x_pubkey.c b/lib/libcrypto/asn1/x_pubkey.c index 56cc63059a7..0c7d01e60dd 100644 --- a/lib/libcrypto/asn1/x_pubkey.c +++ b/lib/libcrypto/asn1/x_pubkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_pubkey.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */ +/* $OpenBSD: x_pubkey.c,v 1.23 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -89,7 +89,31 @@ ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = { ASN1_SIMPLE(X509_PUBKEY, public_key, ASN1_BIT_STRING) } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) -IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) + +X509_PUBKEY * +d2i_X509_PUBKEY(X509_PUBKEY **a, const unsigned char **in, long len) +{ + return (X509_PUBKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_PUBKEY_it); +} + +int +i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_PUBKEY_it); +} + +X509_PUBKEY * +X509_PUBKEY_new(void) +{ + return (X509_PUBKEY *)ASN1_item_new(&X509_PUBKEY_it); +} + +void +X509_PUBKEY_free(X509_PUBKEY *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_PUBKEY_it); +} int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) diff --git a/lib/libcrypto/asn1/x_req.c b/lib/libcrypto/asn1/x_req.c index c876edd7f00..89b2d88d156 100644 --- a/lib/libcrypto/asn1/x_req.c +++ b/lib/libcrypto/asn1/x_req.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_req.c,v 1.10 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_req.c,v 1.11 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -102,7 +102,31 @@ ASN1_SEQUENCE_enc(X509_REQ_INFO, enc, rinf_cb) = { ASN1_IMP_SET_OF_OPT(X509_REQ_INFO, attributes, X509_ATTRIBUTE, 0) } ASN1_SEQUENCE_END_enc(X509_REQ_INFO, X509_REQ_INFO) -IMPLEMENT_ASN1_FUNCTIONS(X509_REQ_INFO) + +X509_REQ_INFO * +d2i_X509_REQ_INFO(X509_REQ_INFO **a, const unsigned char **in, long len) +{ + return (X509_REQ_INFO *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_REQ_INFO_it); +} + +int +i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_REQ_INFO_it); +} + +X509_REQ_INFO * +X509_REQ_INFO_new(void) +{ + return (X509_REQ_INFO *)ASN1_item_new(&X509_REQ_INFO_it); +} + +void +X509_REQ_INFO_free(X509_REQ_INFO *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_REQ_INFO_it); +} ASN1_SEQUENCE_ref(X509_REQ, 0, CRYPTO_LOCK_X509_REQ) = { ASN1_SIMPLE(X509_REQ, req_info, X509_REQ_INFO), @@ -110,5 +134,29 @@ ASN1_SEQUENCE_ref(X509_REQ, 0, CRYPTO_LOCK_X509_REQ) = { ASN1_SIMPLE(X509_REQ, signature, ASN1_BIT_STRING) } ASN1_SEQUENCE_END_ref(X509_REQ, X509_REQ) -IMPLEMENT_ASN1_FUNCTIONS(X509_REQ) + +X509_REQ * +d2i_X509_REQ(X509_REQ **a, const unsigned char **in, long len) +{ + return (X509_REQ *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_REQ_it); +} + +int +i2d_X509_REQ(X509_REQ *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_REQ_it); +} + +X509_REQ * +X509_REQ_new(void) +{ + return (X509_REQ *)ASN1_item_new(&X509_REQ_it); +} + +void +X509_REQ_free(X509_REQ *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_REQ_it); +} IMPLEMENT_ASN1_DUP_FUNCTION(X509_REQ) diff --git a/lib/libcrypto/asn1/x_sig.c b/lib/libcrypto/asn1/x_sig.c index ab4546e3ca3..7c4c8c9c55d 100644 --- a/lib/libcrypto/asn1/x_sig.c +++ b/lib/libcrypto/asn1/x_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_sig.c,v 1.8 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_sig.c,v 1.9 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -66,4 +66,28 @@ ASN1_SEQUENCE(X509_SIG) = { ASN1_SIMPLE(X509_SIG, digest, ASN1_OCTET_STRING) } ASN1_SEQUENCE_END(X509_SIG) -IMPLEMENT_ASN1_FUNCTIONS(X509_SIG) + +X509_SIG * +d2i_X509_SIG(X509_SIG **a, const unsigned char **in, long len) +{ + return (X509_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_SIG_it); +} + +int +i2d_X509_SIG(X509_SIG *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_SIG_it); +} + +X509_SIG * +X509_SIG_new(void) +{ + return (X509_SIG *)ASN1_item_new(&X509_SIG_it); +} + +void +X509_SIG_free(X509_SIG *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_SIG_it); +} diff --git a/lib/libcrypto/asn1/x_spki.c b/lib/libcrypto/asn1/x_spki.c index 836abb13d8f..fc056ff53b3 100644 --- a/lib/libcrypto/asn1/x_spki.c +++ b/lib/libcrypto/asn1/x_spki.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_spki.c,v 1.8 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_spki.c,v 1.9 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -70,7 +70,31 @@ ASN1_SEQUENCE(NETSCAPE_SPKAC) = { ASN1_SIMPLE(NETSCAPE_SPKAC, challenge, ASN1_IA5STRING) } ASN1_SEQUENCE_END(NETSCAPE_SPKAC) -IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_SPKAC) + +NETSCAPE_SPKAC * +d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, const unsigned char **in, long len) +{ + return (NETSCAPE_SPKAC *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &NETSCAPE_SPKAC_it); +} + +int +i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_SPKAC_it); +} + +NETSCAPE_SPKAC * +NETSCAPE_SPKAC_new(void) +{ + return (NETSCAPE_SPKAC *)ASN1_item_new(&NETSCAPE_SPKAC_it); +} + +void +NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_SPKAC_it); +} ASN1_SEQUENCE(NETSCAPE_SPKI) = { ASN1_SIMPLE(NETSCAPE_SPKI, spkac, NETSCAPE_SPKAC), @@ -78,4 +102,28 @@ ASN1_SEQUENCE(NETSCAPE_SPKI) = { ASN1_SIMPLE(NETSCAPE_SPKI, signature, ASN1_BIT_STRING) } ASN1_SEQUENCE_END(NETSCAPE_SPKI) -IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_SPKI) + +NETSCAPE_SPKI * +d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len) +{ + return (NETSCAPE_SPKI *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &NETSCAPE_SPKI_it); +} + +int +i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &NETSCAPE_SPKI_it); +} + +NETSCAPE_SPKI * +NETSCAPE_SPKI_new(void) +{ + return (NETSCAPE_SPKI *)ASN1_item_new(&NETSCAPE_SPKI_it); +} + +void +NETSCAPE_SPKI_free(NETSCAPE_SPKI *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &NETSCAPE_SPKI_it); +} diff --git a/lib/libcrypto/asn1/x_val.c b/lib/libcrypto/asn1/x_val.c index da9d16346bc..27835e94dac 100644 --- a/lib/libcrypto/asn1/x_val.c +++ b/lib/libcrypto/asn1/x_val.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_val.c,v 1.8 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_val.c,v 1.9 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -66,4 +66,28 @@ ASN1_SEQUENCE(X509_VAL) = { ASN1_SIMPLE(X509_VAL, notAfter, ASN1_TIME) } ASN1_SEQUENCE_END(X509_VAL) -IMPLEMENT_ASN1_FUNCTIONS(X509_VAL) + +X509_VAL * +d2i_X509_VAL(X509_VAL **a, const unsigned char **in, long len) +{ + return (X509_VAL *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_VAL_it); +} + +int +i2d_X509_VAL(X509_VAL *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_VAL_it); +} + +X509_VAL * +X509_VAL_new(void) +{ + return (X509_VAL *)ASN1_item_new(&X509_VAL_it); +} + +void +X509_VAL_free(X509_VAL *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_VAL_it); +} diff --git a/lib/libcrypto/asn1/x_x509.c b/lib/libcrypto/asn1/x_x509.c index 0236a0faa27..8fd2d7684b3 100644 --- a/lib/libcrypto/asn1/x_x509.c +++ b/lib/libcrypto/asn1/x_x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_x509.c,v 1.17 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_x509.c,v 1.18 2015/02/09 15:05:59 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -78,7 +78,31 @@ ASN1_SEQUENCE_enc(X509_CINF, enc, 0) = { ASN1_EXP_SEQUENCE_OF_OPT(X509_CINF, extensions, X509_EXTENSION, 3) } ASN1_SEQUENCE_END_enc(X509_CINF, X509_CINF) -IMPLEMENT_ASN1_FUNCTIONS(X509_CINF) + +X509_CINF * +d2i_X509_CINF(X509_CINF **a, const unsigned char **in, long len) +{ + return (X509_CINF *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_CINF_it); +} + +int +i2d_X509_CINF(X509_CINF *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CINF_it); +} + +X509_CINF * +X509_CINF_new(void) +{ + return (X509_CINF *)ASN1_item_new(&X509_CINF_it); +} + +void +X509_CINF_free(X509_CINF *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_CINF_it); +} /* X509 top level structure needs a bit of customisation */ extern void policy_cache_free(X509_POLICY_CACHE *cache); @@ -138,7 +162,31 @@ ASN1_SEQUENCE_ref(X509, x509_cb, CRYPTO_LOCK_X509) = { ASN1_SIMPLE(X509, signature, ASN1_BIT_STRING) } ASN1_SEQUENCE_END_ref(X509, X509) -IMPLEMENT_ASN1_FUNCTIONS(X509) + +X509 * +d2i_X509(X509 **a, const unsigned char **in, long len) +{ + return (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_it); +} + +int +i2d_X509(X509 *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_it); +} + +X509 * +X509_new(void) +{ + return (X509 *)ASN1_item_new(&X509_it); +} + +void +X509_free(X509 *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_it); +} IMPLEMENT_ASN1_DUP_FUNCTION(X509) int diff --git a/lib/libcrypto/asn1/x_x509a.c b/lib/libcrypto/asn1/x_x509a.c index c6837069d94..8a3561e8825 100644 --- a/lib/libcrypto/asn1/x_x509a.c +++ b/lib/libcrypto/asn1/x_x509a.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_x509a.c,v 1.10 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_x509a.c,v 1.11 2015/02/09 15:05:59 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -79,7 +79,31 @@ ASN1_SEQUENCE(X509_CERT_AUX) = { ASN1_IMP_SEQUENCE_OF_OPT(X509_CERT_AUX, other, X509_ALGOR, 1) } ASN1_SEQUENCE_END(X509_CERT_AUX) -IMPLEMENT_ASN1_FUNCTIONS(X509_CERT_AUX) + +X509_CERT_AUX * +d2i_X509_CERT_AUX(X509_CERT_AUX **a, const unsigned char **in, long len) +{ + return (X509_CERT_AUX *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_CERT_AUX_it); +} + +int +i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CERT_AUX_it); +} + +X509_CERT_AUX * +X509_CERT_AUX_new(void) +{ + return (X509_CERT_AUX *)ASN1_item_new(&X509_CERT_AUX_it); +} + +void +X509_CERT_AUX_free(X509_CERT_AUX *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_CERT_AUX_it); +} static X509_CERT_AUX * aux_get(X509 *x) @@ -198,4 +222,28 @@ ASN1_SEQUENCE(X509_CERT_PAIR) = { ASN1_EXP_OPT(X509_CERT_PAIR, reverse, X509, 1) } ASN1_SEQUENCE_END(X509_CERT_PAIR) -IMPLEMENT_ASN1_FUNCTIONS(X509_CERT_PAIR) + +X509_CERT_PAIR * +d2i_X509_CERT_PAIR(X509_CERT_PAIR **a, const unsigned char **in, long len) +{ + return (X509_CERT_PAIR *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, + &X509_CERT_PAIR_it); +} + +int +i2d_X509_CERT_PAIR(X509_CERT_PAIR *a, unsigned char **out) +{ + return ASN1_item_i2d((ASN1_VALUE *)a, out, &X509_CERT_PAIR_it); +} + +X509_CERT_PAIR * +X509_CERT_PAIR_new(void) +{ + return (X509_CERT_PAIR *)ASN1_item_new(&X509_CERT_PAIR_it); +} + +void +X509_CERT_PAIR_free(X509_CERT_PAIR *a) +{ + ASN1_item_free((ASN1_VALUE *)a, &X509_CERT_PAIR_it); +} |