diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-04-18 19:46:44 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-04-18 19:46:44 +0200 |
commit | f00c18e631ce8bdaf80d20f236ef275c9cb99291 (patch) | |
tree | 7926acf614e631febcbd5c99243d9c00edd2fbc2 /src/util/crypto_pow.c | |
parent | 91cccda131a12be139d50effe4657c6b24e36135 (diff) | |
download | gnunet-f00c18e631ce8bdaf80d20f236ef275c9cb99291.tar.gz gnunet-f00c18e631ce8bdaf80d20f236ef275c9cb99291.zip |
simplify pow even more; add timestamp to revocation pow
Diffstat (limited to 'src/util/crypto_pow.c')
-rw-r--r-- | src/util/crypto_pow.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/util/crypto_pow.c b/src/util/crypto_pow.c index 5e225f244..1ab4443d1 100644 --- a/src/util/crypto_pow.c +++ b/src/util/crypto_pow.c | |||
@@ -47,12 +47,6 @@ GNUNET_CRYPTO_pow_hash (const char *salt, | |||
47 | struct GNUNET_HashCode *result) | 47 | struct GNUNET_HashCode *result) |
48 | { | 48 | { |
49 | #ifdef LSD0001 | 49 | #ifdef LSD0001 |
50 | char twofish_iv[128 / 8]; // 128 bit IV | ||
51 | char twofish_key[256 / 8]; // 256 bit Key | ||
52 | char rbuf[buf_len]; | ||
53 | int rc; | ||
54 | gcry_cipher_hd_t handle; | ||
55 | |||
56 | GNUNET_break (ARGON2_OK == argon2d_hash_raw (3, /* iterations */ | 50 | GNUNET_break (ARGON2_OK == argon2d_hash_raw (3, /* iterations */ |
57 | 1024, /* memory (1 MiB) */ | 51 | 1024, /* memory (1 MiB) */ |
58 | 1, /* threads */ | 52 | 1, /* threads */ |
@@ -60,39 +54,6 @@ GNUNET_CRYPTO_pow_hash (const char *salt, | |||
60 | buf_len, | 54 | buf_len, |
61 | salt, | 55 | salt, |
62 | strlen (salt), | 56 | strlen (salt), |
63 | &twofish_key, | ||
64 | sizeof (twofish_key))); | ||
65 | |||
66 | GNUNET_CRYPTO_kdf (twofish_iv, | ||
67 | sizeof (twofish_iv), | ||
68 | "gnunet-proof-of-work-iv", | ||
69 | strlen ("gnunet-proof-of-work-iv"), | ||
70 | twofish_key, | ||
71 | sizeof(twofish_key), | ||
72 | salt, | ||
73 | strlen (salt), | ||
74 | NULL, 0); | ||
75 | GNUNET_assert (0 == | ||
76 | gcry_cipher_open (&handle, GCRY_CIPHER_TWOFISH, | ||
77 | GCRY_CIPHER_MODE_CFB, 0)); | ||
78 | rc = gcry_cipher_setkey (handle, | ||
79 | twofish_key, | ||
80 | sizeof(twofish_key)); | ||
81 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); | ||
82 | rc = gcry_cipher_setiv (handle, | ||
83 | twofish_iv, | ||
84 | sizeof(twofish_iv)); | ||
85 | GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); | ||
86 | GNUNET_assert (0 == gcry_cipher_encrypt (handle, &rbuf, buf_len, buf, | ||
87 | buf_len)); | ||
88 | gcry_cipher_close (handle); | ||
89 | GNUNET_break (ARGON2_OK == argon2d_hash_raw (3, /* iterations */ | ||
90 | 1024, /* memory (1 MiB) */ | ||
91 | 1, /* threads */ | ||
92 | rbuf, | ||
93 | buf_len, | ||
94 | salt, | ||
95 | strlen (salt), | ||
96 | result, | 57 | result, |
97 | sizeof (struct | 58 | sizeof (struct |
98 | GNUNET_HashCode))); | 59 | GNUNET_HashCode))); |