diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2015-08-11 16:42:40 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2015-08-11 18:17:16 +0200 |
commit | adfc13dbdecd7c894ec47612da59420f3c74f92b (patch) | |
tree | b9dd8c93a031bd41a8e60dc59d6ba59cb29af190 /p | |
parent | a218c47ee01c099807a622ee63881d65f662d23d (diff) | |
download | DHG_packages-adfc13dbdecd7c894ec47612da59420f3c74f92b.tar.gz |
Fix whitespace in nettle patches
Diffstat (limited to 'p')
-rw-r--r-- | p/haskell-nettle/debian/patches/0001-port-to-nettle3.patch | 231 | ||||
-rw-r--r-- | p/haskell-nettle/debian/patches/disable-leaky-tests.diff | 10 |
2 files changed, 121 insertions, 120 deletions
diff --git a/p/haskell-nettle/debian/patches/0001-port-to-nettle3.patch b/p/haskell-nettle/debian/patches/0001-port-to-nettle3.patch index e73f381aa..72ddb4cf0 100644 --- a/p/haskell-nettle/debian/patches/0001-port-to-nettle3.patch +++ b/p/haskell-nettle/debian/patches/0001-port-to-nettle3.patch @@ -16,17 +16,17 @@ index 866468d..97a8850 100644 --- a/src/Crypto/Nettle/Ciphers.hs +++ b/src/Crypto/Nettle/Ciphers.hs @@ -125,7 +125,6 @@ instance StreamNonceCipher Typ where \ - ; streamNonceSize = witness nbsc_nonceSize \ - } - + ; streamNonceSize = witness nbsc_nonceSize \ + } + - {-| 'AES' is the generic cipher context for the AES cipher, supporting key sizes of 128, 196 and 256 bits (16, 24 and 32 bytes). The 'blockSize' is always 128 bits (16 bytes). @@ -142,35 +141,32 @@ instance NettleCipher AES where - nc_Ctx = AES + nc_Ctx = AES instance NettleBlockCipher AES where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_aes_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_aes_ctx_decrypt - nbc_ecb_encrypt = Tagged c_aes_encrypt @@ -37,9 +37,9 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_hs_aes_decrypt + nbc_fun_encrypt = Tagged p_hs_aes_encrypt + nbc_fun_decrypt = Tagged p_hs_aes_decrypt - + INSTANCE_BLOCKCIPHER(AES) - + - {-| 'AES128' provides the same interface as 'AES', but is restricted to 128-bit keys. @@ -48,14 +48,14 @@ index 866468d..97a8850 100644 instance NettleCipher AES128 where - nc_cipherInit = Tagged c_hs_aes_init + nc_cipherInit = Tagged (\ctx _ key -> c_hs_aes128_init ctx key) - nc_cipherName = Tagged "AES-128" - nc_cipherKeySize = Tagged $ KeySizeFixed 16 + nc_cipherName = Tagged "AES-128" + nc_cipherKeySize = Tagged $ KeySizeFixed 16 - nc_ctx_size = Tagged c_hs_aes_ctx_size + nc_ctx_size = Tagged c_hs_aes128_ctx_size - nc_ctx (AES128 c) = c - nc_Ctx = AES128 + nc_ctx (AES128 c) = c + nc_Ctx = AES128 instance NettleBlockCipher AES128 where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_aes_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_aes_ctx_decrypt - nbc_ecb_encrypt = Tagged c_aes_encrypt @@ -68,23 +68,23 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_aes128_decrypt + nbc_fun_encrypt = Tagged p_aes128_encrypt + nbc_fun_decrypt = Tagged p_aes128_decrypt - + INSTANCE_BLOCKCIPHER(AES128) - + @@ -180,20 +176,20 @@ INSTANCE_BLOCKCIPHER(AES128) -} newtype AES192 = AES192 SecureMem instance NettleCipher AES192 where - nc_cipherInit = Tagged c_hs_aes_init + nc_cipherInit = Tagged (\ctx _ key -> c_hs_aes192_init ctx key) - nc_cipherName = Tagged "AES-192" - nc_cipherKeySize = Tagged $ KeySizeFixed 24 + nc_cipherName = Tagged "AES-192" + nc_cipherKeySize = Tagged $ KeySizeFixed 24 - nc_ctx_size = Tagged c_hs_aes_ctx_size + nc_ctx_size = Tagged c_hs_aes192_ctx_size - nc_ctx (AES192 c) = c - nc_Ctx = AES192 + nc_ctx (AES192 c) = c + nc_Ctx = AES192 instance NettleBlockCipher AES192 where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_aes_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_aes_ctx_decrypt - nbc_ecb_encrypt = Tagged c_aes_encrypt @@ -97,23 +97,23 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_aes192_decrypt + nbc_fun_encrypt = Tagged p_aes192_encrypt + nbc_fun_decrypt = Tagged p_aes192_decrypt - + INSTANCE_BLOCKCIPHER(AES192) - + @@ -203,20 +199,20 @@ INSTANCE_BLOCKCIPHER(AES192) -} newtype AES256 = AES256 SecureMem instance NettleCipher AES256 where - nc_cipherInit = Tagged c_hs_aes_init + nc_cipherInit = Tagged (\ctx _ key -> c_hs_aes256_init ctx key) - nc_cipherName = Tagged "AES-256" - nc_cipherKeySize = Tagged $ KeySizeFixed 32 + nc_cipherName = Tagged "AES-256" + nc_cipherKeySize = Tagged $ KeySizeFixed 32 - nc_ctx_size = Tagged c_hs_aes_ctx_size + nc_ctx_size = Tagged c_hs_aes256_ctx_size - nc_ctx (AES256 c) = c - nc_Ctx = AES256 + nc_ctx (AES256 c) = c + nc_Ctx = AES256 instance NettleBlockCipher AES256 where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_aes_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_aes_ctx_decrypt - nbc_ecb_encrypt = Tagged c_aes_encrypt @@ -126,13 +126,13 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_aes256_decrypt + nbc_fun_encrypt = Tagged p_aes256_encrypt + nbc_fun_decrypt = Tagged p_aes256_decrypt - + INSTANCE_BLOCKCIPHER(AES256) - + @@ -297,12 +293,10 @@ instance NettleCipher Camellia where - nc_Ctx = Camellia + nc_Ctx = Camellia instance NettleBlockCipher Camellia where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_camellia_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_camellia_ctx_decrypt - nbc_ecb_encrypt = Tagged c_camellia_crypt @@ -143,23 +143,23 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_hs_camellia_decrypt + nbc_fun_encrypt = Tagged p_hs_camellia_encrypt + nbc_fun_decrypt = Tagged p_hs_camellia_decrypt - + INSTANCE_BLOCKCIPHER(Camellia) - + @@ -311,20 +305,20 @@ INSTANCE_BLOCKCIPHER(Camellia) -} newtype Camellia128 = Camellia128 SecureMem instance NettleCipher Camellia128 where - nc_cipherInit = Tagged c_hs_camellia_init + nc_cipherInit = Tagged (\ctx _ key -> c_hs_camellia128_init ctx key) - nc_cipherName = Tagged "Camellia-128" - nc_cipherKeySize = Tagged $ KeySizeFixed 16 + nc_cipherName = Tagged "Camellia-128" + nc_cipherKeySize = Tagged $ KeySizeFixed 16 - nc_ctx_size = Tagged c_hs_camellia_ctx_size + nc_ctx_size = Tagged c_hs_camellia128_ctx_size - nc_ctx (Camellia128 c) = c - nc_Ctx = Camellia128 + nc_ctx (Camellia128 c) = c + nc_Ctx = Camellia128 instance NettleBlockCipher Camellia128 where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_camellia_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_camellia_ctx_decrypt - nbc_ecb_encrypt = Tagged c_camellia_crypt @@ -172,23 +172,23 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_camellia128_crypt + nbc_fun_encrypt = Tagged p_camellia128_crypt + nbc_fun_decrypt = Tagged p_camellia128_crypt - + INSTANCE_BLOCKCIPHER(Camellia128) - + @@ -333,20 +327,20 @@ INSTANCE_BLOCKCIPHER(Camellia128) -} newtype Camellia192 = Camellia192 SecureMem instance NettleCipher Camellia192 where - nc_cipherInit = Tagged c_hs_camellia_init + nc_cipherInit = Tagged (\ctx _ key -> c_hs_camellia192_init ctx key) - nc_cipherName = Tagged "Camellia-192" - nc_cipherKeySize = Tagged $ KeySizeFixed 24 + nc_cipherName = Tagged "Camellia-192" + nc_cipherKeySize = Tagged $ KeySizeFixed 24 - nc_ctx_size = Tagged c_hs_camellia_ctx_size + nc_ctx_size = Tagged c_hs_camellia192_ctx_size - nc_ctx (Camellia192 c) = c - nc_Ctx = Camellia192 + nc_ctx (Camellia192 c) = c + nc_Ctx = Camellia192 instance NettleBlockCipher Camellia192 where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_camellia_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_camellia_ctx_decrypt - nbc_ecb_encrypt = Tagged c_camellia_crypt @@ -201,23 +201,23 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_camellia192_crypt + nbc_fun_encrypt = Tagged p_camellia192_crypt + nbc_fun_decrypt = Tagged p_camellia192_crypt - + INSTANCE_BLOCKCIPHER(Camellia192) - + @@ -355,20 +349,20 @@ INSTANCE_BLOCKCIPHER(Camellia192) -} newtype Camellia256 = Camellia256 SecureMem instance NettleCipher Camellia256 where - nc_cipherInit = Tagged c_hs_camellia_init + nc_cipherInit = Tagged (\ctx _ key -> c_hs_camellia256_init ctx key) - nc_cipherName = Tagged "Camellia-256" - nc_cipherKeySize = Tagged $ KeySizeFixed 32 + nc_cipherName = Tagged "Camellia-256" + nc_cipherKeySize = Tagged $ KeySizeFixed 32 - nc_ctx_size = Tagged c_hs_camellia_ctx_size + nc_ctx_size = Tagged c_hs_camellia256_ctx_size - nc_ctx (Camellia256 c) = c - nc_Ctx = Camellia256 + nc_ctx (Camellia256 c) = c + nc_Ctx = Camellia256 instance NettleBlockCipher Camellia256 where - nbc_blockSize = Tagged 16 + nbc_blockSize = Tagged 16 - nbc_encrypt_ctx_offset = Tagged c_hs_camellia_ctx_encrypt - nbc_decrypt_ctx_offset = Tagged c_hs_camellia_ctx_decrypt - nbc_ecb_encrypt = Tagged c_camellia_crypt @@ -230,46 +230,46 @@ index 866468d..97a8850 100644 + nbc_ecb_decrypt = Tagged c_camellia256_crypt + nbc_fun_encrypt = Tagged p_camellia256_crypt + nbc_fun_decrypt = Tagged p_camellia256_crypt - + INSTANCE_BLOCKCIPHER(Camellia256) - + @@ -378,7 +372,7 @@ and a variable key size of 40 up to 128 bits (5 to 16 bytes). -} newtype CAST128 = CAST128 SecureMem instance NettleCipher CAST128 where - nc_cipherInit = Tagged c_cast128_set_key + nc_cipherInit = Tagged c_cast5_set_key - nc_cipherName = Tagged "CAST-128" - nc_cipherKeySize = Tagged $ KeySizeRange 5 16 - nc_ctx_size = Tagged c_cast128_ctx_size + nc_cipherName = Tagged "CAST-128" + nc_cipherKeySize = Tagged $ KeySizeRange 5 16 + nc_ctx_size = Tagged c_cast128_ctx_size @@ -533,11 +527,11 @@ wrap_salsa20_set_key :: Ptr Word8 -> Word -> Ptr Word8 -> IO () wrap_salsa20_set_key ctxptr keylen keyptr = do - c_salsa20_set_key ctxptr keylen keyptr - withByteStringPtr (B.replicate 8 0) $ \_ nonceptr -> + c_salsa20_set_key ctxptr keylen keyptr + withByteStringPtr (B.replicate 8 0) $ \_ nonceptr -> - c_salsa20_set_iv ctxptr nonceptr + c_salsa20_set_nonce ctxptr nonceptr - + -- check nonce length -wrap_salsa20_set_iv :: Ptr Word8 -> Word -> Ptr Word8 -> IO () -wrap_salsa20_set_iv ctxptr ivlen ivptr = if ivlen == 8 then c_salsa20_set_iv ctxptr ivptr else fail "Invalid nonce length" +wrap_salsa20_set_nonce :: Ptr Word8 -> Word -> Ptr Word8 -> IO () +wrap_salsa20_set_nonce ctxptr ivlen ivptr = if ivlen == 8 then c_salsa20_set_nonce ctxptr ivptr else fail "Invalid nonce length" - + {-| 'SALSA20' is a fairly recent stream cipher designed by D. J. Bernstein. @@ -566,7 +560,7 @@ instance NettleBlockedStreamCipher SALSA20 where - nbsc_incompleteState (SALSA20 (_, inc)) = inc - nbsc_streamCombine = Tagged c_salsa20_crypt - nbsc_nonceSize = Tagged $ KeySizeFixed 8 + nbsc_incompleteState (SALSA20 (_, inc)) = inc + nbsc_streamCombine = Tagged c_salsa20_crypt + nbsc_nonceSize = Tagged $ KeySizeFixed 8 - nbsc_setNonce = Tagged $ Just wrap_salsa20_set_iv + nbsc_setNonce = Tagged $ Just wrap_salsa20_set_nonce INSTANCE_BLOCKEDSTREAMNONCECIPHER(SALSA20) - - + + @@ -587,5 +581,5 @@ instance NettleBlockedStreamCipher ESTREAM_SALSA20 where - nbsc_incompleteState (ESTREAM_SALSA20 (_, inc)) = inc - nbsc_streamCombine = Tagged c_salsa20r12_crypt - nbsc_nonceSize = Tagged $ KeySizeFixed 8 + nbsc_incompleteState (ESTREAM_SALSA20 (_, inc)) = inc + nbsc_streamCombine = Tagged c_salsa20r12_crypt + nbsc_nonceSize = Tagged $ KeySizeFixed 8 - nbsc_setNonce = Tagged $ Just wrap_salsa20_set_iv + nbsc_setNonce = Tagged $ Just wrap_salsa20_set_nonce INSTANCE_BLOCKEDSTREAMNONCECIPHER(ESTREAM_SALSA20) @@ -278,12 +278,12 @@ index 33e7cc9..34a0d52 100644 --- a/src/Crypto/Nettle/Ciphers/ForeignImports.hsc +++ b/src/Crypto/Nettle/Ciphers/ForeignImports.hsc @@ -23,13 +23,38 @@ module Crypto.Nettle.Ciphers.ForeignImports - , c_gcm_digest - - , c_hs_aes_ctx_size + , c_gcm_digest + + , c_hs_aes_ctx_size - , c_hs_aes_ctx_encrypt - , c_hs_aes_ctx_decrypt - , c_hs_aes_init + , c_hs_aes_init - , c_aes_encrypt - , p_aes_encrypt - , c_aes_decrypt @@ -319,16 +319,16 @@ index 33e7cc9..34a0d52 100644 + , p_aes256_encrypt + , c_aes256_decrypt + , p_aes256_decrypt - - , c_arctwo_ctx_size - , c_arctwo_set_key + + , c_arctwo_ctx_size + , c_arctwo_set_key @@ -48,14 +73,35 @@ module Crypto.Nettle.Ciphers.ForeignImports - , p_blowfish_decrypt - - , c_hs_camellia_ctx_size + , p_blowfish_decrypt + + , c_hs_camellia_ctx_size - , c_hs_camellia_ctx_encrypt - , c_hs_camellia_ctx_decrypt - , c_hs_camellia_init + , c_hs_camellia_init - , c_camellia_crypt - , p_camellia_crypt + , c_hs_camellia_encrypt @@ -356,24 +356,24 @@ index 33e7cc9..34a0d52 100644 + , c_hs_camellia256_init + , c_camellia256_crypt + , p_camellia256_crypt - - , c_cast128_ctx_size + + , c_cast128_ctx_size - , c_cast128_set_key + , c_cast5_set_key - , c_cast128_encrypt - , p_cast128_encrypt - , c_cast128_decrypt + , c_cast128_encrypt + , p_cast128_encrypt + , c_cast128_decrypt @@ -95,7 +141,7 @@ module Crypto.Nettle.Ciphers.ForeignImports - - , c_salsa20_ctx_size - , c_salsa20_set_key + + , c_salsa20_ctx_size + , c_salsa20_set_key - , c_salsa20_set_iv + , c_salsa20_set_nonce - , c_salsa20_crypt - , c_salsa20r12_crypt - ) where + , c_salsa20_crypt + , c_salsa20r12_crypt + ) where @@ -145,21 +191,67 @@ foreign import ccall unsafe "nettle_gcm_digest" - + c_hs_aes_ctx_size :: Int c_hs_aes_ctx_size = #{size struct hs_aes_ctx} -c_hs_aes_ctx_encrypt :: Ptr Word8 -> Ptr Word8 @@ -381,7 +381,7 @@ index 33e7cc9..34a0d52 100644 -c_hs_aes_ctx_decrypt :: Ptr Word8 -> Ptr Word8 -c_hs_aes_ctx_decrypt = #ptr struct hs_aes_ctx, decrypt foreign import ccall unsafe "hs_nettle_aes_init" - c_hs_aes_init :: Ptr Word8 -> Word -> Ptr Word8 -> IO () + c_hs_aes_init :: Ptr Word8 -> Word -> Ptr Word8 -> IO () -foreign import ccall unsafe "nettle_aes_encrypt" - c_aes_encrypt :: NettleCryptFunc -foreign import ccall unsafe "&nettle_aes_encrypt" @@ -450,11 +450,11 @@ index 33e7cc9..34a0d52 100644 + c_aes256_decrypt :: NettleCryptFunc +foreign import ccall unsafe "&nettle_aes256_decrypt" + p_aes256_decrypt :: FunPtr NettleCryptFunc - + c_arctwo_ctx_size :: Int c_arctwo_ctx_size = #{size struct arctwo_ctx} @@ -193,21 +285,62 @@ foreign import ccall unsafe "&nettle_blowfish_decrypt" - + c_hs_camellia_ctx_size :: Int c_hs_camellia_ctx_size = #{size struct hs_camellia_ctx} -c_hs_camellia_ctx_encrypt :: Ptr Word8 -> Ptr Word8 @@ -462,7 +462,7 @@ index 33e7cc9..34a0d52 100644 -c_hs_camellia_ctx_decrypt :: Ptr Word8 -> Ptr Word8 -c_hs_camellia_ctx_decrypt = #ptr struct hs_camellia_ctx, decrypt foreign import ccall unsafe "hs_nettle_camellia_init" - c_hs_camellia_init :: Ptr Word8 -> Word -> Ptr Word8 -> IO () + c_hs_camellia_init :: Ptr Word8 -> Word -> Ptr Word8 -> IO () -foreign import ccall unsafe "nettle_camellia_crypt" - c_camellia_crypt :: NettleCryptFunc -foreign import ccall unsafe "&nettle_camellia_crypt" @@ -515,7 +515,7 @@ index 33e7cc9..34a0d52 100644 + c_camellia256_crypt :: NettleCryptFunc +foreign import ccall unsafe "&nettle_camellia256_crypt" + p_camellia256_crypt :: FunPtr NettleCryptFunc - + c_cast128_ctx_size :: Int c_cast128_ctx_size = #{size struct cast128_ctx} -foreign import ccall unsafe "nettle_cast128_set_key" @@ -524,27 +524,27 @@ index 33e7cc9..34a0d52 100644 +foreign import ccall unsafe "nettle_cast5_set_key" + c_cast5_set_key :: Ptr Word8 -> Word -> Ptr Word8 -> IO () foreign import ccall unsafe "nettle_cast128_encrypt" - c_cast128_encrypt :: NettleCryptFunc + c_cast128_encrypt :: NettleCryptFunc foreign import ccall unsafe "&nettle_cast128_encrypt" @@ -282,8 +415,8 @@ c_salsa20_ctx_size :: Int c_salsa20_ctx_size = #{size struct salsa20_ctx} foreign import ccall unsafe "nettle_salsa20_set_key" - c_salsa20_set_key :: Ptr Word8 -> Word -> Ptr Word8 -> IO () + c_salsa20_set_key :: Ptr Word8 -> Word -> Ptr Word8 -> IO () -foreign import ccall unsafe "nettle_salsa20_set_iv" - c_salsa20_set_iv :: Ptr Word8 -> Ptr Word8 -> IO () +foreign import ccall unsafe "nettle_salsa20_set_nonce" + c_salsa20_set_nonce :: Ptr Word8 -> Ptr Word8 -> IO () foreign import ccall unsafe "nettle_salsa20_crypt" - c_salsa20_crypt :: NettleCryptFunc + c_salsa20_crypt :: NettleCryptFunc foreign import ccall unsafe "nettle_salsa20r12_crypt" diff --git a/src/nettle-ciphers.c b/src/nettle-ciphers.c index 779791a..3d81c89 100644 --- a/src/nettle-ciphers.c +++ b/src/nettle-ciphers.c @@ -38,16 +38,132 @@ void hs_nettle_cfb_decrypt(void *ctx, nettle_crypt_func *f, - } + } } - + +void hs_nettle_aes128_init(struct hs_aes128_ctx *ctx, const char *key) { + aes128_set_encrypt_key(&ctx->encrypt, key); + aes128_invert_key(&ctx->decrypt, &ctx->encrypt); @@ -561,8 +561,8 @@ index 779791a..3d81c89 100644 +} + void hs_nettle_aes_init(struct hs_aes_ctx *ctx, unsigned int key_size, const char *key) { - assert(16 == key_size || 24 == key_size || 32 == key_size); - + assert(16 == key_size || 24 == key_size || 32 == key_size); + - aes_set_encrypt_key(&ctx->encrypt, key_size, key); - aes_invert_key(&ctx->decrypt, &ctx->encrypt); + switch (key_size) { @@ -626,10 +626,10 @@ index 779791a..3d81c89 100644 + camellia256_set_encrypt_key(&ctx->encrypt, key); + camellia256_invert_key(&ctx->decrypt, &ctx->encrypt); } - + void hs_nettle_camellia_init(struct hs_camellia_ctx *ctx, unsigned int key_size, const char *key) { - assert(16 == key_size || 24 == key_size || 32 == key_size); - + assert(16 == key_size || 24 == key_size || 32 == key_size); + - camellia_set_encrypt_key(&ctx->encrypt, key_size, key); - camellia_invert_key(&ctx->decrypt, &ctx->encrypt); + switch (key_size) { @@ -685,7 +685,7 @@ index a81571b..37b2d60 100644 @@ -2,6 +2,12 @@ #ifndef _HS_NETTLE_CIPHERS_H #define _HS_NETTLE_CIPHERS_H _HS_NETTLE_CIPHERS_H - + +#include <nettle/version.h> + +#if (NETTLE_VERSION_MAJOR != 3) @@ -696,9 +696,9 @@ index a81571b..37b2d60 100644 #include <nettle/cbc.h> #include <nettle/gcm.h> @@ -33,15 +39,60 @@ void hs_nettle_cfb_decrypt(void *ctx, nettle_crypt_func *f, - const uint8_t *src); - - + const uint8_t *src); + + +struct hs_aes128_ctx { + struct aes128_ctx encrypt, decrypt; +}; @@ -732,7 +732,7 @@ index a81571b..37b2d60 100644 + struct camellia128_ctx encrypt, decrypt; +}; +void hs_nettle_camellia128_init(struct hs_camellia128_ctx *ctx, const char *key); - + +struct hs_camellia192_ctx { + struct camellia192_ctx encrypt, decrypt; +}; @@ -742,7 +742,7 @@ index a81571b..37b2d60 100644 + struct camellia256_ctx encrypt, decrypt; +}; +void hs_nettle_camellia256_init(struct hs_camellia256_ctx *ctx, const char *key); - + +union hs_camellia_ctx_inner { + struct camellia128_ctx inner128; + struct camellia192_ctx inner192; @@ -756,7 +756,7 @@ index a81571b..37b2d60 100644 void hs_nettle_camellia_init(struct hs_camellia_ctx *ctx, unsigned int key_size, const char *key); +void hs_nettle_camellia_encrypt(const struct hs_camellia_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); +void hs_nettle_camellia_decrypt(const struct hs_camellia_ctx *ctx, size_t length, uint8_t *dst, const uint8_t *src); - + #endif diff --git a/src/nettle-hash.h b/src/nettle-hash.h index 5ba03d9..09a0158 100644 @@ -765,7 +765,7 @@ index 5ba03d9..09a0158 100644 @@ -2,6 +2,12 @@ #ifndef _HS_NETTLE_HASH_H #define _HS_NETTLE_HASH_H _HS_NETTLE_HASH_H - + +#include <nettle/version.h> + +#if (NETTLE_VERSION_MAJOR != 3) @@ -775,5 +775,6 @@ index 5ba03d9..09a0158 100644 #include <sys/types.h> #include <nettle/cbc.h> #include <nettle/gcm.h> --- +-- 2.1.4 + diff --git a/p/haskell-nettle/debian/patches/disable-leaky-tests.diff b/p/haskell-nettle/debian/patches/disable-leaky-tests.diff index c0e3ce427..ba5e7dab2 100644 --- a/p/haskell-nettle/debian/patches/disable-leaky-tests.diff +++ b/p/haskell-nettle/debian/patches/disable-leaky-tests.diff @@ -3,14 +3,14 @@ Index: nettle-0.1.0/src/Tests/VectorsUMAC.hs --- nettle-0.1.0.orig/src/Tests/VectorsUMAC.hs 2013-10-19 10:01:14.000000000 -0400 +++ nettle-0.1.0/src/Tests/VectorsUMAC.hs 2013-11-14 15:56:24.945325221 -0500 @@ -33,9 +33,9 @@ - ]) + ]) -- /* Needs POLY128 */ -- /* For the 'a' * 2^25 testcase, see errata http://fastcrypto.org/umac/rfc4418.errata.txt */ - , ("abcdefghijklmnop", Just "bcdefghi", repString (2^(25::Int)) "aaaaaaaa", +{- , ("abcdefghijklmnop", Just "bcdefghi", repString (2^(25::Int)) "aaaaaaaa", - [ ("85EE5CAE", "FACA46F856E9B45F", "a621c2457c0012e64f3fdae9e7e1870c") + [ ("85EE5CAE", "FACA46F856E9B45F", "a621c2457c0012e64f3fdae9e7e1870c") - ]) + ]) -} - , ("abcdefghijklmnop", Just "bcdefghi", repString 3 "abc", - [ ("ABF3A3A0", "D4D7B9F6BD4FBFCF", "883c3d4b97a61976ffcf232308cba5a5") - ]) + , ("abcdefghijklmnop", Just "bcdefghi", repString 3 "abc", + [ ("ABF3A3A0", "D4D7B9F6BD4FBFCF", "883c3d4b97a61976ffcf232308cba5a5") + ]) |