diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-06 14:31:22 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-06 14:31:22 +0000 |
commit | d9879cd7848a147c0b3056336cb982bbc9a1e247 (patch) | |
tree | 139e8af0e56454529b519eceba5abc03d1202f45 /src/libcryptobox | |
parent | 524b67ba88ffd3c00160ad0b6cd3f8bffefb7263 (diff) | |
download | rspamd-d9879cd7848a147c0b3056336cb982bbc9a1e247.tar.gz rspamd-d9879cd7848a147c0b3056336cb982bbc9a1e247.zip |
Fix more issues remaining
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/keypair.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libcryptobox/keypair.c b/src/libcryptobox/keypair.c index e645ef3e0..d8e160af1 100644 --- a/src/libcryptobox/keypair.c +++ b/src/libcryptobox/keypair.c @@ -695,11 +695,13 @@ rspamd_keypair_from_ucl (const ucl_object_t *obj) /* TODO: handle errors */ } - kp = rspamd_keypair_new (type, mode); + kp = rspamd_cryptobox_keypair_alloc (type, mode); + kp->type = type; + kp->alg = mode; g_assert (kp != NULL); - target = rspamd_cryptobox_keypair_pk (kp, &len); - str = ucl_object_tolstring (pubkey, &ucl_len); + target = rspamd_cryptobox_keypair_sk (kp, &len); + str = ucl_object_tolstring (privkey, &ucl_len); if (is_hex) { dec_len = rspamd_decode_hex_buf (str, ucl_len, target, len); @@ -714,8 +716,8 @@ rspamd_keypair_from_ucl (const ucl_object_t *obj) return NULL; } - target = rspamd_cryptobox_keypair_sk (kp, &len); - str = ucl_object_tolstring (privkey, &ucl_len); + target = rspamd_cryptobox_keypair_pk (kp, &len); + str = ucl_object_tolstring (pubkey, &ucl_len); if (is_hex) { dec_len = rspamd_decode_hex_buf (str, ucl_len, target, len); @@ -730,6 +732,10 @@ rspamd_keypair_from_ucl (const ucl_object_t *obj) return NULL; } + rspamd_cryptobox_hash (kp->id, target, len, NULL, 0); + + REF_INIT_RETAIN (kp, rspamd_cryptobox_keypair_dtor); + return kp; } |