summaryrefslogtreecommitdiff
path: root/lib/pk.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2015-09-12 15:47:38 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2015-09-12 16:22:48 +0200
commit6c8702587943c426e06d5b545af4f143ae17c670 (patch)
tree8a8184b82ccd40564456390f4ab580970a431763 /lib/pk.c
parent9b89f76fc789fd8f8e3bb3c418f25b97b9e71920 (diff)
downloadgnutls-6c8702587943c426e06d5b545af4f143ae17c670.tar.gz
Added API to generate private keys from a given seed
Currently it is restricted to RSA and FIPS 186-4 key generation with SHA384. Relates to #34
Diffstat (limited to 'lib/pk.c')
-rw-r--r--lib/pk.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/pk.c b/lib/pk.c
index 94c89247e0..5bef8b9697 100644
--- a/lib/pk.c
+++ b/lib/pk.c
@@ -186,6 +186,11 @@ int _gnutls_pk_params_copy(gnutls_pk_params_st * dst,
dst->params_nr++;
}
+ if (src->seed_size) {
+ dst->seed_size = src->seed_size;
+ memcpy(dst->seed, src->seed, src->seed_size);
+ }
+
return 0;
fail:
@@ -215,6 +220,8 @@ void gnutls_pk_params_clear(gnutls_pk_params_st * p)
if (p->params[i] != NULL)
_gnutls_mpi_clear(p->params[i]);
}
+ gnutls_memset(p->seed, 0, p->seed_size);
+ p->seed_size = 0;
}
/* Writes the digest information and the digest in a DER encoded