summaryrefslogtreecommitdiff
path: root/src/regress/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libcrypto')
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c4
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_tests.c4
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c21
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h4
-rw-r--r--src/regress/lib/libcrypto/mlkem/mlkem_unittest.c4
5 files changed, 11 insertions, 26 deletions
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c
index a8495f55e3..e0fd9ca241 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_iteration_tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_iteration_tests.c,v 1.3 2025/05/19 06:47:40 beck Exp $ */ 1/* $OpenBSD: mlkem_iteration_tests.c,v 1.4 2025/05/19 07:53:00 beck 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>
@@ -185,7 +185,7 @@ main(void)
185 .priv = &priv768, 185 .priv = &priv768,
186 .pub = &pub768, 186 .pub = &pub768,
187 .encap_external_entropy = mlkem768_encap_external_entropy, 187 .encap_external_entropy = mlkem768_encap_external_entropy,
188 .encode_private_key = mlkem768_encode_private_key, 188 .encode_private_key = mlkem768_marshal_private_key,
189 .generate_key_external_entropy = 189 .generate_key_external_entropy =
190 mlkem768_generate_key_external_entropy, 190 mlkem768_generate_key_external_entropy,
191 .public_from_private = mlkem768_public_from_private, 191 .public_from_private = mlkem768_public_from_private,
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c
index a4e7208c76..84b71aebb0 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_tests.c,v 1.4 2025/05/19 06:47:40 beck Exp $ */ 1/* $OpenBSD: mlkem_tests.c,v 1.5 2025/05/19 07:53:00 beck Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Google Inc. 3 * Copyright (c) 2024 Google Inc.
4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2024 Theo Buehler <tb@openbsd.org>
@@ -662,7 +662,7 @@ mlkem_keygen_tests(const char *fn, size_t size, enum test_type test_type)
662 .generate_key_external_entropy = 662 .generate_key_external_entropy =
663 mlkem768_generate_key_external_entropy, 663 mlkem768_generate_key_external_entropy,
664 .encode_private_key = 664 .encode_private_key =
665 mlkem768_encode_private_key, 665 mlkem768_marshal_private_key,
666 }; 666 };
667 struct MLKEM1024_private_key private_key1024; 667 struct MLKEM1024_private_key private_key1024;
668 uint8_t encoded_public_key1024[MLKEM1024_PUBLIC_KEY_BYTES]; 668 uint8_t encoded_public_key1024[MLKEM1024_PUBLIC_KEY_BYTES];
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c
index 8677713c8e..5ec8c08585 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_tests_util.c,v 1.6 2025/05/19 06:47:40 beck Exp $ */ 1/* $OpenBSD: mlkem_tests_util.c,v 1.7 2025/05/19 07:53:00 beck 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>
@@ -61,25 +61,10 @@ compare_data(const uint8_t *want, const uint8_t *got, size_t len, const char *ms
61} 61}
62 62
63int 63int
64mlkem768_encode_private_key(const void *private_key, uint8_t **out_buf, 64mlkem768_marshal_private_key(const void *private_key, uint8_t **out_buf,
65 size_t *out_len) 65 size_t *out_len)
66{ 66{
67 CBB cbb; 67 return MLKEM768_marshal_private_key(private_key, out_buf, out_len);
68 int ret = 0;
69
70 if (!CBB_init(&cbb, MLKEM768_PUBLIC_KEY_BYTES))
71 goto err;
72 if (!MLKEM768_marshal_private_key(&cbb, private_key))
73 goto err;
74 if (!CBB_finish(&cbb, out_buf, out_len))
75 goto err;
76
77 ret = 1;
78
79 err:
80 CBB_cleanup(&cbb);
81
82 return ret;
83} 68}
84 69
85int 70int
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h b/src/regress/lib/libcrypto/mlkem/mlkem_tests_util.h
index a3b255082f..5c2c400ea5 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.5 2025/05/19 06:47:40 beck Exp $ */ 1/* $OpenBSD: mlkem_tests_util.h,v 1.6 2025/05/19 07:53:00 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,7 +30,7 @@
30int compare_data(const uint8_t *want, const uint8_t *got, size_t len, 30int compare_data(const uint8_t *want, const uint8_t *got, size_t len,
31 const char *msg); 31 const char *msg);
32 32
33int mlkem768_encode_private_key(const void *priv, uint8_t **out_buf, 33int mlkem768_marshal_private_key(const void *priv, uint8_t **out_buf,
34 size_t *out_len); 34 size_t *out_len);
35int mlkem768_marshal_public_key(const void *pub, uint8_t **out_buf, 35int mlkem768_marshal_public_key(const void *pub, uint8_t **out_buf,
36 size_t *out_len); 36 size_t *out_len);
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c
index a1adc88569..ce1e797904 100644
--- a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c
+++ b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: mlkem_unittest.c,v 1.8 2025/05/19 06:47:40 beck Exp $ */ 1/* $OpenBSD: mlkem_unittest.c,v 1.9 2025/05/19 07:53:00 beck 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>
@@ -205,7 +205,7 @@ mlkem768_unittest(void)
205 .generate_key = mlkem768_generate_key, 205 .generate_key = mlkem768_generate_key,
206 .parse_private_key = mlkem768_parse_private_key, 206 .parse_private_key = mlkem768_parse_private_key,
207 .parse_public_key = mlkem768_parse_public_key, 207 .parse_public_key = mlkem768_parse_public_key,
208 .encode_private_key = mlkem768_encode_private_key, 208 .encode_private_key = mlkem768_marshal_private_key,
209 .marshal_public_key = mlkem768_marshal_public_key, 209 .marshal_public_key = mlkem768_marshal_public_key,
210 .public_from_private = mlkem768_public_from_private, 210 .public_from_private = mlkem768_public_from_private,
211 }; 211 };