summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-09-15 15:54:19 +0100
committerDr. Stephen Henson <steve@openssl.org>2015-09-16 22:17:39 +0100
commitde17bd5d7f8286d8b1f0a04a3f8f5782033f5ebd (patch)
tree5fab90b0d760d271e1fe90cde99271f2407f96ed /include
parent05e97f1d4f940c765e5c93771fe20820acca4438 (diff)
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')
-rw-r--r--include/openssl/asn1.h2
-rw-r--r--include/openssl/asn1t.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/include/openssl/asn1.h b/include/openssl/asn1.h
index 5b3b7d3bbb..3a67d61f7b 100644
--- a/include/openssl/asn1.h
+++ b/include/openssl/asn1.h
@@ -943,7 +943,7 @@ void ERR_load_ASN1_strings(void);
# define ASN1_F_ASN1_ITEM_D2I_FP 206
# define ASN1_F_ASN1_ITEM_DUP 191
# define ASN1_F_ASN1_ITEM_EX_D2I 120
-# define ASN1_F_ASN1_ITEM_EX_NEW 121
+# define ASN1_F_ASN1_ITEM_EMBED_NEW 121
# define ASN1_F_ASN1_ITEM_I2D_BIO 192
# define ASN1_F_ASN1_ITEM_I2D_FP 193
# define ASN1_F_ASN1_ITEM_PACK 198
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 {