-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: xvzcf <[email protected]> Co-authored-by: Jonathan Protzenko <[email protected]>
- Loading branch information
1 parent
34243fb
commit fee3dc1
Showing
20 changed files
with
5,927 additions
and
47 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 |
---|---|---|
|
@@ -27,3 +27,5 @@ rust/.c | |
.idea | ||
cmake-build-debug | ||
|
||
# ctags | ||
tags |
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
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,73 @@ | ||
/* | ||
* Copyright 2022 Cryspen Sarl | ||
* | ||
* Licensed under the Apache License, Version 2.0 or MIT. | ||
* - http://www.apache.org/licenses/LICENSE-2.0 | ||
* - http://opensource.org/licenses/MIT | ||
*/ | ||
|
||
#include "Libcrux_Kem_Kyber_Kyber768.h" | ||
#include "util.h" | ||
|
||
static void | ||
kyber768_key_generation(benchmark::State& state) | ||
{ | ||
uint8_t randomness[64]; | ||
generate_random(randomness, 64); | ||
|
||
uint8_t public_key[KYBER768_PUBLICKEYBYTES]; | ||
uint8_t secret_key[KYBER768_SECRETKEYBYTES]; | ||
|
||
for (auto _ : state) { | ||
Libcrux_Kyber768_GenerateKeyPair(public_key, secret_key, randomness); | ||
} | ||
} | ||
|
||
static void | ||
kyber768_encapsulation(benchmark::State& state) | ||
{ | ||
uint8_t randomness[32]; | ||
generate_random(randomness, 32); | ||
|
||
uint8_t public_key[KYBER768_PUBLICKEYBYTES]; | ||
uint8_t secret_key[KYBER768_SECRETKEYBYTES]; | ||
|
||
uint8_t ciphertext[KYBER768_CIPHERTEXTBYTES]; | ||
uint8_t sharedSecret[KYBER768_SHAREDSECRETBYTES]; | ||
|
||
Libcrux_Kyber768_GenerateKeyPair(public_key, secret_key, randomness); | ||
|
||
for (auto _ : state) { | ||
Libcrux_Kyber768_Encapsulate( | ||
ciphertext, sharedSecret, &public_key, randomness); | ||
} | ||
} | ||
|
||
static void | ||
kyber768_decapsulation(benchmark::State& state) | ||
{ | ||
uint8_t randomness[64]; | ||
|
||
uint8_t public_key[KYBER768_PUBLICKEYBYTES]; | ||
uint8_t secret_key[KYBER768_SECRETKEYBYTES]; | ||
|
||
uint8_t ciphertext[KYBER768_CIPHERTEXTBYTES]; | ||
uint8_t sharedSecret[KYBER768_SHAREDSECRETBYTES]; | ||
|
||
generate_random(randomness, 64); | ||
Libcrux_Kyber768_GenerateKeyPair(public_key, secret_key, randomness); | ||
|
||
generate_random(randomness, 32); | ||
Libcrux_Kyber768_Encapsulate( | ||
ciphertext, sharedSecret, &public_key, randomness); | ||
|
||
for (auto _ : state) { | ||
Libcrux_Kyber768_Decapsulate(sharedSecret, &ciphertext, &secret_key); | ||
} | ||
} | ||
|
||
BENCHMARK(kyber768_key_generation)->Setup(DoSetup); | ||
BENCHMARK(kyber768_encapsulation)->Setup(DoSetup); | ||
BENCHMARK(kyber768_decapsulation)->Setup(DoSetup); | ||
|
||
BENCHMARK_MAIN(); |
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
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,26 @@ | ||
/* | ||
This file was generated by KaRaMeL <https://github.com/FStarLang/karamel> | ||
KaRaMeL invocation: /Users/franziskus/repos/eurydice//eurydice ../libcrux_kyber.llbc | ||
F* version: d0aa54cf | ||
KaRaMeL version: 0eda808b | ||
*/ | ||
|
||
#ifndef __Eurydice_H | ||
#define __Eurydice_H | ||
|
||
#include "eurydice_glue.h" | ||
|
||
typedef struct core_ops_range_Range__size_t_s | ||
{ | ||
size_t start; | ||
size_t end; | ||
} | ||
core_ops_range_Range__size_t; | ||
|
||
extern uint8_t Eurydice_bitand_pv_u8(uint8_t *x, uint8_t y); | ||
|
||
extern uint8_t Eurydice_shr_pv_u8(uint8_t *x, int32_t y); | ||
|
||
|
||
#define __Eurydice_H_DEFINED | ||
#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
Oops, something went wrong.