Skip to content

Commit

Permalink
Add constant_time_declassify to p384/521 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
dkostic committed Oct 11, 2023
1 parent 8da0953 commit e4dc3bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ec/p384.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static void p384_point_add(p384_felem x3, p384_felem y3, p384_felem z3,
p384_limb_t is_nontrivial_double = constant_time_is_zero_w(xneq | yneq) &
~constant_time_is_zero_w(z1nz) &
~constant_time_is_zero_w(z2nz);
if (is_nontrivial_double) {
if (constant_time_declassify_w(is_nontrivial_double)) {
p384_point_double(x3, y3, z3, x1, y1, z1);
return;
}
Expand Down Expand Up @@ -502,7 +502,7 @@ static int ec_GFp_nistp384_point_get_affine_coordinates(
const EC_GROUP *group, const EC_JACOBIAN *point,
EC_FELEM *x_out, EC_FELEM *y_out) {

if (ec_GFp_simple_is_at_infinity(group, point)) {
if (constant_time_declassify_w(ec_GFp_simple_is_at_infinity(group, point))) {
OPENSSL_PUT_ERROR(EC, EC_R_POINT_AT_INFINITY);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ec/p521.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ static void p521_point_add(p521_felem x3, p521_felem y3, p521_felem z3,
p521_limb_t is_nontrivial_double = constant_time_is_zero_w(xneq | yneq) &
~constant_time_is_zero_w(z1nz) &
~constant_time_is_zero_w(z2nz);
if (is_nontrivial_double) {
if (constant_time_declassify_w(is_nontrivial_double)) {
p521_point_double(x3, y3, z3, x1, y1, z1);
return;
}
Expand Down Expand Up @@ -509,7 +509,7 @@ static int ec_GFp_nistp521_point_get_affine_coordinates(
const EC_GROUP *group, const EC_JACOBIAN *point,
EC_FELEM *x_out, EC_FELEM *y_out) {

if (ec_GFp_simple_is_at_infinity(group, point)) {
if (constant_time_declassify_w(ec_GFp_simple_is_at_infinity(group, point))) {
OPENSSL_PUT_ERROR(EC, EC_R_POINT_AT_INFINITY);
return 0;
}
Expand Down

0 comments on commit e4dc3bf

Please sign in to comment.