diff options
author | beck <> | 2025-05-19 06:47:40 +0000 |
---|---|---|
committer | beck <> | 2025-05-19 06:47:40 +0000 |
commit | b5d568ea85f2380b8447d6b8b652e81e0cbdfb8d (patch) | |
tree | c0473c2a6778acc8c1c57a2e73ed27b1d35552a6 /src/regress/lib/libcrypto/mlkem/mlkem_tests.c | |
parent | 4ec16279eb7cfd33c1785a5832ba16feff4a0ed8 (diff) | |
download | openbsd-b5d568ea85f2380b8447d6b8b652e81e0cbdfb8d.tar.gz openbsd-b5d568ea85f2380b8447d6b8b652e81e0cbdfb8d.tar.bz2 openbsd-b5d568ea85f2380b8447d6b8b652e81e0cbdfb8d.zip |
API changes for ML-KEM
- Get rid of CBB/CBS usage in public api
- Make void functions return int that can fail if malloc fails.
Along with some fallout and resulting bikeshedding in the regress tests.
ok jsing@, tb@
Diffstat (limited to 'src/regress/lib/libcrypto/mlkem/mlkem_tests.c')
-rw-r--r-- | src/regress/lib/libcrypto/mlkem/mlkem_tests.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_tests.c b/src/regress/lib/libcrypto/mlkem/mlkem_tests.c index e9ae417887..a4e7208c76 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.3 2025/05/03 08:34:07 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_tests.c,v 1.4 2025/05/19 06:47:40 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> |
@@ -112,7 +112,8 @@ MlkemDecapFileTest(struct decap_ctx *decap) | |||
112 | parse_get_cbs(p, DECAP_PRIVATE_KEY, &private_key); | 112 | parse_get_cbs(p, DECAP_PRIVATE_KEY, &private_key); |
113 | parse_get_int(p, DECAP_RESULT, &should_fail); | 113 | parse_get_int(p, DECAP_RESULT, &should_fail); |
114 | 114 | ||
115 | if (!decap->parse_private_key(decap->private_key, &private_key)) { | 115 | if (!decap->parse_private_key(decap->private_key, |
116 | CBS_data(&private_key), CBS_len(&private_key))) { | ||
116 | if ((failed = !should_fail)) | 117 | if ((failed = !should_fail)) |
117 | parse_info(p, "parse private key"); | 118 | parse_info(p, "parse private key"); |
118 | goto err; | 119 | goto err; |
@@ -207,7 +208,8 @@ MlkemNistDecapFileTest(struct decap_ctx *decap) | |||
207 | MLKEM_SHARED_SECRET_BYTES, CBS_len(&k))) | 208 | MLKEM_SHARED_SECRET_BYTES, CBS_len(&k))) |
208 | goto err; | 209 | goto err; |
209 | 210 | ||
210 | if (!decap->parse_private_key(decap->private_key, &dk)) { | 211 | if (!decap->parse_private_key(decap->private_key, CBS_data(&dk), |
212 | CBS_len(&dk))) { | ||
211 | parse_info(p, "parse private key"); | 213 | parse_info(p, "parse private key"); |
212 | goto err; | 214 | goto err; |
213 | } | 215 | } |
@@ -360,7 +362,8 @@ MlkemEncapFileTest(struct encap_ctx *encap) | |||
360 | parse_get_cbs(p, ENCAP_SHARED_SECRET, &shared_secret); | 362 | parse_get_cbs(p, ENCAP_SHARED_SECRET, &shared_secret); |
361 | parse_get_int(p, ENCAP_RESULT, &should_fail); | 363 | parse_get_int(p, ENCAP_RESULT, &should_fail); |
362 | 364 | ||
363 | if (!encap->parse_public_key(encap->public_key, &public_key)) { | 365 | if (!encap->parse_public_key(encap->public_key, CBS_data(&public_key), |
366 | CBS_len(&public_key))) { | ||
364 | if ((failed = !should_fail)) | 367 | if ((failed = !should_fail)) |
365 | parse_info(p, "parse public key"); | 368 | parse_info(p, "parse public key"); |
366 | goto err; | 369 | goto err; |