From a4446bfb10ec0a821da3861d90dc625a93d84cff Mon Sep 17 00:00:00 2001 From: jsing <> Date: Wed, 11 Feb 2015 03:39:51 +0000 Subject: Expand most of the ASN1_SEQUENCE* and associated macros, making the data structures visible and easier to review, without having to wade through layers and layers of asn1t.h macros. Change has been scripted and the generated assembly only differs by changes to line numbers. Discussed with beck@ miod@ tedu@ --- src/lib/libcrypto/asn1/x_nx509.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/lib/libcrypto/asn1/x_nx509.c') diff --git a/src/lib/libcrypto/asn1/x_nx509.c b/src/lib/libcrypto/asn1/x_nx509.c index 9738560c19..f36f1d9eca 100644 --- a/src/lib/libcrypto/asn1/x_nx509.c +++ b/src/lib/libcrypto/asn1/x_nx509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_nx509.c,v 1.4 2015/02/09 15:05:59 jsing Exp $ */ +/* $OpenBSD: x_nx509.c,v 1.5 2015/02/11 03:39:51 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2005. */ @@ -63,10 +63,32 @@ /* Old netscape certificate wrapper format */ -ASN1_SEQUENCE(NETSCAPE_X509) = { - ASN1_SIMPLE(NETSCAPE_X509, header, ASN1_OCTET_STRING), - ASN1_OPT(NETSCAPE_X509, cert, X509) -} ASN1_SEQUENCE_END(NETSCAPE_X509) +static const ASN1_TEMPLATE NETSCAPE_X509_seq_tt[] = { + { + .flags = 0, + .tag = 0, + .offset = offsetof(NETSCAPE_X509, header), + .field_name = "header", + .item = &ASN1_OCTET_STRING_it, + }, + { + .flags = ASN1_TFLG_OPTIONAL, + .tag = 0, + .offset = offsetof(NETSCAPE_X509, cert), + .field_name = "cert", + .item = &X509_it, + }, +}; + +const ASN1_ITEM NETSCAPE_X509_it = { + .itype = ASN1_ITYPE_SEQUENCE, + .utype = V_ASN1_SEQUENCE, + .templates = NETSCAPE_X509_seq_tt, + .tcount = sizeof(NETSCAPE_X509_seq_tt) / sizeof(ASN1_TEMPLATE), + .funcs = NULL, + .size = sizeof(NETSCAPE_X509), + .sname = "NETSCAPE_X509", +}; NETSCAPE_X509 * -- cgit v1.2.3-55-g6feb