Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Dec 1, 2023
2 parents c4310ac + 484a64f commit 3f8e5a4
Show file tree
Hide file tree
Showing 510 changed files with 52,892 additions and 61,938 deletions.
8 changes: 6 additions & 2 deletions .clabot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"addressxception": "InfernoRed",
"bkmgit": "",
"mamonet": "",
"emillon": ""
"emillon": "",
"protz": "",
"ma-ilsi": ""
},
"contributors": [
"franziskuskiefer",
Expand All @@ -21,6 +23,8 @@
"bkmgit",
"mgstoyanov",
"mamonet",
"emillon"
"emillon",
"protz",
"ma-ilsi"
]
}
4 changes: 3 additions & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
- uses: actions/checkout@v3

- name: Setup
run: sudo apt-get install ninja-build nodejs
run: |
sudo apt-get update
sudo apt-get install ninja-build nodejs
- name: Build JS bindings
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
matrix:
os:
- macos-latest
- ubuntu-latest
# - ubuntu-latest Disabling Ubuntu for now as long as bindgen is broken
- windows-latest

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
bits: [32, 64]
os:
- macos-latest
- ubuntu-latest
# - ubuntu-latest disable for now
- windows-latest
exclude:
- bits: 32
Expand All @@ -122,7 +122,7 @@ jobs:
- if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install ninja-build gcc-multilib g++-multilib
sudo apt-get install ninja-build gcc-multilib g++-multilib clang-15
rustup target add i686-unknown-linux-gnu
- name: Setup | Developer Command Prompt (x86)
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,9 @@ if(NOT MSVC)
# -pedantic
# -Wconversion
# -Wsign-conversion
# -Werror=gcc-compat
$<$<CONFIG:DEBUG>:-g>
$<$<CONFIG:DEBUG>:-Og>
$<$<CONFIG:RELEASE>:-O3>
# $<$<CONFIG:RELEASE>:-g>
# $<$<CONFIG:RELEASE>:-Wno-deprecated-declarations>
)
endif()

Expand Down Expand Up @@ -337,6 +334,9 @@ configure_file(config/Config.h.in config.h)
# Now combine everything into the hacl library
# # Dynamic library
add_library(hacl SHARED ${SOURCES_std} ${VALE_OBJECTS})
if(NOT MSVC)
target_compile_options(hacl PRIVATE -Wsign-conversion -Wconversion -Wall -Wextra -pedantic)
endif()

if(TOOLCHAIN_CAN_COMPILE_VEC128 AND HACL_VEC128_O)
add_dependencies(hacl hacl_vec128)
Expand Down
137 changes: 52 additions & 85 deletions benchmarks/blake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
*/

#include "EverCrypt_Hash.h"
#include "Hacl_Hash_Blake2.h"
#include "Hacl_Streaming_Blake2.h"
#include "Hacl_Hash_Blake2b.h"
#include "Hacl_Hash_Blake2s.h"

#include "util.h"

#ifdef HACL_CAN_COMPILE_VEC128
#include "Hacl_Hash_Blake2s_128.h"
#include "Hacl_Streaming_Blake2s_128.h"
#include "Hacl_Hash_Blake2s_Simd128.h"
#endif

#ifdef HACL_CAN_COMPILE_VEC256
#include "Hacl_Hash_Blake2b_256.h"
#include "Hacl_Streaming_Blake2b_256.h"
#include "Hacl_Hash_Blake2b_Simd256.h"
#endif

#include "blake2.h"
Expand Down Expand Up @@ -47,12 +45,9 @@ HACL_blake2b_32_oneshot(benchmark::State& state)
bytes input(state.range(0), 0xAB);

for (auto _ : state) {
Hacl_Blake2b_32_blake2b(digest2b.size(),
digest2b.data(),
input.size(),
(uint8_t*)input.data(),
0,
NULL);
Hacl_Hash_Blake2b_hash_with_key(
digest2b.data(), digest2b.size(), (uint8_t*)input.data(), input.size(),
NULL, 0);
}
}

Expand All @@ -70,12 +65,9 @@ HACL_blake2b_vec256_oneshot(benchmark::State& state)
bytes input(state.range(0), 0xAB);

for (auto _ : state) {
Hacl_Blake2b_256_blake2b(digest2b.size(),
digest2b.data(),
input.size(),
(uint8_t*)input.data(),
0,
NULL);
Hacl_Hash_Blake2b_Simd256_hash_with_key(
digest2b.data(), digest2b.size(), (uint8_t*)input.data(), input.size(),
NULL, 0);
}
}

Expand All @@ -89,9 +81,7 @@ EverCrypt_blake2b_oneshot(benchmark::State& state)

for (auto _ : state) {
EverCrypt_Hash_Incremental_hash(Spec_Hash_Definitions_Blake2B,
digest2b.data(),
input.data(),
input.size());
digest2b.data(), input.data(), input.size());
}
}

