aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-08-09 13:03:46 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-08-09 13:03:46 +0100
commitb83fb594e7665008f6f127d003765ed9efd23249 (patch)
treeab15a175fc2627ecdb303c91a0d79df76434828d /src
parent03aa3490726177fb3cf9da5b80f63dc9bf5993dc (diff)
downloadrspamd-b83fb594e7665008f6f127d003765ed9efd23249.tar.gz
rspamd-b83fb594e7665008f6f127d003765ed9efd23249.zip
[Fix] Use proper keys when doing asymmetric encryption
Diffstat (limited to 'src')
-rw-r--r--src/libcryptobox/keypair.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c
index 96389dce8..d3f81ee2d 100644
--- a/src/libcryptobox/keypair.c
+++ b/src/libcryptobox/keypair.c
@@ -837,9 +837,9 @@ rspamd_keypair_encrypt(struct rspamd_cryptobox_keypair *kp,
ottery_rand_bytes(nonce, crypto_box_noncebytes());
memcpy(data, in, inlen);
- memcpy(pubkey, rspamd_keypair_component(kp, RSPAMD_KEYPAIR_COMPONENT_PK, NULL),
+ memcpy(pubkey, rspamd_keypair_component(local, RSPAMD_KEYPAIR_COMPONENT_PK, NULL),
crypto_box_publickeybytes());
- rspamd_cryptobox_encrypt_inplace(data, inlen, nonce, pubkey,
+ rspamd_cryptobox_encrypt_inplace(data, inlen, nonce, rspamd_keypair_component(kp, RSPAMD_KEYPAIR_COMPONENT_PK, NULL),
rspamd_keypair_component(local, RSPAMD_KEYPAIR_COMPONENT_SK, NULL),
mac);
rspamd_keypair_unref(local);
@@ -886,9 +886,9 @@ rspamd_pubkey_encrypt(struct rspamd_cryptobox_pubkey *pk,
ottery_rand_bytes(nonce, crypto_box_noncebytes());
memcpy(data, in, inlen);
- memcpy(pubkey, rspamd_pubkey_get_pk(pk, NULL),
+ memcpy(pubkey, rspamd_keypair_component(local, RSPAMD_KEYPAIR_COMPONENT_PK, NULL),
crypto_box_publickeybytes());
- rspamd_cryptobox_encrypt_inplace(data, inlen, nonce, pubkey,
+ rspamd_cryptobox_encrypt_inplace(data, inlen, nonce, rspamd_pubkey_get_pk(pk, NULL),
rspamd_keypair_component(local, RSPAMD_KEYPAIR_COMPONENT_SK, NULL),
mac);
rspamd_keypair_unref(local);