From dd6276f01b34c3a6f2592c0bd72685bbba93fb31 Mon Sep 17 00:00:00 2001 From: miod <> Date: Sun, 8 Feb 2015 22:25:03 +0000 Subject: Use `> 0' instead of `!= 0' as a successful condition for EC_POINT_is_at_infinity() and EC_POINT_is_on_curve(), for they may return -1 should an error arise. ok doug@ jsing@ --- src/lib/libcrypto/ec/ec2_oct.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/ec/ec2_oct.c') diff --git a/src/lib/libcrypto/ec/ec2_oct.c b/src/lib/libcrypto/ec/ec2_oct.c index 3b8039af6e..c45d9c2219 100644 --- a/src/lib/libcrypto/ec/ec2_oct.c +++ b/src/lib/libcrypto/ec/ec2_oct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec2_oct.c,v 1.5 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: ec2_oct.c,v 1.6 2015/02/08 22:25:03 miod Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -183,7 +183,7 @@ ec_GF2m_simple_point2oct(const EC_GROUP *group, const EC_POINT *point, ECerr(EC_F_EC_GF2M_SIMPLE_POINT2OCT, EC_R_INVALID_FORM); goto err; } - if (EC_POINT_is_at_infinity(group, point)) { + if (EC_POINT_is_at_infinity(group, point) > 0) { /* encodes to a single 0 octet */ if (buf != NULL) { if (len < 1) { @@ -363,8 +363,8 @@ ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, goto err; } - if (!EC_POINT_is_on_curve(group, point, ctx)) { - /* test required by X9.62 */ + /* test required by X9.62 */ + if (EC_POINT_is_on_curve(group, point, ctx) <= 0) { ECerr(EC_F_EC_GF2M_SIMPLE_OCT2POINT, EC_R_POINT_IS_NOT_ON_CURVE); goto err; } -- cgit v1.2.3-55-g6feb