Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed May 7, 2024
1 parent e224458 commit ff1ae5b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ec/mirage_crypto_ec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,11 @@ module Make_dsa (Param : Parameters) (F : Fn) (P : Point) (S : Scalar) (H : Dige
else (
(* Assuming shift is < 8 *)
let r' = Bytes.create Param.byte_length in
let p = ref 0x00 in
for i = 0 to Param.byte_length - 1 do
let x = Bytes.get_uint8 r i in
let p = if i = 0 then 0x00 else Bytes.get_uint8 r (i - 1) in
let v = (x lsr shift) lor (p lsl (8 - shift)) in
let v = (x lsr shift) lor (!p lsl (8 - shift)) in
p := x;
Bytes.set_uint8 r' i v
done;
Bytes.unsafe_to_string r'
Expand Down

0 comments on commit ff1ae5b

Please sign in to comment.