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_pubkey.c | 40 ++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'src/lib/libcrypto/asn1/x_pubkey.c') diff --git a/src/lib/libcrypto/asn1/x_pubkey.c b/src/lib/libcrypto/asn1/x_pubkey.c index 0c7d01e60d..55084182cc 100644 --- a/src/lib/libcrypto/asn1/x_pubkey.c +++ b/src/lib/libcrypto/asn1/x_pubkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_pubkey.c,v 1.23 2015/02/09 15:05:59 jsing Exp $ */ +/* $OpenBSD: x_pubkey.c,v 1.24 2015/02/11 03:39:51 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -84,10 +84,40 @@ pubkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) return 1; } -ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = { - ASN1_SIMPLE(X509_PUBKEY, algor, X509_ALGOR), - ASN1_SIMPLE(X509_PUBKEY, public_key, ASN1_BIT_STRING) -} ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) +static const ASN1_AUX X509_PUBKEY_aux = { + .app_data = NULL, + .flags = 0, + .ref_offset = 0, + .ref_lock = 0, + .asn1_cb = pubkey_cb, + .enc_offset = 0, +}; +static const ASN1_TEMPLATE X509_PUBKEY_seq_tt[] = { + { + .flags = 0, + .tag = 0, + .offset = offsetof(X509_PUBKEY, algor), + .field_name = "algor", + .item = &X509_ALGOR_it, + }, + { + .flags = 0, + .tag = 0, + .offset = offsetof(X509_PUBKEY, public_key), + .field_name = "public_key", + .item = &ASN1_BIT_STRING_it, + }, +}; + +const ASN1_ITEM X509_PUBKEY_it = { + .itype = ASN1_ITYPE_SEQUENCE, + .utype = V_ASN1_SEQUENCE, + .templates = X509_PUBKEY_seq_tt, + .tcount = sizeof(X509_PUBKEY_seq_tt) / sizeof(ASN1_TEMPLATE), + .funcs = &X509_PUBKEY_aux, + .size = sizeof(X509_PUBKEY), + .sname = "X509_PUBKEY", +}; X509_PUBKEY * -- cgit v1.2.3-55-g6feb