summaryrefslogtreecommitdiffstats
path: root/libtomcrypt/pk/rsa/rsa_export.c
diff options
context:
space:
mode:
Diffstat (limited to 'libtomcrypt/pk/rsa/rsa_export.c')
-rw-r--r--libtomcrypt/pk/rsa/rsa_export.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libtomcrypt/pk/rsa/rsa_export.c b/libtomcrypt/pk/rsa/rsa_export.c
index 483af19..cb667a4 100644
--- a/libtomcrypt/pk/rsa/rsa_export.c
+++ b/libtomcrypt/pk/rsa/rsa_export.c
@@ -31,6 +31,8 @@ int rsa_export(unsigned char *out, unsigned long *outlen, int type,
{
unsigned long zero = 0;
int err;
+ const struct algo_properties_st *algo = _ncr_algo_to_properties(NCR_ALG_RSA);
+
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(outlen != NULL);
LTC_ARGCHK(key != NULL);
@@ -40,6 +42,10 @@ int rsa_export(unsigned char *out, unsigned long *outlen, int type,
return CRYPT_PK_INVALID_TYPE;
}
+ if (algo == NULL) {
+ return CRYPT_INVALID_ARG;
+ }
+
if (type == PK_PRIVATE) {
/* private key */
/* output is
@@ -75,7 +81,7 @@ int rsa_export(unsigned char *out, unsigned long *outlen, int type,
}
err = der_encode_subject_public_key_info(out, outlen,
- PKA_RSA, tmp, tmplen,
+ algo, tmp, tmplen,
LTC_ASN1_NULL, NULL,
0);