From: Matt Caswell Date: Sat, 13 Aug 2016 12:40:05 +0000 (+0100) Subject: Convert PKCS8* functions to use const getters X-Git-Tag: OpenSSL_1_1_0~169 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b2e57e094db5f516cffa6f2749615a7287a7681d;p=oweals%2Fopenssl.git Convert PKCS8* functions to use const getters Reviewed-by: Viktor Dukhovni Reviewed-by: Stephen Henson --- diff --git a/apps/pkcs12.c b/apps/pkcs12.c index 315b72d3a8..5f2573497b 100644 --- a/apps/pkcs12.c +++ b/apps/pkcs12.c @@ -37,7 +37,7 @@ int dump_certs_pkeys_bags(BIO *out, STACK_OF(PKCS12_SAFEBAG) *bags, int dump_certs_pkeys_bag(BIO *out, PKCS12_SAFEBAG *bags, char *pass, int passlen, int options, char *pempass, const EVP_CIPHER *enc); -int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, +int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, const char *name); void hex_prin(BIO *out, unsigned char *buf, int len); static int alg_print(X509_ALGOR *alg); @@ -827,7 +827,7 @@ int cert_load(BIO *in, STACK_OF(X509) *sk) /* Generalised attribute print: handle PKCS#8 and bag attributes */ -int print_attribs(BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, +int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, const char *name) { X509_ATTRIBUTE *attr; diff --git a/crypto/asn1/p8_pkey.c b/crypto/asn1/p8_pkey.c index c08aa85267..b8cc0b1407 100644 --- a/crypto/asn1/p8_pkey.c +++ b/crypto/asn1/p8_pkey.c @@ -65,7 +65,8 @@ int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg, return 1; } -STACK_OF(X509_ATTRIBUTE) *PKCS8_pkey_get0_attrs(PKCS8_PRIV_KEY_INFO *p8) +const STACK_OF(X509_ATTRIBUTE) * +PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8) { return p8->attributes; } diff --git a/crypto/pkcs12/p12_attr.c b/crypto/pkcs12/p12_attr.c index bf44c0aa23..58935c154f 100644 --- a/crypto/pkcs12/p12_attr.c +++ b/crypto/pkcs12/p12_attr.c @@ -64,7 +64,8 @@ int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, int namelen) return 0; } -ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid) +ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, + int attr_nid) { X509_ATTRIBUTE *attrib; int i; diff --git a/include/openssl/pkcs12.h b/include/openssl/pkcs12.h index 4711dfa11e..775f20a4ee 100644 --- a/include/openssl/pkcs12.h +++ b/include/openssl/pkcs12.h @@ -141,7 +141,8 @@ int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name, int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name, int namelen); int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage); -ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid); +ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs, + int attr_nid); char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag); STACK_OF(X509_ATTRIBUTE) *PKCS12_SAFEBAG_get0_attrs(PKCS12_SAFEBAG *bag); unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass, diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 5cb15b0d60..4ccf2eccd3 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -971,7 +971,8 @@ int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg, const unsigned char **pk, int *ppklen, X509_ALGOR **pa, PKCS8_PRIV_KEY_INFO *p8); -STACK_OF(X509_ATTRIBUTE) *PKCS8_pkey_get0_attrs(PKCS8_PRIV_KEY_INFO *p8); +const STACK_OF(X509_ATTRIBUTE) * +PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8); int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, const unsigned char *bytes, int len);