From 54c38b7f0dda668be82199b4e4aa56c1f6afe3ea Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 26 Sep 2015 12:26:51 +0100 Subject: [PATCH] Make PKCS12 structures opaque Reviewed-by: Rich Salz --- crypto/pkcs12/p12_add.c | 1 + crypto/pkcs12/p12_asn.c | 1 + crypto/pkcs12/p12_attr.c | 1 + crypto/pkcs12/p12_crt.c | 1 + crypto/pkcs12/p12_init.c | 1 + include/openssl/pkcs12.h | 39 ++++++--------------------------------- 6 files changed, 11 insertions(+), 33 deletions(-) diff --git a/crypto/pkcs12/p12_add.c b/crypto/pkcs12/p12_add.c index 4f2070e941..85f9faf3a4 100644 --- a/crypto/pkcs12/p12_add.c +++ b/crypto/pkcs12/p12_add.c @@ -59,6 +59,7 @@ #include #include "internal/cryptlib.h" #include +#include "p12_lcl.h" /* Pack an object into an OCTET STRING and turn into a safebag */ diff --git a/crypto/pkcs12/p12_asn.c b/crypto/pkcs12/p12_asn.c index 5a432613bf..2f9481ec72 100644 --- a/crypto/pkcs12/p12_asn.c +++ b/crypto/pkcs12/p12_asn.c @@ -60,6 +60,7 @@ #include "internal/cryptlib.h" #include #include +#include "p12_lcl.h" /* PKCS#12 ASN1 module */ diff --git a/crypto/pkcs12/p12_attr.c b/crypto/pkcs12/p12_attr.c index 792e3811ff..5746a7b502 100644 --- a/crypto/pkcs12/p12_attr.c +++ b/crypto/pkcs12/p12_attr.c @@ -59,6 +59,7 @@ #include #include "internal/cryptlib.h" #include +#include "p12_lcl.h" /* Add a local keyid to a safebag */ diff --git a/crypto/pkcs12/p12_crt.c b/crypto/pkcs12/p12_crt.c index ae52d9ec4b..c4632a9b95 100644 --- a/crypto/pkcs12/p12_crt.c +++ b/crypto/pkcs12/p12_crt.c @@ -59,6 +59,7 @@ #include #include "internal/cryptlib.h" #include +#include "p12_lcl.h" static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags, PKCS12_SAFEBAG *bag); diff --git a/crypto/pkcs12/p12_init.c b/crypto/pkcs12/p12_init.c index 3597e13204..9c82969b38 100644 --- a/crypto/pkcs12/p12_init.c +++ b/crypto/pkcs12/p12_init.c @@ -59,6 +59,7 @@ #include #include "internal/cryptlib.h" #include +#include "p12_lcl.h" /* Initialise a PKCS12 structure to take data */ diff --git a/include/openssl/pkcs12.h b/include/openssl/pkcs12.h index b164a00d5b..24425d3293 100644 --- a/include/openssl/pkcs12.h +++ b/include/openssl/pkcs12.h @@ -98,42 +98,15 @@ extern "C" { # define KEY_EX 0x10 # define KEY_SIG 0x80 -typedef struct { - X509_SIG *dinfo; - ASN1_OCTET_STRING *salt; - ASN1_INTEGER *iter; /* defaults to 1 */ -} PKCS12_MAC_DATA; - -typedef struct { - ASN1_INTEGER *version; - PKCS12_MAC_DATA *mac; - PKCS7 *authsafes; -} PKCS12; - -typedef struct { - ASN1_OBJECT *type; - union { - struct pkcs12_bag_st *bag; /* secret, crl and certbag */ - struct pkcs8_priv_key_info_st *keybag; /* keybag */ - X509_SIG *shkeybag; /* shrouded key bag */ - STACK_OF(PKCS12_SAFEBAG) *safes; - ASN1_TYPE *other; - } value; - STACK_OF(X509_ATTRIBUTE) *attrib; -} PKCS12_SAFEBAG; +typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA; + +typedef struct PKCS12_st PKCS12; + +typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG; DEFINE_STACK_OF(PKCS12_SAFEBAG) -typedef struct pkcs12_bag_st { - ASN1_OBJECT *type; - union { - ASN1_OCTET_STRING *x509cert; - ASN1_OCTET_STRING *x509crl; - ASN1_OCTET_STRING *octet; - ASN1_IA5STRING *sdsicert; - ASN1_TYPE *other; /* Secret or other bag */ - } value; -} PKCS12_BAGS; +typedef struct pkcs12_bag_st PKCS12_BAGS; # define PKCS12_ERROR 0 # define PKCS12_OK 1 -- 2.25.1