-/* $OpenBSD: ec2_mult.c,v 1.12 2018/07/15 16:27:39 tb Exp $ */
+/* $OpenBSD: ec2_mult.c,v 1.13 2018/07/23 18:24:22 tb Exp $ */
/* ====================================================================
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
*
#include <openssl/err.h>
+#include "bn_lcl.h"
#include "ec_lcl.h"
#ifndef OPENSSL_NO_EC2M
for (; i >= 0; i--) {
word = scalar->d[i];
while (mask) {
- BN_consttime_swap(word & mask, x1, x2, group->field.top);
- BN_consttime_swap(word & mask, z1, z2, group->field.top);
+ if (!BN_swap_ct(word & mask, x1, x2, group->field.top))
+ goto err;
+ if (!BN_swap_ct(word & mask, z1, z2, group->field.top))
+ goto err;
if (!gf2m_Madd(group, &point->X, x2, z2, x1, z1, ctx))
goto err;
if (!gf2m_Mdouble(group, x1, z1, ctx))
goto err;
- BN_consttime_swap(word & mask, x1, x2, group->field.top);
- BN_consttime_swap(word & mask, z1, z2, group->field.top);
+ if (!BN_swap_ct(word & mask, x1, x2, group->field.top))
+ goto err;
+ if (!BN_swap_ct(word & mask, z1, z2, group->field.top))
+ goto err;
mask >>= 1;
}
mask = BN_TBIT;