summaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/keypair.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-27 13:12:56 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-27 13:12:56 +0100
commit5a617503b729479d496c0e71c4a84a5e580f220a (patch)
treed375fdbe2ecb0a7bb6bb34f426245911fbdee0f9 /src/libcryptobox/keypair.c
parent948d6c90b1160dea389aca1662fad5c325e5d552 (diff)
downloadrspamd-5a617503b729479d496c0e71c4a84a5e580f220a.tar.gz
rspamd-5a617503b729479d496c0e71c4a84a5e580f220a.zip
[CritFix] Fix writing of encrypted HTTP requests
Diffstat (limited to 'src/libcryptobox/keypair.c')
-rw-r--r--src/libcryptobox/keypair.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c
index 51e023128..355654ffc 100644
--- a/src/libcryptobox/keypair.c
+++ b/src/libcryptobox/keypair.c
@@ -460,6 +460,14 @@ rspamd_pubkey_calculate_nm (struct rspamd_cryptobox_pubkey *p,
g_assert (kp->type == p->type);
g_assert (p->type == RSPAMD_KEYPAIR_KEX);
+ if (p->nm == NULL) {
+ if (posix_memalign ((void **)&p->nm, 32, sizeof (*p->nm)) != 0) {
+ abort ();
+ }
+
+ REF_INIT_RETAIN (p->nm, rspamd_cryptobox_nm_dtor);
+ }
+
if (kp->alg == RSPAMD_CRYPTOBOX_MODE_25519) {
struct rspamd_cryptobox_pubkey_25519 *rk_25519 =
RSPAMD_CRYPTOBOX_PUBKEY_25519(p);