aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/newhope/newhope.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/newhope/newhope.cpp')
-rw-r--r--src/lib/pubkey/newhope/newhope.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/lib/pubkey/newhope/newhope.cpp b/src/lib/pubkey/newhope/newhope.cpp
index 8436457b4..25168cc58 100644
--- a/src/lib/pubkey/newhope/newhope.cpp
+++ b/src/lib/pubkey/newhope/newhope.cpp
@@ -10,7 +10,7 @@
*/
#include <botan/newhope.h>
-#include <botan/keccak.h>
+#include <botan/sha3.h>
#include <botan/loadstor.h>
namespace Botan {
@@ -445,7 +445,7 @@ void keccak_absorb(uint64_t *s,
for (i = 0; i < r / 8; ++i)
s[i] ^= load_le<u64bit>(m, i);
- Keccak_1600::permute(s);
+ SHA_3::permute(s);
mlen -= r;
m += r;
}
@@ -465,7 +465,7 @@ inline void keccak_squeezeblocks(uint8_t *h, size_t nblocks,
{
while(nblocks > 0)
{
- Keccak_1600::permute(s);
+ SHA_3::permute(s);
copy_out_le(h, r, s);
@@ -511,24 +511,18 @@ void gen_a(poly *a, const uint8_t *seed)
}
}
-}
-
-// API FUNCTIONS
-
void newhope_hash(uint8_t *output, const uint8_t *input, size_t inputByteLen)
-{
-const size_t SHA3_256_RATE = 136;
+ {
+ SHA_3_256 sha3;
- uint64_t s[25];
- uint8_t t[SHA3_256_RATE];
- int i;
+ sha3.update(input, inputByteLen);
+ sha3.final(output);
+}
- keccak_absorb(s, SHA3_256_RATE, input, inputByteLen, 0x06);
- keccak_squeezeblocks(t, 1, s, SHA3_256_RATE);
- for(i=0;i<32;i++)
- output[i] = t[i];
}
+// API FUNCTIONS
+
void newhope_keygen(uint8_t *send, poly *sk, RandomNumberGenerator& rng)
{
poly a, e, r, pk;