summaryrefslogtreecommitdiff
path: root/dsa.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-03-26 22:02:19 +0100
committerNiels Möller <nisse@lysator.liu.se>2014-03-26 22:02:19 +0100
commit38edca975bfda4fd3f57651ae14f567bafb5f9ae (patch)
treeda8a0e56724bb652fe9647ecba04ab937a2cf2f5 /dsa.c
parent5549b2f48b7f5b53249932012fd4bcb031545ab9 (diff)
downloadnettle-38edca975bfda4fd3f57651ae14f567bafb5f9ae.tar.gz
New functions dsa_params_init and dsa_params_clear.
Diffstat (limited to 'dsa.c')
-rw-r--r--dsa.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/dsa.c b/dsa.c
index 0d241b79..cf036365 100644
--- a/dsa.c
+++ b/dsa.c
@@ -32,20 +32,32 @@
#include "bignum.h"
void
+dsa_params_init (struct dsa_params *params)
+{
+ mpz_init(params->p);
+ mpz_init(params->q);
+ mpz_init(params->g);
+}
+
+void
+dsa_params_clear (struct dsa_params *params)
+{
+ mpz_clear(params->p);
+ mpz_clear(params->q);
+ mpz_clear(params->g);
+}
+
+void
dsa_public_key_init(struct dsa_public_key *key)
{
- mpz_init(key->p);
- mpz_init(key->q);
- mpz_init(key->g);
+ dsa_params_init ((struct dsa_params *) key);
mpz_init(key->y);
}
void
dsa_public_key_clear(struct dsa_public_key *key)
{
- mpz_clear(key->p);
- mpz_clear(key->q);
- mpz_clear(key->g);
+ dsa_params_clear ((struct dsa_params *) key);
mpz_clear(key->y);
}