From: Vsevolod Stakhov Date: Fri, 9 Aug 2024 12:03:46 +0000 (+0100) Subject: [Fix] Use proper keys when doing asymmetric encryption X-Git-Tag: 3.10.0~41^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b83fb594e7665008f6f127d003765ed9efd23249;p=thirdparty%2Frspamd.git [Fix] Use proper keys when doing asymmetric encryption --- diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c index 96389dce85..d3f81ee2d0 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);