Skip to content

Commit

Permalink
Fix incorrect usage of mlocked memory in MockKES
Browse files Browse the repository at this point in the history
  • Loading branch information
tdammers committed Apr 29, 2024
1 parent c3fa788 commit 6207d70
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cardano-crypto-class/src/Cardano/Crypto/KES/Mock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import Cardano.Crypto.KES.Class
import Cardano.Crypto.Util
import Cardano.Crypto.Libsodium.MLockedSeed
import Cardano.Crypto.Libsodium
( mlsbAsByteString
( mlsbToByteString
)
import Cardano.Crypto.Libsodium.Memory
( unpackByteStringCStringLen
Expand Down Expand Up @@ -159,7 +159,8 @@ instance KnownNat t => KESAlgorithm (MockKES t) where
--

genKeyKESWith _allocator seed = do
let vk = VerKeyMockKES (runMonadRandomWithSeed (mkSeedFromBytes . mlsbAsByteString . mlockedSeedMLSB $ seed) getRandomWord64)
seedBS <- mlsbToByteString . mlockedSeedMLSB $ seed
let vk = VerKeyMockKES (runMonadRandomWithSeed (mkSeedFromBytes seedBS) getRandomWord64)
return $! SignKeyMockKES vk 0

forgetSignKeyKESWith _ = const $ return ()
Expand Down

0 comments on commit 6207d70

Please sign in to comment.