mirror of
https://github.com/kazu-yamamoto/crypton.git
synced 2024-10-05 16:27:35 +03:00
Fix buffer length in scrypt
The temporary XY buffer passed to the scrypt_smix C function should be 256r+64 bytes in length, but the Haskell code was only allocating 256r bytes, causing the additional 64 to be written past the end of the buffer. See #91.
This commit is contained in:
parent
dc8bb8934c
commit
de17b66e31
@ -53,7 +53,7 @@ generate params password salt
|
||||
let b = PBKDF2.generate prf (PBKDF2.Parameters 1 intLen) password salt :: B.Bytes
|
||||
newSalt <- B.copy b $ \bPtr ->
|
||||
allocaBytesAligned (128*(fromIntegral $ n params)*(r params)) 8 $ \v ->
|
||||
allocaBytesAligned (256*r params) 8 $ \xy -> do
|
||||
allocaBytesAligned (256*r params + 64) 8 $ \xy -> do
|
||||
forM_ [0..(p params-1)] $ \i ->
|
||||
ccryptonite_scrypt_smix (bPtr `plusPtr` (i * 128 * (r params)))
|
||||
(fromIntegral $ r params) (n params) v xy
|
||||
|
Loading…
Reference in New Issue
Block a user