This API can fail for various reasons, in which case it returns -1, so
you need to check if (EC_POINT_is_on_curve_checks(...) <= 0).
ok miod
-/* $OpenBSD: ecdh.c,v 1.5 2023/07/12 08:54:18 tb Exp $ */
+/* $OpenBSD: ecdh.c,v 1.6 2023/07/24 17:08:53 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
if ((group = EC_KEY_get0_group(ecdh)) == NULL)
goto err;
- if (!EC_POINT_is_on_curve(group, pub_key, ctx))
+ if (EC_POINT_is_on_curve(group, pub_key, ctx) <= 0)
goto err;
if ((point = EC_POINT_new(group)) == NULL) {
-/* $OpenBSD: gostr341001_key.c,v 1.13 2023/07/08 14:30:44 beck Exp $ */
+/* $OpenBSD: gostr341001_key.c,v 1.14 2023/07/24 17:08:53 tb Exp $ */
/*
* Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Copyright (c) 2005-2006 Cryptocom LTD
goto err;
/* testing whether the pub_key is on the elliptic curve */
- if (EC_POINT_is_on_curve(key->group, key->pub_key, ctx) == 0) {
+ if (EC_POINT_is_on_curve(key->group, key->pub_key, ctx) <= 0) {
GOSTerror(EC_R_POINT_IS_NOT_ON_CURVE);
goto err;
}