Expand All @@ -113,12 +103,9 @@ static void
HACL_blake2b_32_oneshot_keyed(benchmark::State& state)
{
for (auto _ : state) {
Hacl_Blake2b_32_blake2b(digest2b.size(),
digest2b.data(),
input.size(),
(uint8_t*)input.data(),
key.size(),
key.data());
Hacl_Hash_Blake2b_hash_with_key(
digest2b.data(), digest2b.size(), (uint8_t*)input.data(), input.size(),
key.data(), key.size());
}
}

Expand All @@ -134,12 +121,9 @@ HACL_blake2b_vec256_oneshot_keyed(benchmark::State& state)
}

for (auto _ : state) {
Hacl_Blake2b_256_blake2b(digest2b.size(),
digest2b.data(),
input.size(),
(uint8_t*)input.data(),
key.size(),
key.data());
Hacl_Hash_Blake2b_Simd256_hash_with_key(
digest2b.data(), digest2b.size(), (uint8_t*)input.data(), input.size(),
key.data(), key.size());
}
}

Expand Down Expand Up @@ -175,8 +159,8 @@ HACL_blake2s_32_oneshot(benchmark::State& state)
bytes input(state.range(0), 0xAB);

for (auto _ : state) {
Hacl_Blake2s_32_blake2s(
digest2s.size(), digest2s.data(), input.size(), input.data(), 0, NULL);
Hacl_Hash_Blake2s_hash_with_key(
digest2s.data(), digest2s.size(), input.data(), input.size(), NULL, 0);
}
}

Expand All @@ -194,8 +178,8 @@ HACL_blake2s_vec128_oneshot(benchmark::State& state)
bytes input(state.range(0), 0xAB);

for (auto _ : state) {
Hacl_Blake2s_128_blake2s(
digest2s.size(), digest2s.data(), input.size(), input.data(), 0, NULL);
Hacl_Hash_Blake2s_Simd128_hash_with_key(
digest2s.data(), digest2s.size(), input.data(), input.size(), NULL, 0);
}
}

Expand All @@ -209,9 +193,7 @@ EverCrypt_blake2s_oneshot(benchmark::State& state)

for (auto _ : state) {
EverCrypt_Hash_Incremental_hash(Spec_Hash_Definitions_Blake2S,
digest2s.data(),
input.data(),
input.size());
digest2s.data(), input.data(), input.size());
}
}

Expand All @@ -233,12 +215,9 @@ static void
HACL_blake2s_32_oneshot_keyed(benchmark::State& state)
{
for (auto _ : state) {
Hacl_Blake2s_32_blake2s(digest2s.size(),
digest2s.data(),
input.size(),
(uint8_t*)input.data(),
key.size(),
key.data());
Hacl_Hash_Blake2s_hash_with_key(
digest2s.data(), digest2s.size(), (uint8_t*)input.data(), input.size(),
key.data(), key.size());
}
}

Expand All @@ -254,12 +233,9 @@ HACL_blake2s_vec128_oneshot_keyed(benchmark::State& state)
}

for (auto _ : state) {
Hacl_Blake2s_128_blake2s(digest2s.size(),
digest2s.data(),
input.size(),
(uint8_t*)input.data(),
key.size(),
key.data());
Hacl_Hash_Blake2s_Simd128_hash_with_key(
digest2s.data(), digest2s.size(), (uint8_t*)input.data(), input.size(),
key.data(), key.size());
}
}

Expand Down Expand Up @@ -295,19 +271,18 @@ HACL_blake2b_32_streaming(benchmark::State& state)
uint8_t digest[HACL_HASH_BLAKE2B_DIGEST_LENGTH_MAX];

// Init
Hacl_Streaming_Blake2_blake2b_32_state_s* ctx =
Hacl_Streaming_Blake2_blake2b_32_no_key_create_in();
Hacl_Streaming_Blake2_blake2b_32_no_key_init(ctx);
Hacl_Hash_Blake2b_state_t* ctx =
Hacl_Hash_Blake2b_malloc();

// Update
for (auto chunk : chunk(input, chunk_len)) {
Hacl_Streaming_Blake2_blake2b_32_no_key_update(
Hacl_Hash_Blake2b_update(
ctx, (uint8_t*)chunk.data(), chunk.size());
}

// Finish
Hacl_Streaming_Blake2_blake2b_32_no_key_finish(ctx, digest);
Hacl_Streaming_Blake2_blake2b_32_no_key_free(ctx);
Hacl_Hash_Blake2b_digest(ctx, digest);
Hacl_Hash_Blake2b_free(ctx);
}
}

Expand Down Expand Up @@ -348,19 +323,18 @@ HACL_blake2b_vec256_streaming(benchmark::State& state)
uint8_t digest[HACL_HASH_BLAKE2B_DIGEST_LENGTH_MAX];

// Init
Hacl_Streaming_Blake2b_256_blake2b_256_state_s* ctx =
Hacl_Streaming_Blake2b_256_blake2b_256_no_key_create_in();
Hacl_Streaming_Blake2b_256_blake2b_256_no_key_init(ctx);
Hacl_Hash_Blake2b_Simd256_state_t* ctx =
Hacl_Hash_Blake2b_Simd256_malloc();

