diff options
| author | tb <> | 2026-01-18 08:58:31 +0000 |
|---|---|---|
| committer | tb <> | 2026-01-18 08:58:31 +0000 |
| commit | 8c2e30618ba07e5c076d4f6492f61fe7dea05412 (patch) | |
| tree | f35c74ff40142ea11b6d60d76ee01a14b327a9b6 /src/lib | |
| parent | 0b69c4a2b1ef8ad6b85503729d1bd0bc68541697 (diff) | |
| download | openbsd-8c2e30618ba07e5c076d4f6492f61fe7dea05412.tar.gz openbsd-8c2e30618ba07e5c076d4f6492f61fe7dea05412.tar.bz2 openbsd-8c2e30618ba07e5c076d4f6492f61fe7dea05412.zip | |
mlkem: fix mklem_{generate_key,encap}_external_entropy() declarations
The prototypes used sized arrays appropriate only for MLKEM768 while the
declarations used pointers. For some reason clang doesn't flag this but
gcc does. In any case it was wrong. The callers of these functions check
that they pass in the correct size. Which is weird but the mlkem directory
has an unbelievable amount of mess and bad code.
found by/ok jsing
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libcrypto/mlkem/mlkem_internal.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/mlkem/mlkem_internal.h b/src/lib/libcrypto/mlkem/mlkem_internal.h index a8b1a16359..42b5ba03b8 100644 --- a/src/lib/libcrypto/mlkem/mlkem_internal.h +++ b/src/lib/libcrypto/mlkem/mlkem_internal.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: mlkem_internal.h,v 1.13 2026/01/18 08:49:42 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_internal.h,v 1.14 2026/01/18 08:58:31 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023, Google Inc. | 3 | * Copyright (c) 2023, Google Inc. |
| 4 | * Copyright (c) 2025, Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2025, Bob Beck <beck@obtuse.com> |
| @@ -251,8 +251,7 @@ int mlkem_parse_private_key(const uint8_t *input, size_t input_len, | |||
| 251 | * regular callers should use the non-deterministic |MLKEM_generate_key| | 251 | * regular callers should use the non-deterministic |MLKEM_generate_key| |
| 252 | * directly. | 252 | * directly. |
| 253 | */ | 253 | */ |
| 254 | int mlkem_generate_key_external_entropy( | 254 | int mlkem_generate_key_external_entropy(uint8_t *out_encoded_public_key, |
| 255 | uint8_t out_encoded_public_key[MLKEM768_PUBLIC_KEY_BYTES], | ||
| 256 | MLKEM_private_key *out_private_key, | 255 | MLKEM_private_key *out_private_key, |
| 257 | const uint8_t entropy[MLKEM_SEED_LENGTH]); | 256 | const uint8_t entropy[MLKEM_SEED_LENGTH]); |
| 258 | 257 | ||
| @@ -271,8 +270,7 @@ int mlkem_marshal_private_key(const MLKEM_private_key *private_key, | |||
| 271 | * used for tests, regular callers should use the non-deterministic | 270 | * used for tests, regular callers should use the non-deterministic |
| 272 | * |MLKEM_encap| directly. | 271 | * |MLKEM_encap| directly. |
| 273 | */ | 272 | */ |
| 274 | void mlkem_encap_external_entropy( | 273 | void mlkem_encap_external_entropy(uint8_t *out_ciphertext, |
| 275 | uint8_t out_ciphertext[MLKEM768_CIPHERTEXT_BYTES], | ||
| 276 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_LENGTH], | 274 | uint8_t out_shared_secret[MLKEM_SHARED_SECRET_LENGTH], |
| 277 | const MLKEM_public_key *public_key, | 275 | const MLKEM_public_key *public_key, |
| 278 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); | 276 | const uint8_t entropy[MLKEM_ENCAP_ENTROPY]); |
