From ab780d6f7531cb8277609aedffbb4376d821f6ff Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 6 Feb 2016 13:30:20 +0000 Subject: Fix loading of pubkeys --- src/libcryptobox/keypair.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libcryptobox') diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c index b1b5b112b..8f0e8e8f6 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; } -- cgit v1.2.3