From da9d70954b47ee3d07951f4b539bbe45790694da Mon Sep 17 00:00:00 2001 From: Nickolay Olshevsky Date: Thu, 28 Nov 2024 16:00:08 +0200 Subject: [PATCH] Merge bn.h and ossl_common.h to ossl_utils.hpp, and remove unused code. --- src/lib/CMakeLists.txt | 1 - src/lib/crypto/backend_version.cpp | 6 +- src/lib/crypto/bn_ossl.cpp | 96 ------------------------- src/lib/crypto/dl_ossl.cpp | 6 +- src/lib/crypto/dl_ossl.h | 7 +- src/lib/crypto/dsa.cpp | 1 - src/lib/crypto/dsa_ossl.cpp | 1 - src/lib/crypto/ec.cpp | 1 - src/lib/crypto/ec_ossl.cpp | 5 +- src/lib/crypto/ec_ossl.h | 2 +- src/lib/crypto/ecdh.cpp | 1 - src/lib/crypto/ecdsa.cpp | 1 - src/lib/crypto/ecdsa_ossl.cpp | 1 - src/lib/crypto/eddsa_ossl.cpp | 2 +- src/lib/crypto/elgamal.cpp | 1 - src/lib/crypto/elgamal_ossl.cpp | 4 +- src/lib/crypto/ossl_common.h | 40 ----------- src/lib/crypto/{bn.h => ossl_utils.hpp} | 60 ++++------------ src/lib/crypto/rsa.cpp | 1 - src/lib/crypto/rsa_ossl.cpp | 27 ++++--- src/lib/crypto/sm2.cpp | 1 - 21 files changed, 42 insertions(+), 223 deletions(-) delete mode 100644 src/lib/crypto/bn_ossl.cpp delete mode 100644 src/lib/crypto/ossl_common.h rename src/lib/crypto/{bn.h => ossl_utils.hpp} (92%) diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index b1d10e3ce6..606bc5bae4 100755 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -241,7 +241,6 @@ configure_file(config.h.in config.h) if(CRYPTO_BACKEND_OPENSSL) set(CRYPTO_SOURCES - crypto/bn_ossl.cpp crypto/dsa_common.cpp crypto/dsa_ossl.cpp crypto/ec_curves.cpp diff --git a/src/lib/crypto/backend_version.cpp b/src/lib/crypto/backend_version.cpp index 32af839435..1a45b18fb7 100644 --- a/src/lib/crypto/backend_version.cpp +++ b/src/lib/crypto/backend_version.cpp @@ -31,12 +31,12 @@ #elif defined(CRYPTO_BACKEND_OPENSSL) #include #include -#include "ossl_common.h" #if defined(CRYPTO_BACKEND_OPENSSL3) #include #endif #include #include "config.h" +#include "ossl_utils.hpp" #ifndef RNP_USE_STD_REGEX #include #else @@ -142,7 +142,7 @@ backend_init(void **param) /* Load default crypto provider */ state->def = OSSL_PROVIDER_load(NULL, "default"); if (!state->def) { - RNP_LOG("Failed to load default crypto provider: %s", ossl_latest_err()); + RNP_LOG("Failed to load default crypto provider: %s", rnp::ossl::latest_err()); free(state); return false; } @@ -150,7 +150,7 @@ backend_init(void **param) #if defined(OPENSSL_LOAD_LEGACY) state->legacy = OSSL_PROVIDER_load(NULL, "legacy"); if (!state->legacy) { - RNP_LOG("Failed to load legacy crypto provider: %s", ossl_latest_err()); + RNP_LOG("Failed to load legacy crypto provider: %s", rnp::ossl::latest_err()); OSSL_PROVIDER_unload(state->def); free(state); return false; diff --git a/src/lib/crypto/bn_ossl.cpp b/src/lib/crypto/bn_ossl.cpp deleted file mode 100644 index f97673c126..0000000000 --- a/src/lib/crypto/bn_ossl.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2021, [Ribose Inc](https://www.ribose.com). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include "bn.h" -#include "logging.h" - -/* store in unsigned [big endian] format */ -int -bn_bn2bin(const bignum_t *a, unsigned char *b) -{ - if (!a || !b) { - return -1; - } - return BN_bn2bin(a, b) >= 0 ? 0 : -1; -} - -bignum_t * -mpi2bn(const pgp::mpi *val) -{ - assert(val); - if (!val) { - RNP_LOG("NULL val."); - return NULL; - } - return mpi2bn(*val); -} - -bignum_t * -mpi2bn(const pgp::mpi &val) -{ - bignum_t *res = bn_new(); - if (!res) { - return NULL; - } - if (!BN_bin2bn(val.mpi, val.len, res)) { - bn_free(res); - res = NULL; - } - return res; -} - -bool -bn2mpi(const bignum_t *bn, pgp::mpi *val) -{ - return val && bn2mpi(bn, *val); -} - -bool -bn2mpi(const bignum_t *bn, pgp::mpi &val) -{ - val.len = bn_num_bytes(*bn); - return bn_bn2bin(bn, val.mpi) == 0; -} - -bignum_t * -bn_new(void) -{ - return BN_new(); -} - -void -bn_free(bignum_t *a) -{ - BN_clear_free(a); -} - -size_t -bn_num_bytes(const bignum_t &a) -{ - return (BN_num_bits(&a) + 7) / 8; -} diff --git a/src/lib/crypto/dl_ossl.cpp b/src/lib/crypto/dl_ossl.cpp index 5b1cb27ab1..27f8d4d153 100644 --- a/src/lib/crypto/dl_ossl.cpp +++ b/src/lib/crypto/dl_ossl.cpp @@ -27,10 +27,9 @@ #include #include #include -#include "bn.h" #include "dl_ossl.h" -#include "ossl_common.h" #include "utils.h" +#include "ossl_utils.hpp" #include #include #include @@ -206,7 +205,8 @@ dl_validate_key(rnp::ossl::evp::PKey &pkey, const pgp::mpi *x) } int res = EVP_PKEY_param_check(ctx.get()); if (res < 0) { - RNP_LOG("Param validation error: %lu (%s)", ERR_peek_last_error(), ossl_latest_err()); + RNP_LOG( + "Param validation error: %lu (%s)", ERR_peek_last_error(), rnp::ossl::latest_err()); } if (res < 1) { /* ElGamal specification doesn't seem to restrict P to the safe prime */ diff --git a/src/lib/crypto/dl_ossl.h b/src/lib/crypto/dl_ossl.h index 112defb332..ab7360e24a 100644 --- a/src/lib/crypto/dl_ossl.h +++ b/src/lib/crypto/dl_ossl.h @@ -27,12 +27,9 @@ #ifndef DL_OSSL_H_ #define DL_OSSL_H_ -#include "types.h" -#include "config.h" -#include #include "mpi.h" -#include "bn.h" -#include +#include +#include "ossl_utils.hpp" rnp::ossl::evp::PKey dl_load_key(const pgp::mpi &mp, const pgp::mpi *mq, diff --git a/src/lib/crypto/dsa.cpp b/src/lib/crypto/dsa.cpp index 5ef3bbf85f..d5725ab3a7 100644 --- a/src/lib/crypto/dsa.cpp +++ b/src/lib/crypto/dsa.cpp @@ -31,7 +31,6 @@ #include "botan_utils.hpp" #include #include "dsa.h" -#include "bn.h" #include "utils.h" namespace pgp { diff --git a/src/lib/crypto/dsa_ossl.cpp b/src/lib/crypto/dsa_ossl.cpp index d8b7b06c0e..8213729049 100644 --- a/src/lib/crypto/dsa_ossl.cpp +++ b/src/lib/crypto/dsa_ossl.cpp @@ -27,7 +27,6 @@ #include #include #include -#include "bn.h" #include "dsa.h" #include "dl_ossl.h" #include "utils.h" diff --git a/src/lib/crypto/ec.cpp b/src/lib/crypto/ec.cpp index e4353e2ddf..131b51044e 100644 --- a/src/lib/crypto/ec.cpp +++ b/src/lib/crypto/ec.cpp @@ -31,7 +31,6 @@ #include "types.h" #include "utils.h" #include "mem.h" -#include "bn.h" #include "botan_utils.hpp" #if defined(ENABLE_CRYPTO_REFRESH) || defined(ENABLE_PQC) #include "x25519.h" diff --git a/src/lib/crypto/ec_ossl.cpp b/src/lib/crypto/ec_ossl.cpp index 97e85fe1ac..50bed428eb 100644 --- a/src/lib/crypto/ec_ossl.cpp +++ b/src/lib/crypto/ec_ossl.cpp @@ -28,11 +28,10 @@ #include #include "ec.h" #include "ec_ossl.h" -#include "bn.h" -#include "ossl_common.h" #include "types.h" #include "mem.h" #include "utils.h" +#include "ossl_utils.hpp" #include #include #include @@ -297,7 +296,7 @@ load_key(const pgp::mpi &keyp, const pgp::mpi *keyx, pgp_curve_t curve) /* LCOV_EXCL_START */ RNP_LOG("Failed to create EC key with group %s: %s", curv_desc->openssl_name, - ossl_latest_err()); + rnp::ossl::latest_err()); return NULL; /* LCOV_EXCL_END */ } diff --git a/src/lib/crypto/ec_ossl.h b/src/lib/crypto/ec_ossl.h index 9ebdf97128..5def32662d 100644 --- a/src/lib/crypto/ec_ossl.h +++ b/src/lib/crypto/ec_ossl.h @@ -30,7 +30,7 @@ #include "types.h" #include "ec.h" #include -#include "bn.h" +#include "ossl_utils.hpp" namespace pgp { namespace ec { diff --git a/src/lib/crypto/ecdh.cpp b/src/lib/crypto/ecdh.cpp index 2d52382e07..3867915951 100644 --- a/src/lib/crypto/ecdh.cpp +++ b/src/lib/crypto/ecdh.cpp @@ -36,7 +36,6 @@ #include "types.h" #include "utils.h" #include "mem.h" -#include "bn.h" // Produces kek of size kek_len which corresponds to length of wrapping key static bool diff --git a/src/lib/crypto/ecdsa.cpp b/src/lib/crypto/ecdsa.cpp index 2e95d0dd5f..24da6678c1 100644 --- a/src/lib/crypto/ecdsa.cpp +++ b/src/lib/crypto/ecdsa.cpp @@ -28,7 +28,6 @@ #include "utils.h" #include #include -#include "bn.h" #include "botan_utils.hpp" static bool diff --git a/src/lib/crypto/ecdsa_ossl.cpp b/src/lib/crypto/ecdsa_ossl.cpp index 651373a7e4..bf4ae58dcf 100644 --- a/src/lib/crypto/ecdsa_ossl.cpp +++ b/src/lib/crypto/ecdsa_ossl.cpp @@ -27,7 +27,6 @@ #include "ecdsa.h" #include "utils.h" #include -#include "bn.h" #include "ec_ossl.h" #include #include diff --git a/src/lib/crypto/eddsa_ossl.cpp b/src/lib/crypto/eddsa_ossl.cpp index 287fb50ac8..a58662cd51 100644 --- a/src/lib/crypto/eddsa_ossl.cpp +++ b/src/lib/crypto/eddsa_ossl.cpp @@ -30,7 +30,7 @@ #include "ec.h" #include "ec_ossl.h" #include "utils.h" -#include "bn.h" +#include "ossl_utils.hpp" #include #include #include diff --git a/src/lib/crypto/elgamal.cpp b/src/lib/crypto/elgamal.cpp index 26a126ea98..c4a0d798f6 100644 --- a/src/lib/crypto/elgamal.cpp +++ b/src/lib/crypto/elgamal.cpp @@ -35,7 +35,6 @@ #include #include "elgamal.h" #include "utils.h" -#include "bn.h" // Max supported key byte size #define ELGAMAL_MAX_P_BYTELEN BITS_TO_BYTES(PGP_MPINT_BITS) diff --git a/src/lib/crypto/elgamal_ossl.cpp b/src/lib/crypto/elgamal_ossl.cpp index 9bb745b895..cee30d1cd1 100644 --- a/src/lib/crypto/elgamal_ossl.cpp +++ b/src/lib/crypto/elgamal_ossl.cpp @@ -25,14 +25,14 @@ */ #include -#include +#include #include #include #include "elgamal.h" #include "dl_ossl.h" #include "utils.h" -#include "bn.h" #include "mem.h" +#include "ossl_utils.hpp" #include #include #include diff --git a/src/lib/crypto/ossl_common.h b/src/lib/crypto/ossl_common.h deleted file mode 100644 index b6b7067ce4..0000000000 --- a/src/lib/crypto/ossl_common.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2022, [Ribose Inc](https://www.ribose.com). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RNP_OSSL_COMMON_H_ -#define RNP_OSSL_COMMON_H_ - -#include -#include "config.h" -#include - -inline const char * -ossl_latest_err() -{ - return ERR_error_string(ERR_peek_last_error(), NULL); -} - -#endif diff --git a/src/lib/crypto/bn.h b/src/lib/crypto/ossl_utils.hpp similarity index 92% rename from src/lib/crypto/bn.h rename to src/lib/crypto/ossl_utils.hpp index dee0190271..7667a62045 100644 --- a/src/lib/crypto/bn.h +++ b/src/lib/crypto/ossl_utils.hpp @@ -24,18 +24,17 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef RNP_BN_H_ -#define RNP_BN_H_ +#ifndef RNP_OSSL_UTILS_HPP_ +#define RNP_OSSL_UTILS_HPP_ -#include -#include +#include +#include #include "config.h" #include "mpi.h" - -#if defined(CRYPTO_BACKEND_OPENSSL) #include #include #include +#include #if defined(CRYPTO_BACKEND_OPENSSL3) #include #include @@ -45,28 +44,6 @@ #include #endif -#define bignum_t BIGNUM -#elif defined(CRYPTO_BACKEND_BOTAN) -#else -#error "Unknown crypto backend." -#endif - -#if defined(CRYPTO_BACKEND_OPENSSL) -bignum_t *bn_new(void); -void bn_free(bignum_t * /*a*/); - -int bn_bn2bin(const bignum_t * /*a*/, unsigned char * /*b*/); - -bignum_t *mpi2bn(const pgp::mpi *val); - -bignum_t *mpi2bn(const pgp::mpi &val); - -bool bn2mpi(const bignum_t *bn, pgp::mpi *val); - -bool bn2mpi(const bignum_t *bn, pgp::mpi &val); - -size_t bn_num_bytes(const bignum_t &a); - namespace rnp { class bn { BIGNUM * _bn; @@ -130,24 +107,11 @@ class bn { return c_get(); } - void - set(BIGNUM *val = NULL) noexcept - { - BN_free(_bn); - _bn = val; - } - - void - set(const pgp::mpi &val) noexcept - { - BN_free(_bn); - _bn = mpi2bn(&val); - } - BIGNUM ** ptr() noexcept { - set(); + BN_free(_bn); + _bn = NULL; return &_bn; } @@ -637,9 +601,15 @@ class ParamBld { } }; #endif + +inline const char * +latest_err() +{ + return ERR_error_string(ERR_peek_last_error(), NULL); +} + } // namespace ossl } // namespace rnp -#endif -#endif +#endif \ No newline at end of file diff --git a/src/lib/crypto/rsa.cpp b/src/lib/crypto/rsa.cpp index 3f308f0952..6fc049d6b1 100644 --- a/src/lib/crypto/rsa.cpp +++ b/src/lib/crypto/rsa.cpp @@ -32,7 +32,6 @@ #include "crypto/rsa.h" #include "config.h" #include "utils.h" -#include "bn.h" namespace pgp { namespace rsa { diff --git a/src/lib/crypto/rsa_ossl.cpp b/src/lib/crypto/rsa_ossl.cpp index b4b0a78fdc..3b567bb882 100644 --- a/src/lib/crypto/rsa_ossl.cpp +++ b/src/lib/crypto/rsa_ossl.cpp @@ -30,8 +30,7 @@ #include "crypto/rsa.h" #include "config.h" #include "utils.h" -#include "bn.h" -#include "ossl_common.h" +#include "ossl_utils.hpp" #include #include #include @@ -157,7 +156,7 @@ bld_params(const Key &key, bool secret) auto params = bld.to_param(); if (!params) { RNP_LOG("Failed to build RSA pub params: %s.", - ossl_latest_err()); // LCOV_EXCL_LINE + rnp::ossl::latest_err()); // LCOV_EXCL_LINE } return params; } @@ -202,7 +201,7 @@ bld_params(const Key &key, bool secret) } auto params = bld.to_param(); if (!params) { - RNP_LOG("Failed to build RSA params: %s.", ossl_latest_err()); // LCOV_EXCL_LINE + RNP_LOG("Failed to build RSA params: %s.", rnp::ossl::latest_err()); // LCOV_EXCL_LINE } return params; } @@ -219,14 +218,14 @@ load_key(const Key &key, bool secret) rnp::ossl::evp::Ctx ctx(EVP_PKEY_RSA); if (!ctx) { /* LCOV_EXCL_START */ - RNP_LOG("Context allocation failed: %s", ossl_latest_err()); + RNP_LOG("Context allocation failed: %s", rnp::ossl::latest_err()); return NULL; /* LCOV_EXCL_END */ } /* Create key */ if (EVP_PKEY_fromdata_init(ctx.get()) <= 0) { /* LCOV_EXCL_START */ - RNP_LOG("Failed to initialize key creation: %s", ossl_latest_err()); + RNP_LOG("Failed to initialize key creation: %s", rnp::ossl::latest_err()); return NULL; /* LCOV_EXCL_END */ } @@ -235,7 +234,7 @@ load_key(const Key &key, bool secret) res.ptr(), secret ? EVP_PKEY_KEYPAIR : EVP_PKEY_PUBLIC_KEY, params.get()) <= 0) { - RNP_LOG("Failed to create RSA key: %s", ossl_latest_err()); // LCOV_EXCL_LINE + RNP_LOG("Failed to create RSA key: %s", rnp::ossl::latest_err()); // LCOV_EXCL_LINE } return res; } @@ -249,7 +248,7 @@ init_context(const Key &key, bool secret) } rnp::ossl::evp::Ctx ctx(pkey); if (!ctx) { - RNP_LOG("Context allocation failed: %s", ossl_latest_err()); // LCOV_EXCL_LINE + RNP_LOG("Context allocation failed: %s", rnp::ossl::latest_err()); // LCOV_EXCL_LINE } return ctx; } @@ -262,13 +261,13 @@ Key::validate(rnp::RNG &rng, bool secret) const noexcept auto ctx = init_context(*this, secret); if (!ctx) { /* LCOV_EXCL_START */ - RNP_LOG("Failed to init context: %s", ossl_latest_err()); + RNP_LOG("Failed to init context: %s", rnp::ossl::latest_err()); return RNP_ERROR_GENERIC; /* LCOV_EXCL_END */ } int res = secret ? EVP_PKEY_pairwise_check(ctx.get()) : EVP_PKEY_public_check(ctx.get()); if (res <= 0) { - RNP_LOG("Key validation error: %s", ossl_latest_err()); // LCOV_EXCL_LINE + RNP_LOG("Key validation error: %s", rnp::ossl::latest_err()); // LCOV_EXCL_LINE } return res > 0 ? RNP_SUCCESS : RNP_ERROR_GENERIC; #else @@ -276,13 +275,13 @@ Key::validate(rnp::RNG &rng, bool secret) const noexcept rnp::ossl::evp::Ctx ctx(init_context(*this, secret)); if (!ctx) { /* LCOV_EXCL_START */ - RNP_LOG("Failed to init context: %s", ossl_latest_err()); + RNP_LOG("Failed to init context: %s", rnp::ossl::latest_err()); return RNP_ERROR_GENERIC; /* LCOV_EXCL_END */ } int res = EVP_PKEY_check(ctx.get()); if (res <= 0) { - RNP_LOG("Key validation error: %s", ossl_latest_err()); // LCOV_EXCL_LINE + RNP_LOG("Key validation error: %s", rnp::ossl::latest_err()); // LCOV_EXCL_LINE } return res > 0 ? RNP_SUCCESS : RNP_ERROR_GENERIC; } @@ -335,7 +334,7 @@ setup_signature_hash(rnp::ossl::evp::Ctx &ctx, } if (EVP_PKEY_CTX_set_signature_md(ctx.get(), hash_tp) <= 0) { if ((hash_alg != PGP_HASH_SHA1)) { - RNP_LOG("Failed to set digest %s: %s", hash_name, ossl_latest_err()); + RNP_LOG("Failed to set digest %s: %s", hash_name, rnp::ossl::latest_err()); return false; } enc = &PKCS1_SHA1_ENCODING[0]; @@ -412,7 +411,7 @@ Key::verify_pkcs1(const Signature &sig, res = EVP_PKEY_verify(ctx.get(), sig.s.mpi, sig.s.len, hash, hash_len); } if (res <= 0) { - RNP_LOG("RSA verification failure: %s", ossl_latest_err()); + RNP_LOG("RSA verification failure: %s", rnp::ossl::latest_err()); return RNP_ERROR_SIGNATURE_INVALID; } return RNP_SUCCESS; diff --git a/src/lib/crypto/sm2.cpp b/src/lib/crypto/sm2.cpp index 5312e320ac..19bda33e94 100644 --- a/src/lib/crypto/sm2.cpp +++ b/src/lib/crypto/sm2.cpp @@ -31,7 +31,6 @@ #include "botan_utils.hpp" #include "sm2.h" #include "utils.h" -#include "bn.h" static bool sm2_load_public_key(rnp::botan::Pubkey &pubkey, const pgp::ec::Key &keydata)