summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/mlkem/mlkem.h
diff options
context:
space:
mode:
authortb <>2026-01-01 12:47:52 +0000
committertb <>2026-01-01 12:47:52 +0000
commit10bebbca92ef87af97bc15c6337afbbe050bb96e (patch)
treed3acb74022a43d2d8b4ffdd98d504717b91d7139 /src/lib/libcrypto/mlkem/mlkem.h
parent632157bcbfb0f5031f0b5a0f3f3277c98c5cc846 (diff)
downloadopenbsd-10bebbca92ef87af97bc15c6337afbbe050bb96e.tar.gz
openbsd-10bebbca92ef87af97bc15c6337afbbe050bb96e.tar.bz2
openbsd-10bebbca92ef87af97bc15c6337afbbe050bb96e.zip
Rename RANK{768,1024} to MLKEM{768,1024}_RANK
RANK768 and RANK1024 are awfully short and generic names for public constants. Before we make it worse with similarly named constants for ML-DSA, let's fix this. This follows the naming convention used by the other macros in the mlkem code. ok kenjiro jsing
Diffstat (limited to 'src/lib/libcrypto/mlkem/mlkem.h')
-rw-r--r--src/lib/libcrypto/mlkem/mlkem.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/mlkem/mlkem.h b/src/lib/libcrypto/mlkem/mlkem.h
index dac3cf24de..17978782a7 100644
--- a/src/lib/libcrypto/mlkem/mlkem.h
+++ b/src/lib/libcrypto/mlkem/mlkem.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem.h,v 1.8 2025/08/19 21:37:08 tb Exp $ */ 1/* $OpenBSD: mlkem.h,v 1.9 2026/01/01 12:47:52 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2025 Bob Beck <beck@obtuse.com> 3 * Copyright (c) 2025 Bob Beck <beck@obtuse.com>
4 * 4 *
@@ -29,8 +29,8 @@ extern "C" {
29 * ML-KEM constants 29 * ML-KEM constants
30 */ 30 */
31 31
32#define RANK768 3 32#define MLKEM768_RANK 3
33#define RANK1024 4 33#define MLKEM1024_RANK 4
34 34
35/* 35/*
36 * ML-KEM keys 36 * ML-KEM keys
@@ -41,8 +41,8 @@ typedef struct MLKEM_public_key_st MLKEM_public_key;
41 41
42/* 42/*
43 * MLKEM_private_key_new allocates a new uninitialized ML-KEM private key for 43 * MLKEM_private_key_new allocates a new uninitialized ML-KEM private key for
44 * |rank|, which must be RANK768 or RANK1024. It returns a pointer to an 44 * |rank|, which must be MLKEM768_RANK or MLKEM1024_RANK. It returns a pointer
45 * allocated structure suitable for holding a generated private key of the 45 * to an allocated structure suitable for holding a generated private key of the
46 * corresponding rank on success, NULL is returned on failure. The caller is 46 * corresponding rank on success, NULL is returned on failure. The caller is
47 * responsible for deallocating the resulting key with |MLKEM_private_key_free|. 47 * responsible for deallocating the resulting key with |MLKEM_private_key_free|.
48 */ 48 */
@@ -71,8 +71,8 @@ size_t MLKEM_private_key_ciphertext_length(const MLKEM_private_key *key);
71 71
72/* 72/*
73 * MLKEM_public_key_new allocates a new uninitialized ML-KEM public key for 73 * MLKEM_public_key_new allocates a new uninitialized ML-KEM public key for
74 * |rank|, which must be RANK768 or RANK1024. It returns a pointer to an 74 * |rank|, which must be MLKEM768_RANK or MLKEM1024_RANK. It returns a pointer
75 * allocated structure suitable for holding a generated public key of the 75 * to an allocated structure suitable for holding a generated public key of the
76 * corresponding rank on success, NULL is returned on failure. The caller is 76 * corresponding rank on success, NULL is returned on failure. The caller is
77 * responsible for deallocating the resulting key with |MLKEM_public_key_free|. 77 * responsible for deallocating the resulting key with |MLKEM_public_key_free|.
78 */ 78 */
@@ -94,8 +94,8 @@ size_t MLKEM_public_key_encoded_length(const MLKEM_public_key *key);
94 94
95/* 95/*
96 * MLKEM_public_key_cipertext_length returns the number of bytes produced as the 96 * MLKEM_public_key_cipertext_length returns the number of bytes produced as the
97 * ciphertext when encrypting a shared secret with |key| using |MLKEM_encap|. Zero 97 * ciphertext when encrypting a shared secret with |key| using |MLKEM_encap|.
98 * is returned if |key| is NULL or has an invalid rank. 98 * Zero is returned if |key| is NULL or has an invalid rank.
99 */ 99 */
100size_t MLKEM_public_key_ciphertext_length(const MLKEM_public_key *key); 100size_t MLKEM_public_key_ciphertext_length(const MLKEM_public_key *key);
101 101