[Pkg-haskell-commits] darcs: haskell-cryptocipher: haskell-cryptocipher on BigEndian architectures (Closes: #674811)

Joachim Breitner mail at joachim-breitner.de
Fri Jun 8 09:18:31 UTC 2012


Fri Jun  8 09:15:43 UTC 2012  Joachim Breitner <mail at joachim-breitner.de>
  * haskell-cryptocipher on BigEndian architectures (Closes: #674811)
  Ignore-this: 11cf8222dd8fe3d3a0863a461a797556

    M ./changelog +6
    M ./control -1 +2
    A ./patches/
    A ./patches/fix-AES-on-BigEndian
    A ./patches/series

Fri Jun  8 09:15:43 UTC 2012  Joachim Breitner <mail at joachim-breitner.de>
  * haskell-cryptocipher on BigEndian architectures (Closes: #674811)
  Ignore-this: 11cf8222dd8fe3d3a0863a461a797556
diff -rN -u old-haskell-cryptocipher//changelog new-haskell-cryptocipher//changelog
--- old-haskell-cryptocipher//changelog	2012-06-08 09:18:31.554325606 +0000
+++ new-haskell-cryptocipher//changelog	2012-06-08 09:18:31.570323400 +0000
@@ -1,3 +1,9 @@
+haskell-cryptocipher (0.3.3-2) UNRELEASED; urgency=low
+
+  * haskell-cryptocipher on BigEndian architectures (Closes: #674811)
+
+ -- Joachim Breitner <nomeata at debian.org>  Fri, 08 Jun 2012 11:07:21 +0200
+
 haskell-cryptocipher (0.3.3-1) unstable; urgency=low
 
   * New upstream version.
diff -rN -u old-haskell-cryptocipher//control new-haskell-cryptocipher//control
--- old-haskell-cryptocipher//control	2012-06-08 09:18:31.554325606 +0000
+++ new-haskell-cryptocipher//control	2012-06-08 09:18:31.558324136 +0000
@@ -10,7 +10,8 @@
   , ghc-prof
   , libghc-cereal-dev
   , libghc-cereal-prof
-  , libghc-cpu-dev (>> 0.1)
+# Due to improved getSystemEndianness (Debian patch)
+  , libghc-cpu-dev (>= 0.1.0-2)
   , libghc-cpu-dev (<< 0.2)
   , libghc-cpu-prof
   , libghc-crypto-api-dev (>> 0.5)
diff -rN -u old-haskell-cryptocipher//patches/fix-AES-on-BigEndian new-haskell-cryptocipher//patches/fix-AES-on-BigEndian
--- old-haskell-cryptocipher//patches/fix-AES-on-BigEndian	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-cryptocipher//patches/fix-AES-on-BigEndian	2012-06-08 09:18:31.562324957 +0000
@@ -0,0 +1,51 @@
+Description: Fix AES code on big endian machines
+Author: Joachim Breitner <nomeata at debian.org>
+Bug-Debian: http://bugs.debian.org/674811
+Bug: https://github.com/vincenthz/hs-cryptocipher/issues/16
+Forwarded: https://github.com/vincenthz/hs-cryptocipher/pull/17
+
+--- haskell-cryptocipher-0.3.3.orig/Crypto/Cipher/AES/Haskell.hs
++++ haskell-cryptocipher-0.3.3/Crypto/Cipher/AES/Haskell.hs
+@@ -313,13 +313,26 @@ coreExpandKey vkey
+ 		cR0 it r0 r1 r2 r3 =
+ 			(sbox r1 `xor` rcon it, sbox r2, sbox r3, sbox r0)
+ 
++rotateR' :: Word32 -> Int -> Word32
++rotateR' = case getSystemEndianness of
++           LittleEndian -> rotateR
++           BigEndian    -> rotateL
++{-# INLINE rotateR' #-}
++
++rotateL' :: Word32 -> Int -> Word32
++rotateL' = case getSystemEndianness of
++           LittleEndian -> rotateL
++           BigEndian    -> rotateR
++{-# INLINE rotateL' #-}
++
++
+ {-# INLINE shiftRows #-}
+ shiftRows :: AESState -> IO ()
+ shiftRows blk = do
+ 	r32 blk 0 >>= w32 blk 0 . msbox32
+-	r32 blk 1 >>= \t1 -> w32 blk 1 $ rotateR (msbox32 t1) 8
+-	r32 blk 2 >>= \t2 -> w32 blk 2 $ rotateR (msbox32 t2) 16
+-	r32 blk 3 >>= \t3 -> w32 blk 3 $ rotateR (msbox32 t3) 24
++	r32 blk 1 >>= \t1 -> w32 blk 1 $ rotateR' (msbox32 t1) 8
++	r32 blk 2 >>= \t2 -> w32 blk 2 $ rotateR' (msbox32 t2) 16
++	r32 blk 3 >>= \t3 -> w32 blk 3 $ rotateR' (msbox32 t3) 24
+ 
+ {-# INLINE addRoundKey #-}
+ addRoundKey :: Key -> Int -> AESState -> IO ()
+@@ -353,9 +366,9 @@ mixColumns state = pr 0 >> pr 1 >> pr 2
+ shiftRowsInv :: AESState -> IO ()
+ shiftRowsInv blk = do
+ 	r32 blk 0 >>= w32 blk 0 . mrsbox32
+-	r32 blk 1 >>= \t1 -> w32 blk 1 $ mrsbox32 $ rotateL t1 8
+-	r32 blk 2 >>= \t2 -> w32 blk 2 $ mrsbox32 $ rotateL t2 16
+-	r32 blk 3 >>= \t3 -> w32 blk 3 $ mrsbox32 $ rotateL t3 24
++	r32 blk 1 >>= \t1 -> w32 blk 1 $ mrsbox32 $ rotateL' t1 8
++	r32 blk 2 >>= \t2 -> w32 blk 2 $ mrsbox32 $ rotateL' t2 16
++	r32 blk 3 >>= \t3 -> w32 blk 3 $ mrsbox32 $ rotateL' t3 24
+ 
+ {-# INLINE mixColumnsInv #-}
+ mixColumnsInv :: AESState -> IO ()
diff -rN -u old-haskell-cryptocipher//patches/series new-haskell-cryptocipher//patches/series
--- old-haskell-cryptocipher//patches/series	1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-cryptocipher//patches/series	2012-06-08 09:18:31.562324957 +0000
@@ -0,0 +1 @@
+fix-AES-on-BigEndian





More information about the Pkg-haskell-commits mailing list