diff options
author | tb <> | 2023-07-15 20:11:37 +0000 |
---|---|---|
committer | tb <> | 2023-07-15 20:11:37 +0000 |
commit | 6b86b41983f40fcc0b8c5b5cd3b747d9139c6a28 (patch) | |
tree | 82868e3438d9cf6b11719d83afe131958a360093 /src/regress/lib | |
parent | 0c09b26618d8f93d40a1230ba04afe762c74ec31 (diff) | |
download | openbsd-6b86b41983f40fcc0b8c5b5cd3b747d9139c6a28.tar.gz openbsd-6b86b41983f40fcc0b8c5b5cd3b747d9139c6a28.tar.bz2 openbsd-6b86b41983f40fcc0b8c5b5cd3b747d9139c6a28.zip |
Fix return value check for ECDH_compute_key()
ECDH_compute_key() usually returns -1 on error (but sometimes 0). This
was also the case in OpenSSL when these tests were written. This will
soon change. The check for <= 0 will still be correct.
Diffstat (limited to 'src/regress/lib')
-rw-r--r-- | src/regress/lib/libcrypto/ecdh/ecdhtest.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/regress/lib/libcrypto/ecdh/ecdhtest.c b/src/regress/lib/libcrypto/ecdh/ecdhtest.c index 8770e4a8f0..6388343cfe 100644 --- a/src/regress/lib/libcrypto/ecdh/ecdhtest.c +++ b/src/regress/lib/libcrypto/ecdh/ecdhtest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecdhtest.c,v 1.16 2023/05/20 16:00:22 tb Exp $ */ | 1 | /* $OpenBSD: ecdhtest.c,v 1.17 2023/07/15 20:11:37 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -348,14 +348,14 @@ ecdh_kat(BIO *out, const char *cname, int nid, | |||
348 | goto err; | 348 | goto err; |
349 | if ((Ztmp = malloc(Ztmplen)) == NULL) | 349 | if ((Ztmp = malloc(Ztmplen)) == NULL) |
350 | goto err; | 350 | goto err; |
351 | if (!ECDH_compute_key(Ztmp, Ztmplen, | 351 | if (ECDH_compute_key(Ztmp, Ztmplen, |
352 | EC_KEY_get0_public_key(key2), key1, 0)) | 352 | EC_KEY_get0_public_key(key2), key1, 0) <= 0) |
353 | goto err; | 353 | goto err; |
354 | if (memcmp(Ztmp, Z, Zlen)) | 354 | if (memcmp(Ztmp, Z, Zlen)) |
355 | goto err; | 355 | goto err; |
356 | memset(Ztmp, 0, Zlen); | 356 | memset(Ztmp, 0, Zlen); |
357 | if (!ECDH_compute_key(Ztmp, Ztmplen, | 357 | if (ECDH_compute_key(Ztmp, Ztmplen, |
358 | EC_KEY_get0_public_key(key1), key2, 0)) | 358 | EC_KEY_get0_public_key(key1), key2, 0) <= 0) |
359 | goto err; | 359 | goto err; |
360 | if (memcmp(Ztmp, Z, Zlen)) | 360 | if (memcmp(Ztmp, Z, Zlen)) |
361 | goto err; | 361 | goto err; |