From: Vsevolod Stakhov Date: Sat, 6 Feb 2016 13:30:20 +0000 (+0000) Subject: Fix loading of pubkeys X-Git-Tag: 1.2.0~299 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab780d6f7531cb8277609aedffbb4376d821f6ff;p=thirdparty%2Frspamd.git Fix loading of pubkeys --- diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c index b1b5b112b8..8f0e8e8f6f 100644 --- a/src/libcryptobox/keypair.c +++ b/src/libcryptobox/keypair.c @@ -338,13 +338,13 @@ rspamd_pubkey_from_base32 (const gchar *b32, } pk = rspamd_cryptobox_pubkey_alloc (type, alg); + pk->alg = alg; + pk->type = type; pk_data = rspamd_cryptobox_pubkey_pk (pk, &pklen); memcpy (pk_data, decoded, pklen); g_free (decoded); rspamd_cryptobox_hash (pk->id, pk_data, pklen, NULL, 0); - pk->alg = alg; - pk->type = type; return pk; } @@ -384,13 +384,13 @@ rspamd_pubkey_from_hex (const gchar *hex, } pk = rspamd_cryptobox_pubkey_alloc (type, alg); + pk->alg = alg; + pk->type = type; pk_data = rspamd_cryptobox_pubkey_pk (pk, &pklen); memcpy (pk_data, decoded, pklen); g_free (decoded); rspamd_cryptobox_hash (pk->id, pk_data, pklen, NULL, 0); - pk->alg = alg; - pk->type = type; return pk; } @@ -416,12 +416,12 @@ rspamd_pubkey_from_bin (const guchar *raw, } pk = rspamd_cryptobox_pubkey_alloc (type, alg); + pk->alg = alg; + pk->type = type; pk_data = rspamd_cryptobox_pubkey_pk (pk, &pklen); memcpy (pk_data, raw, pklen); rspamd_cryptobox_hash (pk->id, pk_data, pklen, NULL, 0); - pk->alg = alg; - pk->type = type; return pk; }