aboutsummaryrefslogtreecommitdiff
path: root/brandt.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-06-16 00:09:29 +0200
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-06-17 10:29:49 +0200
commit761dd37e1f905719df2cd8f4420e4b46da80bffb (patch)
treeb93ec567a19e2407274fc3350ea51186aac8f091 /brandt.c
parent6f3fb463176c04c9a258fce820ec66724a4d13f4 (diff)
downloadlibbrandt-761dd37e1f905719df2cd8f4420e4b46da80bffb.tar.gz
libbrandt-761dd37e1f905719df2cd8f4420e4b46da80bffb.zip
refactor smc and ec crypto functions and ad 0og zkp
Diffstat (limited to 'brandt.c')
-rw-r--r--brandt.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/brandt.c b/brandt.c
index dd88643..30cfd92 100644
--- a/brandt.c
+++ b/brandt.c
@@ -1,27 +1,47 @@
1/* This file is part of libbrandt.
2 * Copyright (C) 2016 GNUnet e.V.
3 *
4 * libbrandt is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License as published by the Free Software
6 * Foundation, either version 3 of the License, or (at your option) any later
7 * version.
8 *
9 * libbrandt is distributed in the hope that it will be useful, but WITHOUT ANY
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * libbrandt. If not, see <http://www.gnu.org/licenses/>.
15 */
1 16
17/**
18 * @file brandt.c
19 * @brief TODO
20 */
2#include <gcrypt.h> 21#include <gcrypt.h>
3 22
4#include "crypto.h" 23#include "crypto.h"
5#include "util.h" 24#include "util.h"
6 25
7void BRANDT_init () 26void
27BRANDT_init ()
8{ 28{
9 gcry_error_t err = 0; 29 gcry_error_t err = 0;
10 if (!gcry_check_version("1.6.0")) { 30
11 eprintf("libgcrypt version mismatch"); 31 if (!gcry_check_version ("1.7.0"))
12 } 32 eprintf ("libgcrypt version mismatch");
13 33
14 /* SECMEM cannot be resized dynamically. We do not know how much we need */ 34 /* SECMEM cannot be resized dynamically. We do not know how much we need */
15 if ((err = gcry_control(GCRYCTL_DISABLE_SECMEM, 0))) 35 if ((err = gcry_control (GCRYCTL_DISABLE_SECMEM, 0)))
16 weprintf("failed to set libgcrypt option DISABLE_SECMEM: %s", 36 weprintf ("failed to set libgcrypt option DISABLE_SECMEM: %s",
17 gcry_strerror(err)); 37 gcry_strerror (err));
18 38
19 /* ecc is slow otherwise. */ 39 /* ecc is slow otherwise. */
20 if ((err = gcry_control(GCRYCTL_ENABLE_QUICK_RANDOM, 0))) 40 if ((err = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0)))
21 weprintf("failed to set libgcrypt option ENABLE_QUICK_RANDOM: %s", 41 weprintf ("failed to set libgcrypt option ENABLE_QUICK_RANDOM: %s",
22 gcry_strerror(err)); 42 gcry_strerror (err));
23 43
24 gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); 44 gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
25 brandt_rand_poll(); 45 brandt_rand_poll ();
26 brandt_crypto_init(); 46 brandt_crypto_init ();
27} 47}