diff options
Diffstat (limited to '')
-rw-r--r-- | src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h index 7fbe6f76a9..1235309f60 100644 --- a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h +++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mlkem_tests_util.h,v 1.4 2024/12/26 00:04:24 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_tests_util.h,v 1.7 2025/05/20 00:33:41 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> | 3 | * Copyright (c) 2024 Bob Beck <beck@obtuse.com> |
4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> |
@@ -30,13 +30,13 @@ | |||
30 | int compare_data(const uint8_t *want, const uint8_t *got, size_t len, | 30 | int compare_data(const uint8_t *want, const uint8_t *got, size_t len, |
31 | const char *msg); | 31 | const char *msg); |
32 | 32 | ||
33 | int mlkem768_encode_private_key(const void *priv, uint8_t **out_buf, | 33 | int mlkem768_marshal_private_key(const void *priv, uint8_t **out_buf, |
34 | size_t *out_len); | 34 | size_t *out_len); |
35 | int mlkem768_encode_public_key(const void *pub, uint8_t **out_buf, | 35 | int mlkem768_marshal_public_key(const void *pub, uint8_t **out_buf, |
36 | size_t *out_len); | 36 | size_t *out_len); |
37 | int mlkem1024_encode_private_key(const void *priv, uint8_t **out_buf, | 37 | int mlkem1024_marshal_private_key(const void *priv, uint8_t **out_buf, |
38 | size_t *out_len); | 38 | size_t *out_len); |
39 | int mlkem1024_encode_public_key(const void *pub, uint8_t **out_buf, | 39 | int mlkem1024_marshal_public_key(const void *pub, uint8_t **out_buf, |
40 | size_t *out_len); | 40 | size_t *out_len); |
41 | 41 | ||
42 | int mlkem768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 42 | int mlkem768_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], |
@@ -46,12 +46,12 @@ void mlkem768_encap(uint8_t *out_ciphertext, | |||
46 | void mlkem768_encap_external_entropy(uint8_t *out_ciphertext, | 46 | void mlkem768_encap_external_entropy(uint8_t *out_ciphertext, |
47 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, | 47 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, |
48 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | 48 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); |
49 | void mlkem768_generate_key(uint8_t *out_encoded_public_key, | 49 | int mlkem768_generate_key(uint8_t *out_encoded_public_key, |
50 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); | 50 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); |
51 | void mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key, | 51 | int mlkem768_generate_key_external_entropy(uint8_t *out_encoded_public_key, |
52 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); | 52 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); |
53 | int mlkem768_parse_private_key(void *priv, CBS *private_key_cbs); | 53 | int mlkem768_parse_private_key(void *priv, const uint8_t *in, size_t in_len); |
54 | int mlkem768_parse_public_key(void *pub, CBS *in); | 54 | int mlkem768_parse_public_key(void *pub, const uint8_t *in, size_t in_len); |
55 | void mlkem768_public_from_private(void *out_public_key, const void *private_key); | 55 | void mlkem768_public_from_private(void *out_public_key, const void *private_key); |
56 | 56 | ||
57 | int mlkem1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], | 57 | int mlkem1024_decap(uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], |
@@ -61,16 +61,16 @@ void mlkem1024_encap(uint8_t *out_ciphertext, | |||
61 | void mlkem1024_encap_external_entropy(uint8_t *out_ciphertext, | 61 | void mlkem1024_encap_external_entropy(uint8_t *out_ciphertext, |
62 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, | 62 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_BYTES], const void *pub, |
63 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | 63 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); |
64 | void mlkem1024_generate_key(uint8_t *out_encoded_public_key, | 64 | int mlkem1024_generate_key(uint8_t *out_encoded_public_key, |
65 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); | 65 | uint8_t optional_out_seed[MLKEM_SEED_BYTES], void *out_private_key); |
66 | void mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key, | 66 | int mlkem1024_generate_key_external_entropy(uint8_t *out_encoded_public_key, |
67 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); | 67 | void *out_private_key, const uint8_t entropy[MLKEM_SEED_BYTES]); |
68 | int mlkem1024_parse_private_key(void *priv, CBS *private_key_cbs); | 68 | int mlkem1024_parse_private_key(void *priv, const uint8_t *in, size_t in_len); |
69 | int mlkem1024_parse_public_key(void *pub, CBS *in); | 69 | int mlkem1024_parse_public_key(void *pub, const uint8_t *in, size_t in_len); |
70 | void mlkem1024_public_from_private(void *out_public_key, const void *private_key); | 70 | void mlkem1024_public_from_private(void *out_public_key, const void *private_key); |
71 | 71 | ||
72 | typedef int (*mlkem_encode_private_key_fn)(const void *, uint8_t **, size_t *); | 72 | typedef int (*mlkem_marshal_private_key_fn)(const void *, uint8_t **, size_t *); |
73 | typedef int (*mlkem_encode_public_key_fn)(const void *, uint8_t **, size_t *); | 73 | typedef int (*mlkem_marshal_public_key_fn)(const void *, uint8_t **, size_t *); |
74 | typedef int (*mlkem_decap_fn)(uint8_t [MLKEM_SHARED_SECRET_BYTES], | 74 | typedef int (*mlkem_decap_fn)(uint8_t [MLKEM_SHARED_SECRET_BYTES], |
75 | const uint8_t *, size_t, const void *); | 75 | const uint8_t *, size_t, const void *); |
76 | typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES], | 76 | typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES], |
@@ -78,11 +78,11 @@ typedef void (*mlkem_encap_fn)(uint8_t *, uint8_t [MLKEM_SHARED_SECRET_BYTES], | |||
78 | typedef void (*mlkem_encap_external_entropy_fn)(uint8_t *, | 78 | typedef void (*mlkem_encap_external_entropy_fn)(uint8_t *, |
79 | uint8_t [MLKEM_SHARED_SECRET_BYTES], const void *, | 79 | uint8_t [MLKEM_SHARED_SECRET_BYTES], const void *, |
80 | const uint8_t [MLKEM_ENCAP_ENTROPY]); | 80 | const uint8_t [MLKEM_ENCAP_ENTROPY]); |
81 | typedef void (*mlkem_generate_key_fn)(uint8_t *, uint8_t *, void *); | 81 | typedef int (*mlkem_generate_key_fn)(uint8_t *, uint8_t *, void *); |
82 | typedef void (*mlkem_generate_key_external_entropy_fn)(uint8_t *, void *, | 82 | typedef int (*mlkem_generate_key_external_entropy_fn)(uint8_t *, void *, |
83 | const uint8_t [MLKEM_SEED_BYTES]); | 83 | const uint8_t [MLKEM_SEED_BYTES]); |
84 | typedef int (*mlkem_parse_private_key_fn)(void *, CBS *); | 84 | typedef int (*mlkem_parse_private_key_fn)(void *, const uint8_t *, size_t); |
85 | typedef int (*mlkem_parse_public_key_fn)(void *, CBS *); | 85 | typedef int (*mlkem_parse_public_key_fn)(void *, const uint8_t *, size_t); |
86 | typedef void (*mlkem_public_from_private_fn)(void *out_public_key, | 86 | typedef void (*mlkem_public_from_private_fn)(void *out_public_key, |
87 | const void *private_key); | 87 | const void *private_key); |
88 | 88 | ||