Skip to content

Commit

Permalink
BoringSSL C code refresh, tests, benches
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikbhargavan committed Jul 15, 2024
1 parent 29003a0 commit 7519ca7
Show file tree
Hide file tree
Showing 8 changed files with 1,458 additions and 1,472 deletions.
2 changes: 1 addition & 1 deletion libcrux-ml-kem/cg/code_gen.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This code was generated with the following tools:
Charon: 0f1b5e50fa4e96ed9e650d8334e1afbf2bf319b1
Eurydice: e888878c640c71e2cd0456ed51d70c9b054470e6
Karamel: f13006e27305a378b68d3686425a096e9bc05f86
Karamel: 65aab550cf3ba36d52ae6ad1ad962bb573406395
F*: 07b5a2101c86f81d9a2d31ca68eb855ee361bacc
6 changes: 6 additions & 0 deletions libcrux-ml-kem/cg/eurydice_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ static inline uint64_t core_num__u64_9__from_le_bytes(uint8_t buf[8]) {
return v;
}

static inline uint32_t core_num__u32_8__from_le_bytes(uint8_t buf[4]) {
uint32_t v;
memcpy(&v, buf, sizeof(v));
return v;
}

static inline uint32_t core_num__u8_6__count_ones(uint8_t x0) {
#ifdef _MSC_VER
return __popcnt(x0);
Expand Down
28 changes: 27 additions & 1 deletion libcrux-ml-kem/cg/libcrux_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This file was generated by KaRaMeL <https://github.com/FStarLang/karamel>
KaRaMeL invocation: /home/karthik/eurydice/eurydice --config ../cg.yaml
-funroll-loops 0 ../../libcrux_ml_kem.llbc ../../libcrux_sha3.llbc F* version:
07b5a210 KaRaMeL version: f13006e2
07b5a210 KaRaMeL version: 65aab550
*/

#ifndef __libcrux_core_H
Expand Down Expand Up @@ -37,6 +37,8 @@ static inline uint16_t core_num__u16_7__wrapping_add(uint16_t x0, uint16_t x1);

#define CORE_NUM__U32_8__BITS (32U)

static inline uint32_t core_num__u32_8__from_le_bytes(uint8_t x0[4U]);

static inline uint64_t core_num__u64_9__from_le_bytes(uint8_t x0[8U]);

static inline void core_num__u64_9__to_le_bytes(uint64_t x0, uint8_t x1[8U]);
Expand Down Expand Up @@ -314,6 +316,30 @@ static KRML_MUSTINLINE void libcrux_ml_kem_utils_into_padded_array___64size_t(
memcpy(ret, out, (size_t)64U * sizeof(uint8_t));
}

typedef struct
core_result_Result__uint8_t_4size_t__core_array_TryFromSliceError_s {
core_result_Result__uint8_t_24size_t__core_array_TryFromSliceError_tags tag;
union {
uint8_t case_Ok[4U];
core_array_TryFromSliceError case_Err;
} val;
} core_result_Result__uint8_t_4size_t__core_array_TryFromSliceError;

static inline void
core_result__core__result__Result_T__E___unwrap__uint8_t_4size_t__core_array_TryFromSliceError(
core_result_Result__uint8_t_4size_t__core_array_TryFromSliceError self,
uint8_t ret[4U]) {
if (self.tag == core_result_Ok) {
uint8_t f0[4U];
memcpy(f0, self.val.case_Ok, (size_t)4U * sizeof(uint8_t));
memcpy(ret, f0, (size_t)4U * sizeof(uint8_t));
} else {
KRML_HOST_EPRINTF("KaRaMeL abort at %s:%d\n%s\n", __FILE__, __LINE__,
"unwrap not Ok");
KRML_HOST_EXIT(255U);
}
}

typedef struct
core_result_Result__int16_t_16size_t__core_array_TryFromSliceError_s {
core_result_Result__uint8_t_24size_t__core_array_TryFromSliceError_tags tag;
Expand Down
2 changes: 1 addition & 1 deletion libcrux-ml-kem/cg/libcrux_ct_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This file was generated by KaRaMeL <https://github.com/FStarLang/karamel>
KaRaMeL invocation: /home/karthik/eurydice/eurydice --config ../cg.yaml
-funroll-loops 0 ../../libcrux_ml_kem.llbc ../../libcrux_sha3.llbc F* version:
07b5a210 KaRaMeL version: f13006e2
07b5a210 KaRaMeL version: 65aab550
*/

#ifndef __libcrux_ct_ops_H
Expand Down
Loading

0 comments on commit 7519ca7

Please sign in to comment.