From 1b55b33144359df5c9263f352db7a41a2e2780c5 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Tue, 5 Mar 2024 12:14:58 +0100 Subject: [PATCH] mirage-crypto-pk: rsa avoid a copy --- pk/rsa.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pk/rsa.ml b/pk/rsa.ml index 84095eb7..1c83e420 100644 --- a/pk/rsa.ml +++ b/pk/rsa.ml @@ -402,7 +402,7 @@ module PSS (H: Hash.S) = struct let emsa_pss_verify slen emlen em msg = let mdb = String.sub em 0 (String.length em - hlen - 1) and h = String.sub em (String.length em - hlen - 1) hlen - and bxx = String.sub em (String.length em - 1) 1 + and bxx = string_get_uint8 em (String.length em - 1) in let db = MGF.mask ~seed:h mdb in Bytes.set_uint8 db 0 (Bytes.get_uint8 db 0 land b0mask emlen) ; @@ -413,7 +413,7 @@ module PSS (H: Hash.S) = struct let c1 = lnot (b0mask emlen) land string_get_uint8 mdb 0 = 0x00 and c2 = i = String.length em - hlen - slen - 2 and c3 = string_get_uint8 db i = 0x01 - and c4 = string_get_uint8 bxx 0 = 0xbc + and c4 = bxx = 0xbc and c5 = Eqaf.equal h h' in c1 && c2 && c3 && c4 && c5