From 0934cf4834059cf2d6e3b7e4106d5e04f50ed7f5 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 20 Oct 2020 18:11:30 +0200 Subject: Unexport internal MSBLOB and PVK functions The following internal functions are affected: ossl_do_blob_header ossl_do_PVK_header ossl_b2i ossl_b2i_bio This is reflected by moving include/internal/pem.h to include/crypto/pem.h engines/e_loader_attic gets the source code added to it to have continued access to those functions. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/13195) --- crypto/pem/pvkfmt.c | 2 +- engines/build.info | 2 +- engines/e_loader_attic.c | 2 +- include/crypto/pem.h | 31 ++++++++++++++++++++++ include/internal/pem.h | 31 ---------------------- .../implementations/encode_decode/decode_ms2key.c | 2 +- providers/implementations/storemgmt/file_store.c | 2 +- test/endecode_test.c | 2 +- util/libcrypto.num | 4 --- 9 files changed, 37 insertions(+), 41 deletions(-) create mode 100644 include/crypto/pem.h delete mode 100644 include/internal/pem.h diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index 95d1ff5a94..bd1d99e338 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -20,7 +20,7 @@ #include "internal/cryptlib.h" #include -#include "internal/pem.h" +#include "crypto/pem.h" #include #include #if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) diff --git a/engines/build.info b/engines/build.info index 4e83dbf9bc..e47f2d44a5 100644 --- a/engines/build.info +++ b/engines/build.info @@ -87,7 +87,7 @@ IF[{- !$disabled{"engine"} -}] GENERATE[ossltest.ld]=../util/engines.num ENDIF - SOURCE[loader_attic]=e_loader_attic.c + SOURCE[loader_attic]=e_loader_attic.c ../crypto/pem/pvkfmt.c DEPEND[loader_attic]=../libcrypto INCLUDE[loader_attic]=../include IF[{- defined $target{shared_defflag} -}] diff --git a/engines/e_loader_attic.c b/engines/e_loader_attic.c index 72ceb38a33..4f238b9cb2 100644 --- a/engines/e_loader_attic.c +++ b/engines/e_loader_attic.c @@ -31,9 +31,9 @@ #include #include /* For the PKCS8 stuff o.O */ #include "internal/asn1.h" /* For asn1_d2i_read_bio */ -#include "internal/pem.h" /* For PVK and "blob" PEM headers */ #include "internal/o_dir.h" #include "internal/cryptlib.h" +#include "crypto/pem.h" /* For PVK and "blob" PEM headers */ #include "e_loader_attic_err.c" diff --git a/include/crypto/pem.h b/include/crypto/pem.h new file mode 100644 index 0000000000..b6a10241f3 --- /dev/null +++ b/include/crypto/pem.h @@ -0,0 +1,31 @@ +/* + * Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (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 + * https://www.openssl.org/source/license.html + */ + +#ifndef OSSL_INTERNAL_PEM_H +# define OSSL_INTERNAL_PEM_H + +# include + +# ifndef OPENSSL_NO_DSA +/* Found in crypto/pem/pvkfmt.c */ +int ossl_do_blob_header(const unsigned char **in, unsigned int length, + unsigned int *pmagic, unsigned int *pbitlen, + int *pisdss, int *pispub); +# ifndef OPENSSL_NO_RC4 +int ossl_do_PVK_header(const unsigned char **in, unsigned int length, + int skip_magic, + unsigned int *psaltlen, unsigned int *pkeylen); +# endif + +EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub); +EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub); + +# endif + +#endif diff --git a/include/internal/pem.h b/include/internal/pem.h deleted file mode 100644 index b6a10241f3..0000000000 --- a/include/internal/pem.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (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 - * https://www.openssl.org/source/license.html - */ - -#ifndef OSSL_INTERNAL_PEM_H -# define OSSL_INTERNAL_PEM_H - -# include - -# ifndef OPENSSL_NO_DSA -/* Found in crypto/pem/pvkfmt.c */ -int ossl_do_blob_header(const unsigned char **in, unsigned int length, - unsigned int *pmagic, unsigned int *pbitlen, - int *pisdss, int *pispub); -# ifndef OPENSSL_NO_RC4 -int ossl_do_PVK_header(const unsigned char **in, unsigned int length, - int skip_magic, - unsigned int *psaltlen, unsigned int *pkeylen); -# endif - -EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub); -EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub); - -# endif - -#endif diff --git a/providers/implementations/encode_decode/decode_ms2key.c b/providers/implementations/encode_decode/decode_ms2key.c index 1bc55e5493..deb2cc2d5b 100644 --- a/providers/implementations/encode_decode/decode_ms2key.c +++ b/providers/implementations/encode_decode/decode_ms2key.c @@ -22,8 +22,8 @@ #include #include /* For public PVK functions */ #include -#include "internal/pem.h" /* For internal PVK and "blob" headers */ #include "internal/passphrase.h" +#include "crypto/pem.h" /* For internal PVK and "blob" headers */ #include "prov/bio.h" #include "prov/implementations.h" #include "endecoder_local.h" diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c index e41e29ed35..3b6c50c9e5 100644 --- a/providers/implementations/storemgmt/file_store.c +++ b/providers/implementations/storemgmt/file_store.c @@ -25,7 +25,7 @@ #include #include /* The OSSL_STORE_INFO type numbers */ #include "internal/o_dir.h" -#include "internal/pem.h" /* For PVK and "blob" PEM headers */ +#include "crypto/pem.h" /* For PVK and "blob" PEM headers */ #include "crypto/decoder.h" #include "prov/implementations.h" #include "prov/bio.h" diff --git a/test/endecode_test.c b/test/endecode_test.c index b882ff85b1..7a901e9793 100644 --- a/test/endecode_test.c +++ b/test/endecode_test.c @@ -19,8 +19,8 @@ #include #include -#include "internal/pem.h" /* For PVK and "blob" PEM headers */ #include "internal/cryptlib.h" /* ossl_assert */ +#include "crypto/pem.h" /* For PVK and "blob" PEM headers */ #include "testutil.h" diff --git a/util/libcrypto.num b/util/libcrypto.num index 4fa6d9e50e..0e8d3953c8 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -5235,12 +5235,8 @@ EVP_PKEY_CTX_set_mac_key ? 3_0_0 EXIST::FUNCTION: EVP_PKEY_new_CMAC_key_ex ? 3_0_0 EXIST::FUNCTION: OSSL_STORE_INFO_new ? 3_0_0 EXIST::FUNCTION: OSSL_STORE_INFO_get0_data ? 3_0_0 EXIST::FUNCTION: -ossl_do_blob_header ? 3_0_0 EXIST::FUNCTION:DSA -ossl_do_PVK_header ? 3_0_0 EXIST::FUNCTION:DSA,RC4 asn1_d2i_read_bio ? 3_0_0 EXIST::FUNCTION: EVP_PKCS82PKEY_ex ? 3_0_0 EXIST::FUNCTION: -ossl_b2i ? 3_0_0 EXIST::FUNCTION:DSA -ossl_b2i_bio ? 3_0_0 EXIST::FUNCTION:DSA EVP_PKEY_CTX_set1_id ? 3_0_0 EXIST::FUNCTION: EVP_PKEY_CTX_get1_id ? 3_0_0 EXIST::FUNCTION: EVP_PKEY_CTX_get1_id_len ? 3_0_0 EXIST::FUNCTION: -- cgit v1.2.3