diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-12 20:52:22 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-06-12 20:52:22 +0200 |
commit | 62b87e57a7f7042d27fe0a80b9194aeae0c14a50 (patch) | |
tree | 961a43363dbca413e4b1e65b367c0ffd553cfaf0 /brandt.c | |
parent | 5957a777076d014b17aada25afe0991397edbacc (diff) | |
download | libbrandt-62b87e57a7f7042d27fe0a80b9194aeae0c14a50.tar.gz libbrandt-62b87e57a7f7042d27fe0a80b9194aeae0c14a50.zip |
add tests for key generation
Diffstat (limited to 'brandt.c')
-rw-r--r-- | brandt.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/brandt.c b/brandt.c new file mode 100644 index 0000000..dd88643 --- /dev/null +++ b/brandt.c | |||
@@ -0,0 +1,27 @@ | |||
1 | |||
2 | #include <gcrypt.h> | ||
3 | |||
4 | #include "crypto.h" | ||
5 | #include "util.h" | ||
6 | |||
7 | void BRANDT_init () | ||
8 | { | ||
9 | gcry_error_t err = 0; | ||
10 | if (!gcry_check_version("1.6.0")) { | ||
11 | eprintf("libgcrypt version mismatch"); | ||
12 | } | ||
13 | |||
14 | /* SECMEM cannot be resized dynamically. We do not know how much we need */ | ||
15 | if ((err = gcry_control(GCRYCTL_DISABLE_SECMEM, 0))) | ||
16 | weprintf("failed to set libgcrypt option DISABLE_SECMEM: %s", | ||
17 | gcry_strerror(err)); | ||
18 | |||
19 | /* ecc is slow otherwise. */ | ||
20 | if ((err = gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0))) | ||
21 | weprintf("failed to set libgcrypt option ENABLE_QUICK_RANDOM: %s", | ||
22 | gcry_strerror(err)); | ||
23 | |||
24 | gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); | ||
25 | brandt_rand_poll(); | ||
26 | brandt_crypto_init(); | ||
27 | } | ||