From 96a1c63e7ce1c66603b653b050b75dc309d1c3dc Mon Sep 17 00:00:00 2001 From: Johannes Roth Date: Mon, 23 Oct 2023 10:10:59 +0200 Subject: [PATCH] fix compilation errors on Windows for the PQC and Crypto Refresh code --- src/lib/crypto/dilithium_exdsa_composite.cpp | 6 ++++++ src/lib/crypto/dilithium_exdsa_composite.h | 1 + src/lib/crypto/kyber_ecdh_composite.cpp | 6 ++++++ src/lib/crypto/kyber_ecdh_composite.h | 1 + src/tests/hkdf.cpp | 2 +- 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/dilithium_exdsa_composite.cpp b/src/lib/crypto/dilithium_exdsa_composite.cpp index cd2ed80ca3..c61aa8deec 100644 --- a/src/lib/crypto/dilithium_exdsa_composite.cpp +++ b/src/lib/crypto/dilithium_exdsa_composite.cpp @@ -244,6 +244,12 @@ pgp_dilithium_exdsa_composite_private_key_t::operator=( return *this; } +/* also offer copy constructor */ +pgp_dilithium_exdsa_composite_private_key_t::pgp_dilithium_exdsa_composite_private_key_t(const pgp_dilithium_exdsa_composite_private_key_t &other) +{ + *this = other; +} + pgp_dilithium_exdsa_composite_private_key_t::pgp_dilithium_exdsa_composite_private_key_t( std::vector const &exdsa_key_encoded, std::vector const &dilithium_key_encoded, diff --git a/src/lib/crypto/dilithium_exdsa_composite.h b/src/lib/crypto/dilithium_exdsa_composite.h index 6e454342bf..d22b279955 100644 --- a/src/lib/crypto/dilithium_exdsa_composite.h +++ b/src/lib/crypto/dilithium_exdsa_composite.h @@ -91,6 +91,7 @@ class pgp_dilithium_exdsa_composite_private_key_t pgp_pubkey_alg_t pk_alg); pgp_dilithium_exdsa_composite_private_key_t &operator=( const pgp_dilithium_exdsa_composite_private_key_t &other); + pgp_dilithium_exdsa_composite_private_key_t(const pgp_dilithium_exdsa_composite_private_key_t &other); pgp_dilithium_exdsa_composite_private_key_t() = default; rnp_result_t sign(rnp::RNG * rng, diff --git a/src/lib/crypto/kyber_ecdh_composite.cpp b/src/lib/crypto/kyber_ecdh_composite.cpp index b69556214e..f790f59792 100644 --- a/src/lib/crypto/kyber_ecdh_composite.cpp +++ b/src/lib/crypto/kyber_ecdh_composite.cpp @@ -261,6 +261,12 @@ pgp_kyber_ecdh_composite_private_key_t::operator=( return *this; } +/* also offer copy constructor */ +pgp_kyber_ecdh_composite_private_key_t::pgp_kyber_ecdh_composite_private_key_t(const pgp_kyber_ecdh_composite_private_key_t &other) +{ + *this = other; +} + size_t pgp_kyber_ecdh_composite_private_key_t::encoded_size(pgp_pubkey_alg_t pk_alg) { diff --git a/src/lib/crypto/kyber_ecdh_composite.h b/src/lib/crypto/kyber_ecdh_composite.h index 37f878333e..501166ab1c 100644 --- a/src/lib/crypto/kyber_ecdh_composite.h +++ b/src/lib/crypto/kyber_ecdh_composite.h @@ -92,6 +92,7 @@ class pgp_kyber_ecdh_composite_private_key_t : public pgp_kyber_ecdh_composite_k pgp_pubkey_alg_t pk_alg); pgp_kyber_ecdh_composite_private_key_t &operator=( const pgp_kyber_ecdh_composite_private_key_t &other); + pgp_kyber_ecdh_composite_private_key_t(const pgp_kyber_ecdh_composite_private_key_t &other); pgp_kyber_ecdh_composite_private_key_t() = default; rnp_result_t decrypt(rnp::RNG * rng, diff --git a/src/tests/hkdf.cpp b/src/tests/hkdf.cpp index abf2633b57..02926082bc 100644 --- a/src/tests/hkdf.cpp +++ b/src/tests/hkdf.cpp @@ -33,7 +33,7 @@ TEST_F(rnp_tests, hkdf_test_case_1) 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a, 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c, 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf, 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18, 0x58, 0x65}; - size_t L = 42; + const size_t L = 42; std::unique_ptr hkdf = rnp::Hkdf::create(PGP_HASH_SHA256);