// Update
for (auto chunk : chunk(input, chunk_len)) {
Hacl_Streaming_Blake2b_256_blake2b_256_no_key_update(
Hacl_Hash_Blake2b_Simd256_update(
ctx, (uint8_t*)chunk.data(), chunk.size());
}

// Finish
Hacl_Streaming_Blake2b_256_blake2b_256_no_key_finish(ctx, digest);
Hacl_Streaming_Blake2b_256_blake2b_256_no_key_free(ctx);
Hacl_Hash_Blake2b_Simd256_digest(ctx, digest);
Hacl_Hash_Blake2b_Simd256_free(ctx);
}
}

Expand All @@ -374,17 +348,16 @@ EverCrypt_blake2b_streaming(benchmark::State& state)
uint8_t digest[HACL_HASH_BLAKE2B_DIGEST_LENGTH_MAX];

// Init
EverCrypt_Hash_Incremental_hash_state_s* ctx =
EverCrypt_Hash_Incremental_create_in(Spec_Hash_Definitions_Blake2B);
EverCrypt_Hash_Incremental_init(ctx);
EverCrypt_Hash_Incremental_state_t* ctx =
EverCrypt_Hash_Incremental_malloc(Spec_Hash_Definitions_Blake2B);

// Update
for (auto chunk : chunk(input, chunk_len)) {
EverCrypt_Hash_Incremental_update(ctx, chunk.data(), chunk.size());
}

// Finish
EverCrypt_Hash_Incremental_finish(ctx, digest);
EverCrypt_Hash_Incremental_digest(ctx, digest);
EverCrypt_Hash_Incremental_free(ctx);
}
}
Expand All @@ -411,19 +384,16 @@ HACL_blake2s_32_streaming(benchmark::State& state)
uint8_t digest[HACL_HASH_BLAKE2S_DIGEST_LENGTH_MAX];

// Init
Hacl_Streaming_Blake2_blake2s_32_state_s* ctx =
Hacl_Streaming_Blake2_blake2s_32_no_key_create_in();
Hacl_Streaming_Blake2_blake2s_32_no_key_init(ctx);
Hacl_Hash_Blake2s_state_t* ctx = Hacl_Hash_Blake2s_malloc();

// Update
for (auto chunk : chunk(input, chunk_len)) {
Hacl_Streaming_Blake2_blake2s_32_no_key_update(
ctx, (uint8_t*)chunk.data(), chunk.size());
Hacl_Hash_Blake2s_update(ctx, (uint8_t*)chunk.data(), chunk.size());
}

// Finish
Hacl_Streaming_Blake2_blake2s_32_no_key_finish(ctx, digest);
Hacl_Streaming_Blake2_blake2s_32_no_key_free(ctx);
Hacl_Hash_Blake2s_digest(ctx, digest);
Hacl_Hash_Blake2s_free(ctx);
}
}

Expand Down Expand Up @@ -464,19 +434,17 @@ HACL_blake2s_vec128_streaming(benchmark::State& state)
uint8_t digest[HACL_HASH_BLAKE2S_DIGEST_LENGTH_MAX];

// Init
Hacl_Streaming_Blake2s_128_blake2s_128_state_s* ctx =
Hacl_Streaming_Blake2s_128_blake2s_128_no_key_create_in();
Hacl_Streaming_Blake2s_128_blake2s_128_no_key_init(ctx);
Hacl_Hash_Blake2s_Simd128_state_t* ctx = Hacl_Hash_Blake2s_Simd128_malloc();

// Update
for (auto chunk : chunk(input, chunk_len)) {
Hacl_Streaming_Blake2s_128_blake2s_128_no_key_update(
Hacl_Hash_Blake2s_Simd128_update(
ctx, (uint8_t*)chunk.data(), chunk.size());
}

// Finish
Hacl_Streaming_Blake2s_128_blake2s_128_no_key_finish(ctx, digest);
Hacl_Streaming_Blake2s_128_blake2s_128_no_key_free(ctx);
Hacl_Hash_Blake2s_Simd128_digest(ctx, digest);
Hacl_Hash_Blake2s_Simd128_free(ctx);
}
}

Expand All @@ -490,17 +458,16 @@ EverCrypt_blake2s_streaming(benchmark::State& state)
uint8_t digest[HACL_HASH_BLAKE2S_DIGEST_LENGTH_MAX];

// Init
EverCrypt_Hash_Incremental_hash_state_s* ctx =
EverCrypt_Hash_Incremental_create_in(Spec_Hash_Definitions_Blake2S);
EverCrypt_Hash_Incremental_init(ctx);
EverCrypt_Hash_Incremental_state_t* ctx =
EverCrypt_Hash_Incremental_malloc(Spec_Hash_Definitions_Blake2S);

// Update
for (auto chunk : chunk(input, chunk_len)) {
EverCrypt_Hash_Incremental_update(ctx, chunk.data(), chunk.size());
}

// Finish
EverCrypt_Hash_Incremental_finish(ctx, digest);
EverCrypt_Hash_Incremental_digest(ctx, digest);
EverCrypt_Hash_Incremental_free(ctx);
}
}
Expand Down
Loading

0 comments on commit 3f8e5a4

Please sign in to comment.