diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-08-07 10:50:56 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-08-07 10:50:56 +0100 |
commit | 8e8af455e90378439b369e589f56e2020cae97a8 (patch) | |
tree | 3d89579cf15ecbf5ed3d03d45dc1968eadd2a79c /src/libcryptobox | |
parent | d46c5ad4a55e54681db731e0b4086b9f7e6b6bed (diff) | |
download | rspamd-8e8af455e90378439b369e589f56e2020cae97a8.tar.gz rspamd-8e8af455e90378439b369e589f56e2020cae97a8.zip |
[Minor] Some neats
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/cryptobox.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index 6c6aed031..120c6ea10 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -38,8 +38,6 @@ #endif #ifdef HAVE_OPENSSL #include <openssl/opensslv.h> -#include <openssl/engine.h> -#include <openssl/param_build.h> /* Openssl >= 1.0.1d is required for GCM verification */ #if OPENSSL_VERSION_NUMBER >= 0x1000104fL #define HAVE_USABLE_OPENSSL 1 @@ -52,6 +50,11 @@ #include <openssl/ecdh.h> #include <openssl/ecdsa.h> #include <openssl/rand.h> +#include <openssl/engine.h> +#if OPENSSL_VERSION_MAJOR >= 3 +#include <openssl/param_build.h> +#include <openssl/core.h> +#endif #define CRYPTOBOX_CURVE_NID NID_X9_62_prime256v1 #endif @@ -410,7 +413,7 @@ void rspamd_cryptobox_keypair_sig(rspamd_sig_pk_t pk, rspamd_sig_sk_t sk, g_assert(0); #else - gsize len; + size_t len; #if OPENSSL_VERSION_MAJOR >= 3 OSSL_LIB_CTX *libctx = OSSL_LIB_CTX_new(); EVP_PKEY *pkey = EVP_PKEY_Q_keygen(libctx, NULL, "EC", EC_curve_nid2nist(CRYPTOBOX_CURVE_NID)); @@ -543,7 +546,7 @@ void rspamd_cryptobox_nm(rspamd_nm_t nm, OSSL_PARAM param[3]; param[0] = OSSL_PARAM_construct_utf8_string("group", "prime256v1", 0); - param[1] = OSSL_PARAM_construct_BN("priv", (void *) sk, sizeof(rspamd_sk_t)); + param[1] = OSSL_PARAM_construct_BN("priv", (void *) sk, rspamd_cryptobox_sk_bytes(mode)); param[2] = OSSL_PARAM_construct_end(); g_assert(EVP_PKEY_fromdata_init(pctx) == 1); @@ -552,7 +555,7 @@ void rspamd_cryptobox_nm(rspamd_nm_t nm, pctx = EVP_PKEY_CTX_new_from_pkey(libctx, sec_pkey, NULL); param[0] = OSSL_PARAM_construct_utf8_string("group", "prime256v1", 0); - param[1] = OSSL_PARAM_construct_octet_string("pub", (void *) pk, sizeof(rspamd_pk_t)); + param[1] = OSSL_PARAM_construct_octet_string("pub", (void *) pk, rspamd_cryptobox_pk_bytes(mode)); param[2] = OSSL_PARAM_construct_end(); g_assert(EVP_PKEY_fromdata_init(dctx) == 1); |