-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ name -> "FrodoKEM-AES" | |
|
||
<requires> | ||
aes | ||
frodokem_common | ||
</requires> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/lib/pubkey/frodokem/frodokem_shake/frodo_shake_generator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* FrodoKEM matrix generator based on SHAKE | ||
* | ||
* The Fellowship of the FrodoKEM: | ||
* (C) 2023 Jack Lloyd | ||
* 2023 René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity | ||
* | ||
* Botan is released under the Simplified BSD License (see license.txt) | ||
*/ | ||
|
||
#ifndef BOTAN_FRODOKEM_SHAKE_GENERATOR_H_ | ||
#define BOTAN_FRODOKEM_SHAKE_GENERATOR_H_ | ||
|
||
#include <botan/internal/frodo_constants.h> | ||
#include <botan/internal/frodo_types.h> | ||
#include <botan/internal/loadstor.h> | ||
#include <botan/internal/shake_xof.h> | ||
|
||
#include <span> | ||
|
||
namespace Botan { | ||
|
||
inline auto create_shake_row_generator(const FrodoKEMConstants& constants, StrongSpan<const FrodoSeedA> seed_a) { | ||
BOTAN_ASSERT_NOMSG(constants.mode().is_shake()); | ||
|
||
return [xof = SHAKE_128_XOF(), a = FrodoSeedA(seed_a)](std::span<uint8_t> out, uint16_t i) mutable { | ||
xof.clear(); | ||
// TODO: update that once #3707 is merged | ||
// potentially add a new method: std::array<uint8_t, XX> as_le(uintXX_t) | ||
std::array<uint8_t, 2> le; | ||
store_le(i, le.data()); | ||
xof.update(le); | ||
xof.update(a); | ||
xof.output(out); | ||
}; | ||
} | ||
|
||
} // namespace Botan | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<defines> | ||
FRODOKEM_SHAKE -> 20231114 | ||
</defines> | ||
|
||
<module_info> | ||
name -> "FrodoKEM-SHAKE" | ||
</module_info> | ||
|
||
<requires> | ||
shake_xof | ||
frodokem_common | ||
</requires> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters