diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-15 20:11:38 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-15 20:11:38 +0000 |
commit | 08f7e1fcb5564c4ba6cdebd6986c0ff60949ae4a (patch) | |
tree | 1aeb231f52df86d8792c3a8758991e770d0fce3b /regress/lib | |
parent | 66daef66c2fb0bd8a0f0708d1053071bfe650a76 (diff) |
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 'regress/lib')
-rw-r--r-- | regress/lib/libcrypto/ecdh/ecdhtest.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/regress/lib/libcrypto/ecdh/ecdhtest.c b/regress/lib/libcrypto/ecdh/ecdhtest.c index 8770e4a8f07..6388343cfe8 100644 --- a/regress/lib/libcrypto/ecdh/ecdhtest.c +++ b/regress/lib/libcrypto/ecdh/ecdhtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecdhtest.c,v 1.16 2023/05/20 16:00:22 tb Exp $ */ +/* $OpenBSD: ecdhtest.c,v 1.17 2023/07/15 20:11:37 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -348,14 +348,14 @@ ecdh_kat(BIO *out, const char *cname, int nid, goto err; if ((Ztmp = malloc(Ztmplen)) == NULL) goto err; - if (!ECDH_compute_key(Ztmp, Ztmplen, - EC_KEY_get0_public_key(key2), key1, 0)) + if (ECDH_compute_key(Ztmp, Ztmplen, + EC_KEY_get0_public_key(key2), key1, 0) <= 0) goto err; if (memcmp(Ztmp, Z, Zlen)) goto err; memset(Ztmp, 0, Zlen); - if (!ECDH_compute_key(Ztmp, Ztmplen, - EC_KEY_get0_public_key(key1), key2, 0)) + if (ECDH_compute_key(Ztmp, Ztmplen, + EC_KEY_get0_public_key(key1), key2, 0) <= 0) goto err; if (memcmp(Ztmp, Z, Zlen)) goto err; |