From 408113c05087393cc1623a51a0e5bfe8483e302d Mon Sep 17 00:00:00 2001 From: Dmitry Belyavskiy Date: Mon, 20 Jan 2020 16:01:02 +0300 Subject: New functions for PKCS8 attributes management This commit introduces functions PKCS8_pkey_add1_attr_by_OBJ and PKCS8_pkey_add1_attr Reviewed-by: Tomas Mraz Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/10900) --- crypto/asn1/p8_pkey.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crypto/asn1') diff --git a/crypto/asn1/p8_pkey.c b/crypto/asn1/p8_pkey.c index c55353ae11..77e64a9ac1 100644 --- a/crypto/asn1/p8_pkey.c +++ b/crypto/asn1/p8_pkey.c @@ -78,3 +78,14 @@ int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type, return 1; return 0; } + +int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj, int type, + const unsigned char *bytes, int len) +{ + return (X509at_add1_attr_by_OBJ(&p8->attributes, obj, type, bytes, len) != NULL); +} + +int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr) +{ + return (X509at_add1_attr(&p8->attributes, attr) != NULL); +} -- cgit v1.2.3