summaryrefslogtreecommitdiffstats
path: root/libtomcrypt/pk/dsa/dsa_import.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtomcrypt/pk/dsa/dsa_import.c')
-rw-r--r--libtomcrypt/pk/dsa/dsa_import.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libtomcrypt/pk/dsa/dsa_import.c b/libtomcrypt/pk/dsa/dsa_import.c
index cf21e3b..5a60937 100644
--- a/libtomcrypt/pk/dsa/dsa_import.c
+++ b/libtomcrypt/pk/dsa/dsa_import.c
@@ -9,6 +9,7 @@
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
+#include <ncr-int.h>
/**
@file dsa_import.c
@@ -29,10 +30,15 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key * key)
int err;
unsigned long zero = 0;
unsigned char *tmpbuf = NULL;
+ const struct algo_properties_st *algo = _ncr_algo_to_properties(NCR_ALG_DSA);
LTC_ARGCHK(in != NULL);
LTC_ARGCHK(key != NULL);
+ if (algo == NULL) {
+ return CRYPT_INVALID_ARG;
+ }
+
/* init key */
if (mp_init_multi(&key->p, &key->g, &key->q, &key->x, &key->y, NULL) !=
CRYPT_OK) {
@@ -65,7 +71,7 @@ int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key * key)
}
err = der_decode_subject_public_key_info(in, inlen,
- PKA_DSA, tmpbuf,
+ algo, tmpbuf,
&tmpbuf_len,
LTC_ASN1_SEQUENCE,
params, 3);