Add note about the optional all-zero test
This is actually a lie: the condition is tested in both curve implementations but not returned by the Haskell API. Will be a reminder to add this in the future. A function 'allocRetAndFreeze' could be useful.
This commit is contained in:
parent
8d51bce071
commit
a879845434
@ -92,7 +92,10 @@ dhSecret bs
|
||||
| B.length bs == 32 = CryptoPassed $ DhSecret $ B.copyAndFreeze bs (\_ -> return ())
|
||||
| otherwise = CryptoFailed CryptoError_SharedSecretSizeInvalid
|
||||
|
||||
-- | Compute the Diffie Hellman secret from a public key and a secret key
|
||||
-- | Compute the Diffie Hellman secret from a public key and a secret key.
|
||||
--
|
||||
-- This implementation may return an all-zero value as it does not check for
|
||||
-- the condition.
|
||||
dh :: PublicKey -> SecretKey -> DhSecret
|
||||
dh (PublicKey pub) (SecretKey sec) = DhSecret <$>
|
||||
B.allocAndFreeze 32 $ \result ->
|
||||
|
||||
@ -79,7 +79,10 @@ dhSecret bs
|
||||
| B.length bs == x448_bytes = CryptoPassed $ DhSecret $ B.copyAndFreeze bs (\_ -> return ())
|
||||
| otherwise = CryptoFailed CryptoError_SharedSecretSizeInvalid
|
||||
|
||||
-- | Compute the Diffie Hellman secret from a public key and a secret key
|
||||
-- | Compute the Diffie Hellman secret from a public key and a secret key.
|
||||
--
|
||||
-- This implementation may return an all-zero value as it does not check for
|
||||
-- the condition.
|
||||
dh :: PublicKey -> SecretKey -> DhSecret
|
||||
dh (PublicKey pub) (SecretKey sec) = DhSecret <$>
|
||||
B.allocAndFreeze x448_bytes $ \result ->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user