Skip to content

Commit

Permalink
[CI] update code
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacl Bot committed Jan 9, 2025
1 parent 05c3d8f commit 2beb470
Show file tree
Hide file tree
Showing 170 changed files with 9,323 additions and 4,984 deletions.
382 changes: 242 additions & 140 deletions include/Hacl_Bignum32.h

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions include/Hacl_HMAC.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,28 @@ extern "C" {
#include "krml/lowstar_endianness.h"
#include "krml/internal/target.h"

#include "Hacl_Streaming_Types.h"
#include "Hacl_Krmllib.h"
#include "Hacl_Hash_SHA3.h"
#include "Hacl_Hash_SHA2.h"
#include "Hacl_Hash_Blake2s.h"
#include "Hacl_Hash_Blake2b.h"

/**
Write the HMAC-MD5 MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 64 byte.
`dst` must point to 16 bytes of memory.
*/
void
Hacl_HMAC_compute_md5(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
);

/**
Write the HMAC-SHA-1 MAC of a message (`data`) by using a key (`key`) into `dst`.
Expand All @@ -55,6 +72,21 @@ Hacl_HMAC_compute_sha1(
uint32_t data_len
);

/**
Write the HMAC-SHA-2-224 MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 64 bytes.
`dst` must point to 28 bytes of memory.
*/
void
Hacl_HMAC_compute_sha2_224(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
);

/**
Write the HMAC-SHA-2-256 MAC of a message (`data`) by using a key (`key`) into `dst`.
Expand Down Expand Up @@ -100,6 +132,66 @@ Hacl_HMAC_compute_sha2_512(
uint32_t data_len
);

/**
Write the HMAC-SHA-3-224 MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 144 bytes.
`dst` must point to 28 bytes of memory.
*/
void
Hacl_HMAC_compute_sha3_224(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
);

/**
Write the HMAC-SHA-3-256 MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 136 bytes.
`dst` must point to 32 bytes of memory.
*/
void
Hacl_HMAC_compute_sha3_256(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
);

/**
Write the HMAC-SHA-3-384 MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 104 bytes.
`dst` must point to 48 bytes of memory.
*/
void
Hacl_HMAC_compute_sha3_384(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
);

/**
Write the HMAC-SHA-3-512 MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 72 bytes.
`dst` must point to 64 bytes of memory.
*/
void
Hacl_HMAC_compute_sha3_512(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
);

/**
Write the HMAC-BLAKE2s MAC of a message (`data`) by using a key (`key`) into `dst`.
Expand Down
1 change: 1 addition & 0 deletions include/Hacl_HPKE_P256_CP128_SHA256.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern "C" {
#include "krml/lowstar_endianness.h"
#include "krml/internal/target.h"

#include "Hacl_P256.h"
#include "Hacl_HPKE_Interface_Hacl_Impl_HPKE_Hacl_Meta_HPKE.h"
#include "Hacl_HKDF.h"
#include "Hacl_AEAD_Chacha20Poly1305_Simd128.h"
Expand Down
1 change: 1 addition & 0 deletions include/Hacl_HPKE_P256_CP256_SHA256.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern "C" {
#include "krml/lowstar_endianness.h"
#include "krml/internal/target.h"

#include "Hacl_P256.h"
#include "Hacl_HPKE_Interface_Hacl_Impl_HPKE_Hacl_Meta_HPKE.h"
#include "Hacl_HKDF.h"
#include "Hacl_AEAD_Chacha20Poly1305_Simd256.h"
Expand Down
1 change: 1 addition & 0 deletions include/Hacl_HPKE_P256_CP32_SHA256.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern "C" {
#include "krml/lowstar_endianness.h"
#include "krml/internal/target.h"

#include "Hacl_P256.h"
#include "Hacl_HPKE_Interface_Hacl_Impl_HPKE_Hacl_Meta_HPKE.h"
#include "Hacl_HKDF.h"
#include "Hacl_AEAD_Chacha20Poly1305.h"
Expand Down
43 changes: 35 additions & 8 deletions include/Hacl_Hash_Blake2b.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ typedef struct Hacl_Hash_Blake2b_blake2_params_s
}
Hacl_Hash_Blake2b_blake2_params;

typedef struct Hacl_Hash_Blake2b_index_s
{
uint8_t key_length;
uint8_t digest_length;
bool last_node;
}
Hacl_Hash_Blake2b_index;

#define HACL_HASH_BLAKE2B_BLOCK_BYTES (128U)

#define HACL_HASH_BLAKE2B_OUT_BYTES (64U)

#define HACL_HASH_BLAKE2B_KEY_BYTES (64U)

#define HACL_HASH_BLAKE2B_SALT_BYTES (16U)

#define HACL_HASH_BLAKE2B_PERSONAL_BYTES (16U)

typedef struct K____uint64_t___uint64_t__s
{
uint64_t *fst;
Expand All @@ -64,7 +82,8 @@ typedef struct Hacl_Hash_Blake2b_block_state_t_s
{
uint8_t fst;
uint8_t snd;
K____uint64_t___uint64_t_ thd;
bool thd;
K____uint64_t___uint64_t_ f3;
}
Hacl_Hash_Blake2b_block_state_t;

Expand Down Expand Up @@ -92,7 +111,11 @@ The caller must satisfy the following requirements.
*/
Hacl_Hash_Blake2b_state_t
*Hacl_Hash_Blake2b_malloc_with_params_and_key(Hacl_Hash_Blake2b_blake2_params *p, uint8_t *k);
*Hacl_Hash_Blake2b_malloc_with_params_and_key(
Hacl_Hash_Blake2b_blake2_params *p,
bool last_node,
uint8_t *k
);

/**
Specialized allocation function that picks default values for all
Expand All @@ -116,7 +139,7 @@ Hacl_Hash_Blake2b_state_t *Hacl_Hash_Blake2b_malloc(void);

/**
General-purpose re-initialization function with parameters and
key. You cannot change digest_length or key_length, meaning those values in
key. You cannot change digest_length, key_length, or last_node, meaning those values in
the parameters object must be the same as originally decided via one of the
malloc functions. All other values of the parameter can be changed. The behavior
is unspecified if you violate this precondition.
Expand Down Expand Up @@ -159,10 +182,14 @@ at least `digest_length` bytes, where `digest_length` was determined by your
choice of `malloc` function. Concretely, if you used `malloc` or
`malloc_with_key`, then the expected length is 32 for S, or 64 for B (default
digest length). If you used `malloc_with_params_and_key`, then the expected
length is whatever you chose for the `digest_length` field of your
parameters.
length is whatever you chose for the `digest_length` field of your parameters.
For convenience, this function returns `digest_length`. When in doubt, callers
can pass an array of size HACL_BLAKE2B_32_OUT_BYTES, then use the return value
to see how many bytes were actually written.
*/
void Hacl_Hash_Blake2b_digest(Hacl_Hash_Blake2b_state_t *state, uint8_t *output);
uint8_t Hacl_Hash_Blake2b_digest(Hacl_Hash_Blake2b_state_t *s, uint8_t *dst);

Hacl_Hash_Blake2b_index Hacl_Hash_Blake2b_info(Hacl_Hash_Blake2b_state_t *s);

/**
Free state function when there is no key
Expand Down Expand Up @@ -198,10 +225,10 @@ Hacl_Hash_Blake2b_hash_with_key(
Write the BLAKE2b digest of message `input` using key `key` and
parameters `params` into `output`. The `key` array must be of length
`params.key_length`. The `output` array must be of length
`params.digest_length`.
`params.digest_length`.
*/
void
Hacl_Hash_Blake2b_hash_with_key_and_paramas(
Hacl_Hash_Blake2b_hash_with_key_and_params(
uint8_t *output,
uint8_t *input,
uint32_t input_len,
Expand Down
Loading

0 comments on commit 2beb470

Please sign in to comment.