[openssl] master update

beldmit at gmail.com beldmit at gmail.com
Fri Jan 24 12:18:00 UTC 2020


The branch master has been updated
       via  d80bf693faaa8ad08ca76f52228837306d77bb32 (commit)
       via  408113c05087393cc1623a51a0e5bfe8483e302d (commit)
      from  dc8de3e6f1eed18617dc42d41dec6c6566c2ac0c (commit)


- Log -----------------------------------------------------------------
commit d80bf693faaa8ad08ca76f52228837306d77bb32
Author: Dmitry Belyavskiy <beldmit at gmail.com>
Date:   Mon Jan 20 16:02:26 2020 +0300

    New functions for PKCS8 attributes management - documentation
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/10900)

commit 408113c05087393cc1623a51a0e5bfe8483e302d
Author: Dmitry Belyavskiy <beldmit at gmail.com>
Date:   Mon Jan 20 16:01:02 2020 +0300

    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 <tmraz at fedoraproject.org>
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/10900)

-----------------------------------------------------------------------

Summary of changes:
 crypto/asn1/p8_pkey.c             | 11 ++++++++
 doc/man3/PKCS8_pkey_add1_attr.pod | 54 +++++++++++++++++++++++++++++++++++++++
 include/openssl/x509.h            |  4 +++
 util/libcrypto.num                |  2 ++
 util/missingcrypto.txt            |  2 --
 5 files changed, 71 insertions(+), 2 deletions(-)
 create mode 100644 doc/man3/PKCS8_pkey_add1_attr.pod

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);
+}
diff --git a/doc/man3/PKCS8_pkey_add1_attr.pod b/doc/man3/PKCS8_pkey_add1_attr.pod
new file mode 100644
index 0000000000..340b56aafe
--- /dev/null
+++ b/doc/man3/PKCS8_pkey_add1_attr.pod
@@ -0,0 +1,54 @@
+=pod
+
+=head1 NAME
+
+PKCS8_pkey_get0_attrs, PKCS8_pkey_add1_attr, PKCS8_pkey_add1_attr_by_NID, PKCS8_pkey_add1_attr_by_OBJ - PKCS8 attribute functions
+
+=head1 SYNOPSIS
+
+ #include <openssl/x509.h>
+
+ const STACK_OF(X509_ATTRIBUTE) *
+ PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);
+ int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);
+ int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,
+                                 const unsigned char *bytes, int len);
+ int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,
+                                int type, const unsigned char *bytes, int len);
+
+=head1 DESCRIPTION
+
+PKCS8_pkey_get0_attrs() returns a const STACK of X509_ATTRIBUTE present in
+the passed const PKCS8_PRIV_KEY_INFO structure B<p8>.
+
+PKCS8_pkey_add1_attr() adds a constructed X509_ATTRIBUTE B<attr> to the
+existing PKCS8_PRIV_KEY_INFO structure B<p8>.
+
+PKCS8_pkey_add1_attr_by_NID() and PKCS8_pkey_add1_attr_by_OBJ() construct a new
+X509_ATTRIBUTE from the passed arguments and add it to the existing
+PKCS8_PRIV_KEY_INFO structure B<p8>.
+
+=head1 RETURN VALUES
+
+PKCS8_pkey_add1_attr(), PKCS8_pkey_add1_attr_by_NID(), and
+PKCS8_pkey_add1_attr_by_OBJ() return 1 for success and 0 for failure.
+
+=head1 NOTES
+
+STACK of X509_ATTRIBUTE is present in many X509-related structures and some of
+them have the corresponding set of similar functions.
+
+=head1 SEE ALSO
+
+L<crypto(7)>
+
+=head1 COPYRIGHT
+
+Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
+
+Licensed under the Apache License 2.0 (the "License").  You may not use
+this file except in compliance with the License.  You can obtain a copy
+in the file LICENSE in the source distribution or at
+L<https://www.openssl.org/source/license.html>.
+
+=cut
diff --git a/include/openssl/x509.h b/include/openssl/x509.h
index 9d8cc03c53..4cd17d24f5 100644
--- a/include/openssl/x509.h
+++ b/include/openssl/x509.h
@@ -1034,8 +1034,12 @@ int PKCS8_pkey_get0(const ASN1_OBJECT **ppkalg,
 
 const STACK_OF(X509_ATTRIBUTE) *
 PKCS8_pkey_get0_attrs(const PKCS8_PRIV_KEY_INFO *p8);
+int PKCS8_pkey_add1_attr(PKCS8_PRIV_KEY_INFO *p8, X509_ATTRIBUTE *attr);
 int PKCS8_pkey_add1_attr_by_NID(PKCS8_PRIV_KEY_INFO *p8, int nid, int type,
                                 const unsigned char *bytes, int len);
+int PKCS8_pkey_add1_attr_by_OBJ(PKCS8_PRIV_KEY_INFO *p8, const ASN1_OBJECT *obj,
+                                int type, const unsigned char *bytes, int len);
+
 
 int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
                            int ptype, void *pval,
diff --git a/util/libcrypto.num b/util/libcrypto.num
index d0443c2f77..439a7a11c7 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -4913,3 +4913,5 @@ ASN1_GENERALIZEDTIME_dup                ?	3_0_0	EXIST::FUNCTION:
 RAND_priv_bytes_ex                      ?	3_0_0	EXIST::FUNCTION:
 RAND_bytes_ex                           ?	3_0_0	EXIST::FUNCTION:
 EVP_PKEY_get_default_digest_name        ?	3_0_0	EXIST::FUNCTION:
+PKCS8_pkey_add1_attr                    ?	3_0_0	EXIST::FUNCTION:
+PKCS8_pkey_add1_attr_by_OBJ             ?	3_0_0	EXIST::FUNCTION:
diff --git a/util/missingcrypto.txt b/util/missingcrypto.txt
index 4f610c5815..05a8bbf18e 100644
--- a/util/missingcrypto.txt
+++ b/util/missingcrypto.txt
@@ -876,9 +876,7 @@ PKCS8_add_keyusage(3)
 PKCS8_decrypt(3)
 PKCS8_encrypt(3)
 PKCS8_get_attr(3)
-PKCS8_pkey_add1_attr_by_NID(3)
 PKCS8_pkey_get0(3)
-PKCS8_pkey_get0_attrs(3)
 PKCS8_pkey_set0(3)
 PKCS8_set0_pbe(3)
 PKEY_USAGE_PERIOD_it(3)


More information about the openssl-commits mailing list