diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-09-15 15:54:19 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-09-16 22:17:39 +0100 |
commit | de17bd5d7f8286d8b1f0a04a3f8f5782033f5ebd (patch) | |
tree | 5fab90b0d760d271e1fe90cde99271f2407f96ed /include/openssl/asn1t.h | |
parent | 05e97f1d4f940c765e5c93771fe20820acca4438 (diff) | |
download | openssl-de17bd5d7f8286d8b1f0a04a3f8f5782033f5ebd.tar.gz |
New ASN.1 embed macro.
New ASN.1 macro ASN1_EMBED. This is the same as ASN1_SIMPLE except the
structure is not allocated: it is part of the parent. That is instead of
FOO *x;
it must be:
FOO x;
This reduces memory fragmentation and make it impossible to accidentally
set a mandatory field to NULL.
This currently only works for SEQUENCE and since it is equivalent to
ASN1_SIMPLE it cannot be tagged, OPTIONAL, SET OF or SEQUENCE OF.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'include/openssl/asn1t.h')
-rw-r--r-- | include/openssl/asn1t.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/openssl/asn1t.h b/include/openssl/asn1t.h index 4a4e1ef255..68f62641ca 100644 --- a/include/openssl/asn1t.h +++ b/include/openssl/asn1t.h @@ -390,6 +390,8 @@ extern "C" { # endif /* Plain simple type */ # define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type) +/* Embedded simple type */ +# define ASN1_EMBED(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_EMBED,0, stname, field, type) /* OPTIONAL simple type */ # define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type) @@ -616,6 +618,9 @@ struct ASN1_ADB_TABLE_st { # define ASN1_TFLG_NDEF (0x1<<11) +/* Field is embedded and not a pointer */ +# define ASN1_TFLG_EMBED (0x1 << 12) + /* This is the actual ASN1 item itself */ struct ASN1_ITEM_st { |