Skip to content

Commit

Permalink
powm_sec does not support zero exponents
Browse files Browse the repository at this point in the history
  • Loading branch information
glondu committed Jul 20, 2021
1 parent 3c49fe6 commit d0edd18
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/platform/native/platform.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ module Z = struct
let ( =% ) = equal
let bit_length x = Stdlib.(String.length (to_bits x) * 8)

let powm = powm_sec (* Warning: no efforts have been made to be
constant time in the rest of the code. *)
let powm x a m =
if Z.compare a Z.zero = 0 then Z.one else powm_sec x a m
(* Warning: no efforts have been made to be constant time in the
rest of the code. *)

let hash_to_int = Z.hash
end

0 comments on commit d0edd18

Please sign in to comment.