diff options
Diffstat (limited to '')
-rw-r--r-- | src/regress/lib/libcrypto/mlkem/mlkem_unittest.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c b/src/regress/lib/libcrypto/mlkem/mlkem_unittest.c index 23b3d8b261..597297b8cc 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.6 2024/12/26 12:35:25 tb Exp $ */ | 1 | /* $OpenBSD: mlkem_unittest.c,v 1.7 2025/05/03 08:34:55 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> |
@@ -161,16 +161,22 @@ MlKemUnitTest(struct unittest_ctx *ctx) | |||
161 | tmp_buf = NULL; | 161 | tmp_buf = NULL; |
162 | 162 | ||
163 | ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub); | 163 | ctx->encap(ctx->ciphertext, shared_secret1, ctx->pub); |
164 | ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, | 164 | if (!ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, |
165 | ctx->priv); | 165 | ctx->priv)) { |
166 | warnx("decap() failed using priv"); | ||
167 | failed |= 1; | ||
168 | } | ||
166 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, | 169 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, |
167 | "shared secrets with priv") != 0) { | 170 | "shared secrets with priv") != 0) { |
168 | warnx("compare_data"); | 171 | warnx("compare_data"); |
169 | failed |= 1; | 172 | failed |= 1; |
170 | } | 173 | } |
171 | 174 | ||
172 | ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, | 175 | if (!ctx->decap(shared_secret2, ctx->ciphertext, ctx->ciphertext_len, |
173 | ctx->priv2); | 176 | ctx->priv2)) { |
177 | warnx("decap() failed using priv2"); | ||
178 | failed |= 1; | ||
179 | } | ||
174 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, | 180 | if (compare_data(shared_secret1, shared_secret2, MLKEM_SHARED_SECRET_BYTES, |
175 | "shared secrets with priv2") != 0) { | 181 | "shared secrets with priv2") != 0) { |
176 | warnx("compare_data"); | 182 | warnx("compare_data"); |