diff options
author | tb <> | 2025-05-03 08:39:33 +0000 |
---|---|---|
committer | tb <> | 2025-05-03 08:39:33 +0000 |
commit | d7c36115d6ed031ea4eccfbd69081d60b153f227 (patch) | |
tree | 59e2a62ae3da13074a241ca2ede421de3755f9f1 /src/lib/libcrypto/mlkem/mlkem1024.c | |
parent | 5a16a3614842f5f129efd2612731d55b1865c171 (diff) | |
download | openbsd-d7c36115d6ed031ea4eccfbd69081d60b153f227.tar.gz openbsd-d7c36115d6ed031ea4eccfbd69081d60b153f227.tar.bz2 openbsd-d7c36115d6ed031ea4eccfbd69081d60b153f227.zip |
CTASSERT that internal pub/priv keys match the sizes exposed in mlkem.h
This will need reworking (especially deduplicating) anyway, but it doesn't
hurt now.
From Kenjiro Nakayama
Diffstat (limited to 'src/lib/libcrypto/mlkem/mlkem1024.c')
-rw-r--r-- | src/lib/libcrypto/mlkem/mlkem1024.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/libcrypto/mlkem/mlkem1024.c b/src/lib/libcrypto/mlkem/mlkem1024.c index f6fccdf6a8..ce6f26e66c 100644 --- a/src/lib/libcrypto/mlkem/mlkem1024.c +++ b/src/lib/libcrypto/mlkem/mlkem1024.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: mlkem1024.c,v 1.6 2025/01/03 08:19:24 tb Exp $ */ | 1 | /* $OpenBSD: mlkem1024.c,v 1.7 2025/05/03 08:39:33 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2024, Google Inc. | 3 | * Copyright (c) 2024, Google Inc. |
4 | * Copyright (c) 2024, Bob Beck <beck@obtuse.com> | 4 | * Copyright (c) 2024, Bob Beck <beck@obtuse.com> |
@@ -793,6 +793,8 @@ struct public_key { | |||
793 | matrix m; | 793 | matrix m; |
794 | }; | 794 | }; |
795 | 795 | ||
796 | CTASSERT(sizeof(struct MLKEM1024_public_key) == sizeof(struct public_key)); | ||
797 | |||
796 | static struct public_key * | 798 | static struct public_key * |
797 | public_key_1024_from_external(const struct MLKEM1024_public_key *external) | 799 | public_key_1024_from_external(const struct MLKEM1024_public_key *external) |
798 | { | 800 | { |
@@ -805,6 +807,8 @@ struct private_key { | |||
805 | uint8_t fo_failure_secret[32]; | 807 | uint8_t fo_failure_secret[32]; |
806 | }; | 808 | }; |
807 | 809 | ||
810 | CTASSERT(sizeof(struct MLKEM1024_private_key) == sizeof(struct private_key)); | ||
811 | |||
808 | static struct private_key * | 812 | static struct private_key * |
809 | private_key_1024_from_external(const struct MLKEM1024_private_key *external) | 813 | private_key_1024_from_external(const struct MLKEM1024_private_key *external) |
810 | { | 814 | { |