1.be_le.patch
PATCH 1/5 1.be_le.patch
crypto/aes.c +27 -30
@@ -58,6 +58,7 @@#include <linux/errno.h> #include <linux/crypto.h> #include <asm/byteorder.h> +#include "helper.h" #define AES_MIN_KEY_SIZE 16#define AES_MAX_KEY_SIZE 32
@@ -73,9 +74,6 @@ byte(const u32 x, const unsigned n)return x >> (n <<3 ); } -#define u32_in (x) le32_to_cpu(*(const u32 *)(x)) -#define u32_out (to, from) (*(u32 *)(to) = cpu_to_le32(from)) -struct aes_ctx {int key_length;u32 E[60 ];
@@ -265,10 +263,10 @@ aes_set_key(void *ctx_arg, const u8 *in_ ctx->key_length = key_len; -E_KEY [0 ] =u32_in (in_key); -E_KEY [1 ] =u32_in (in_key +4 ); -E_KEY [2 ] =u32_in (in_key +8 ); -E_KEY [3 ] =u32_in (in_key +12 ); +E_KEY [0 ] =load_le32 (in_key,0 ); +E_KEY [1 ] =load_le32 (in_key,1 ); +E_KEY [2 ] =load_le32 (in_key,2 ); +E_KEY [3 ] =load_le32 (in_key,3 );switch (key_len) {case 16 :
@@ -278,17 +276,17 @@ aes_set_key(void *ctx_arg, const u8 *in_break ;case 24 : -E_KEY [4 ] =u32_in (in_key +16 ); - t =E_KEY [5 ] =u32_in (in_key +20 ); +E_KEY [4 ] =load_le32 (in_key,4 ); + t =E_KEY [5 ] =load_le32 (in_key,5 );for (i =0 ; i <8 ; ++i)loop6 (i);break ;case 32 : -E_KEY [4 ] =u32_in (in_key +16 ); -E_KEY [5 ] =u32_in (in_key +20 ); -E_KEY [6 ] =u32_in (in_key +24 ); - t =E_KEY [7 ] =u32_in (in_key +28 ); +E_KEY [4 ] =load_le32 (in_key,4 ); +E_KEY [5 ] =load_le32 (in_key,5 ); +E_KEY [6 ] =load_le32 (in_key,6 ); + t =E_KEY [7 ] =load_le32 (in_key,7 );for (i =0 ; i <7 ; ++i)loop8 (i);break ;
@@ -327,10 +325,10 @@ static void aes_encrypt(void *ctx_arg, uu32 b0[4 ], b1[4 ];const u32 *kp =E_KEY +4 ; - b0[0 ] =u32_in (in) ^E_KEY [0 ]; - b0[1 ] =u32_in (in +4 ) ^E_KEY [1 ]; - b0[2 ] =u32_in (in +8 ) ^E_KEY [2 ]; - b0[3 ] =u32_in (in +12 ) ^E_KEY [3 ]; + b0[0 ] =load_le32 (in,0 ) ^E_KEY [0 ]; + b0[1 ] =load_le32 (in,1 ) ^E_KEY [1 ]; + b0[2 ] =load_le32 (in,2 ) ^E_KEY [2 ]; + b0[3 ] =load_le32 (in,3 ) ^E_KEY [3 ];if (ctx->key_length >24 ) {f_nround (b1, b0, kp);
@@ -353,10 +351,10 @@ static void aes_encrypt(void *ctx_arg, uf_nround (b1, b0, kp);f_lround (b0, b1, kp); -u32_out (out, b0[0 ]); -u32_out (out +4 , b0[1 ]); -u32_out (out +8 , b0[2 ]); -u32_out (out +12 , b0[3 ]); +store_le32 (out,0 , b0[0 ]); +store_le32 (out,1 , b0[1 ]); +store_le32 (out,2 , b0[2 ]); +store_le32 (out,3 , b0[3 ]); }/* decrypt a block of text */
@@ -381,10 +379,10 @@ static void aes_decrypt(void *ctx_arg, uconst int key_len = ctx->key_length;const u32 *kp =D_KEY + key_len +20 ; - b0[0 ] =u32_in (in) ^E_KEY [key_len +24 ]; - b0[1 ] =u32_in (in +4 ) ^E_KEY [key_len +25 ]; - b0[2 ] =u32_in (in +8 ) ^E_KEY [key_len +26 ]; - b0[3 ] =u32_in (in +12 ) ^E_KEY [key_len +27 ]; + b0[0 ] =load_le32 (in,0 ) ^E_KEY [key_len +24 ]; + b0[1 ] =load_le32 (in,1 ) ^E_KEY [key_len +25 ]; + b0[2 ] =load_le32 (in,2 ) ^E_KEY [key_len +26 ]; + b0[3 ] =load_le32 (in,3 ) ^E_KEY [key_len +27 ];if (key_len >24 ) {i_nround (b1, b0, kp);
@@ -407,10 +405,10 @@ static void aes_decrypt(void *ctx_arg, ui_nround (b1, b0, kp);i_lround (b0, b1, kp); -u32_out (out, b0[0 ]); -u32_out (out +4 , b0[1 ]); -u32_out (out +8 , b0[2 ]); -u32_out (out +12 , b0[3 ]); +store_le32 (out,0 , b0[0 ]); +store_le32 (out,1 , b0[1 ]); +store_le32 (out,2 , b0[2 ]); +store_le32 (out,3 , b0[3 ]); }
@@ -448,4 +446,3 @@ module_exit(aes_fini);MODULE_DESCRIPTION ("Rijndael (AES) Cipher Algorithm" );MODULE_LICENSE ("Dual BSD/GPL" ); -
crypto/anubis.c +15 -30
113 lines not on this page · raw message
crypto/blowfish.c +9 -12
@@ -21,6 +21,7 @@#include <linux/mm.h> #include <asm/scatterlist.h> #include <linux/crypto.h> +#include "helper.h" #define BF_BLOCK_SIZE 8#define BF_MIN_KEY_SIZE 4
@@ -349,25 +350,21 @@ static void encrypt_block(struct bf_ctxstatic void bf_encrypt (void *ctx,u8 *dst,const u8 *src) { -const __be32 *in_blk = (const __be32 *)src; -__be32 *const out_blk = (__be32 *)dst;u32 in32[2 ], out32[2 ]; - in32[0 ] =be32_to_cpu (in_blk[0 ]); - in32[1 ] =be32_to_cpu (in_blk[1 ]); + in32[0 ] =load_be32 (src,0 ); + in32[1 ] =load_be32 (src,1 );encrypt_block (ctx, out32, in32); - out_blk[0 ] =cpu_to_be32 (out32[0 ]); - out_blk[1 ] =cpu_to_be32 (out32[1 ]); +store_be32 (dst,0 ,out32[0 ]); +store_be32 (dst,1 ,out32[1 ]); }static void bf_decrypt (void *ctx,u8 *dst,const u8 *src) { -const __be32 *in_blk = (const __be32 *)src; -__be32 *const out_blk = (__be32 *)dst;const u32 *P = ((struct bf_ctx *)ctx)->p;const u32 *S = ((struct bf_ctx *)ctx)->s; -u32 yl =be32_to_cpu (in_blk[0 ]); -u32 yr =be32_to_cpu (in_blk[1 ]); +u32 yl =load_be32 (src,0 ); +u32 yr =load_be32 (src,1 );ROUND (yr, yl,17 );ROUND (yl, yr,16 );
@@ -389,8 +386,8 @@ static void bf_decrypt(void *ctx, u8 *ds yl ^=P [1 ]; yr ^=P [0 ]; - out_blk[0 ] =cpu_to_be32 (yr); - out_blk[1 ] =cpu_to_be32 (yl); +store_be32 (dst,0 ,yr); +store_be32 (dst,1 ,yl); }/*
crypto/cast5.c +13 -28
80 lines not on this page · raw message
crypto/cast6.c +29 -54
119 lines not on this page · raw message
crypto/crc32c.c +3 -2
@@ -17,6 +17,7 @@#include <linux/crypto.h> #include <linux/crc32c.h> #include <asm/byteorder.h> +#include "helper.h" #define CHKSUM_BLOCK_SIZE 32#define CHKSUM_DIGEST_SIZE 4
@@ -52,7 +53,7 @@ static int chksum_setkey(void *ctx, cons *flags =CRYPTO_TFM_RES_BAD_KEY_LEN ;return -EINVAL ; } - mctx->crc =__cpu_to_le32 (*(u32 *)key); + mctx->crc =load_le32 (key,0 );return 0 ; }
@@ -71,7 +72,7 @@ static void chksum_final(void *ctx, u8 *struct chksum_ctx *mctx = ctx;u32 mcrc = (mctx->crc ^ ~(u32 )0 ); - *(u32 *)out =__le32_to_cpu (mcrc); +store_le32 (out,0 , mcrc); }static struct crypto_alg alg = {
crypto/deflate.c +0 -1
@@ -222,4 +222,3 @@ module_exit(fini);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Deflate Compression Algorithm for IPCOMP" );MODULE_AUTHOR ("James Morris <[email protected]>" ); -
crypto/des.c +15 -62
119 lines not on this page · raw message
crypto/helper.h +56 -0
56 lines not on this page · raw message
crypto/hmac.c +0 -1
@@ -131,4 +131,3 @@ EXPORT_SYMBOL_GPL(crypto_hmac_init);EXPORT_SYMBOL_GPL (crypto_hmac_update);EXPORT_SYMBOL_GPL (crypto_hmac_final);EXPORT_SYMBOL_GPL (crypto_hmac); -
crypto/internal.h +0 -1
@@ -89,4 +89,3 @@ void crypto_exit_cipher_ops(struct cryptvoid crypto_exit_compress_ops (struct crypto_tfm *tfm);#endif /* _CRYPTO_INTERNAL_H */ -
crypto/khazad.c +5 -36
77 lines not on this page · raw message
crypto/md4.c +3 -10
@@ -37,12 +37,6 @@ struct md4_ctx {u64 byte_count; }; -static inline u32 lshift (u32 x,unsigned int s) -{ - x &=0xFFFFFFFF ; -return ((x << s) &0xFFFFFFFF ) | (x >> (32 - s)); -} -static inline u32 F (u32 x,u32 y,u32 z) {return (x & y) | ((~x) & z);
@@ -58,9 +52,9 @@ static inline u32 H(u32 x, u32 y, u32 z)return x ^ y ^ z; } -#define ROUND1 (a,b,c,d,k,s) (a = lshift(a + F(b,c,d) + k, s)) -#define ROUND2 (a,b,c,d,k,s) (a = lshift(a + G(b,c,d) + k + (u32)0x5A827999,s)) -#define ROUND3 (a,b,c,d,k,s) (a = lshift(a + H(b,c,d) + k + (u32)0x6ED9EBA1,s)) +#define ROUND1 (a,b,c,d,k,s) (a = rol32(a + F(b,c,d) + k, s)) +#define ROUND2 (a,b,c,d,k,s) (a = rol32(a + G(b,c,d) + k + (u32)0x5A827999, s)) +#define ROUND3 (a,b,c,d,k,s) (a = rol32(a + H(b,c,d) + k + (u32)0x6ED9EBA1, s))/* XXX: this stuff can be optimized */ static inline void le32_to_cpu_array (u32 *buf,unsigned int words)
@@ -247,4 +241,3 @@ module_exit(fini);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("MD4 Message Digest Algorithm" ); -
crypto/michael_mic.c +7 -21
@@ -14,6 +14,7 @@#include <linux/module.h> #include <linux/string.h> #include <linux/crypto.h> +#include "helper.h" struct michael_mic_ctx {
@@ -43,21 +44,6 @@ do { \ }while (0 ) -static inline u32 get_le32(const u8 *p) -{ -return p[0 ] | (p[1 ] <<8 ) | (p[2 ] <<16 ) | (p[3 ] <<24 ); -} - - -static inline void put_le32 (u8 *p,u32 v) -{ - p[0 ] = v; - p[1 ] = v >>8 ; - p[2 ] = v >>16 ; - p[3 ] = v >>24 ; -} - - static void michael_init(void *ctx) {struct michael_mic_ctx *mctx = ctx;
@@ -81,13 +67,13 @@ static void michael_update(void *ctx, coif (mctx->pending_len <4 )return ; - mctx->l ^=get_le32 (mctx->pending); + mctx->l ^=load_le32 (mctx->pending,0 );michael_block (mctx->l, mctx->r); mctx->pending_len =0 ; }while (len >=4 ) { - mctx->l ^=get_le32 (data); + mctx->l ^=load_le32 (data,0 );michael_block (mctx->l, mctx->r); data +=4 ; len -=4 ;
@@ -125,8 +111,8 @@ static void michael_final(void *ctx, u8/* l ^= 0; */ michael_block (mctx->l, mctx->r); -put_le32 (out, mctx->l); -put_le32 (out +4 , mctx->r); +store_le32 (out,0 , mctx->l); +store_le32 (out,1 , mctx->r); }
@@ -139,8 +125,8 @@ static int michael_setkey(void *ctx, con *flags =CRYPTO_TFM_RES_BAD_KEY_LEN ;return -EINVAL ; } - mctx->l =get_le32 (key); - mctx->r =get_le32 (key +4 ); + mctx->l =load_le32 (key,0 ); + mctx->r =load_le32 (key,1 );return 0 ; }
crypto/serpent.c +22 -27
83 lines not on this page · raw message
crypto/sha1.c +5 -18
@@ -23,6 +23,7 @@#include <linux/cryptohash.h> #include <asm/scatterlist.h> #include <asm/byteorder.h> +#include "helper.h" #define SHA1_DIGEST_SIZE 20#define SHA1_HMAC_BLOCK_SIZE 64
@@ -67,25 +68,15 @@ static void sha1_update(void *ctx, constmemcpy (&sctx->buffer[j], &data[i], len - i); } -/* Add padding and return the message digest. */ static void sha1_final (void * ctx,u8 *out) {struct sha1_ctx *sctx = ctx; -u32 i, j, index, padlen; -u64 t; +u32 i, index, padlen;u8 bits[8 ] = {0 , };static const u8 padding[64 ] = {0x80 , }; - t = sctx->count; - bits[7 ] =0xff & t; t>>=8 ; - bits[6 ] =0xff & t; t>>=8 ; - bits[5 ] =0xff & t; t>>=8 ; - bits[4 ] =0xff & t; t>>=8 ; - bits[3 ] =0xff & t; t>>=8 ; - bits[2 ] =0xff & t; t>>=8 ; - bits[1 ] =0xff & t; t>>=8 ; - bits[0 ] =0xff & t; +store_be64 (bits,0 , sctx->count);/* Pad out to 56 mod 64 */ index = (sctx->count >>3 ) &0x3f ;
@@ -96,12 +87,8 @@ static void sha1_final(void* ctx, u8 *ousha1_update (sctx, bits,sizeof bits);/* Store state in digest */ -for (i = j =0 ; i <5 ; i++, j +=4 ) { -u32 t2 = sctx->state[i]; - out[j+3 ] = t2 &0xff ; t2>>=8 ; - out[j+2 ] = t2 &0xff ; t2>>=8 ; - out[j+1 ] = t2 &0xff ; t2>>=8 ; - out[j ] = t2 &0xff ; +for (i =0 ; i <5 ; i++) { +store_be32 (out,i, sctx->state[i]); }/* Wipe context */
crypto/sha256.c +8 -20
@@ -22,6 +22,7 @@#include <linux/crypto.h> #include <asm/scatterlist.h> #include <asm/byteorder.h> +#include "helper.h" #define SHA256_DIGEST_SIZE 32#define SHA256_HMAC_BLOCK_SIZE 64
@@ -58,7 +59,7 @@ static inline u32 Maj(u32 x, u32 y, u32static inline void LOAD_OP (int I ,u32 *W ,const u8 *input) { -W [I ] =__be32_to_cpu ( ((__be32 *)(input))[I ] ); +W [I ] =load_be32 (input,I ); }static inline void BLEND_OP (int I ,u32 *W )
@@ -280,21 +281,13 @@ static void sha256_final(void* ctx, u8 * {struct sha256_ctx *sctx = ctx;u8 bits[8 ]; -unsigned int index, pad_len, t; -int i, j; +unsigned int index, pad_len; +int i;static const u8 padding[64 ] = {0x80 , };/* Save number of bits */ - t = sctx->count[0 ]; - bits[7 ] = t; t >>=8 ; - bits[6 ] = t; t >>=8 ; - bits[5 ] = t; t >>=8 ; - bits[4 ] = t; - t = sctx->count[1 ]; - bits[3 ] = t; t >>=8 ; - bits[2 ] = t; t >>=8 ; - bits[1 ] = t; t >>=8 ; - bits[0 ] = t; +store_be32 (bits,1 , sctx->count[0 ]); +store_be32 (bits,0 , sctx->count[1 ]);/* Pad out to 56 mod 64. */ index = (sctx->count[0 ] >>3 ) &0x3f ;
@@ -305,18 +298,13 @@ static void sha256_final(void* ctx, u8 *sha256_update (sctx, bits,8 );/* Store state in digest */ -for (i = j =0 ; i <8 ; i++, j +=4 ) { - t = sctx->state[i]; - out[j+3 ] = t; t >>=8 ; - out[j+2 ] = t; t >>=8 ; - out[j+1 ] = t; t >>=8 ; - out[j ] = t; +for (i =0 ; i <8 ; i++) { +store_be32 (out,i, sctx->state[i]); }/* Zeroize sensitive information. */ memset (sctx,0 ,sizeof (*sctx)); } -static struct crypto_alg alg = { .cra_name ="sha256" ,
crypto/sha512.c +11 -33
72 lines not on this page · raw message
crypto/tea.c +25 -35
148 lines not on this page · raw message
crypto/tgr192.c +8 -44
80 lines not on this page · raw message
crypto/twofish.c +13 -13
@@ -42,6 +42,7 @@#include <linux/types.h> #include <linux/errno.h> #include <linux/crypto.h> +#include "helper.h" /* The large precomputed tables for the Twofish cipher (twofish.c)
@@ -540,9 +541,9 @@ static const u8 calc_sb_tbl[512] = {#define CALC_K (a, j, k, l, m, n) \ x = CALC_K_2 (k, l, k, l, 0); \ y = CALC_K_2 (m, n, m, n, 4); \ - y = (y << 8) + (y >> 24); \ + y = rol32(y, 8); \ x += y; y += x; ctx->a[j] = x; \ - ctx->a[(j) + 1] = (y << 9) + (y >> 23) + ctx->a[(j) + 1] = rol32(y, 9)#define CALC_K192_2 (a, b, c, d, j) \ CALC_K_2 (q0[a ^ key[(j) + 16]], \
@@ -553,9 +554,9 @@ static const u8 calc_sb_tbl[512] = {#define CALC_K192 (a, j, k, l, m, n) \ x = CALC_K192_2 (l, l, k, k, 0); \ y = CALC_K192_2 (n, n, m, m, 4); \ - y = (y << 8) + (y >> 24); \ + y = rol32(y, 8); \ x += y; y += x; ctx->a[j] = x; \ - ctx->a[(j) + 1] = (y << 9) + (y >> 23) + ctx->a[(j) + 1] = rol32(y, 9)#define CALC_K256_2 (a, b, j) \ CALC_K192_2 (q1[b ^ key[(j) + 24]], \
@@ -566,9 +567,9 @@ static const u8 calc_sb_tbl[512] = {#define CALC_K256 (a, j, k, l, m, n) \ x = CALC_K256_2 (k, l, 0); \ y = CALC_K256_2 (m, n, 4); \ - y = (y << 8) + (y >> 24); \ + y = rol32(y, 8); \ x += y; y += x; ctx->a[j] = x; \ - ctx->a[(j) + 1] = (y << 9) + (y >> 23) + ctx->a[(j) + 1] = rol32(y, 9)/* Macros to compute the g() function in the encryption and decryption
@@ -620,14 +621,14 @@ static const u8 calc_sb_tbl[512] = {* OUTUNPACK unpacks word number n from the variable named by x, using * whitening subkey number m. */ -#define INPACK (n, x, m) \ - x = in[4 * (n)] ^ (in[4 * (n) + 1] << 8) \ - ^ (in[4 * (n) + 2] << 16) ^ (in[4 * (n) + 3] << 24) ^ ctx->w[m] +#define INPACK (n, x, m) { \ + x = load_le32(in,n) ^ ctx->w[m]; \ +} -#define OUTUNPACK (n, x, m) \ +#define OUTUNPACK (n, x, m) { \ x ^= ctx->w[m]; \ - out[4 * (n)] = x; out[4 * (n) + 1] = x >> 8; \ - out[4 * (n) + 2] = x >> 16; out[4 * (n) + 3] = x >> 24 + store_le32(out,n,x); \ +}#define TF_MIN_KEY_SIZE 16#define TF_MAX_KEY_SIZE 32
@@ -867,7 +868,6 @@ static void twofish_decrypt(void *cx, u8OUTUNPACK (1 , b,1 );OUTUNPACK (2 , c,2 );OUTUNPACK (3 , d,3 ); - }static struct crypto_alg alg = {
crypto/wp512.c +4 -23
@@ -24,6 +24,7 @@#include <linux/mm.h> #include <asm/scatterlist.h> #include <linux/crypto.h> +#include "helper.h" #define WP512_DIGEST_SIZE 64#define WP384_DIGEST_SIZE 48
@@ -778,18 +779,9 @@ static void wp512_process_buffer(structu64 block[8 ];/* mu(buffer) */ u64 state[8 ];/* the cipher state */ u64 L [8 ]; -u8 *buffer = wctx->buffer; -for (i =0 ; i <8 ; i++, buffer +=8 ) { - block[i] = - (((u64 )buffer[0 ] ) <<56 ) ^ - (((u64 )buffer[1 ] &0xffL ) <<48 ) ^ - (((u64 )buffer[2 ] &0xffL ) <<40 ) ^ - (((u64 )buffer[3 ] &0xffL ) <<32 ) ^ - (((u64 )buffer[4 ] &0xffL ) <<24 ) ^ - (((u64 )buffer[5 ] &0xffL ) <<16 ) ^ - (((u64 )buffer[6 ] &0xffL ) <<8 ) ^ - (((u64 )buffer[7 ] &0xffL ) ); +for (i =0 ; i <8 ; i++) { + block[i] =load_be64 (wctx->buffer,i); } state[0 ] = block[0 ] ^ (K [0 ] = wctx->hash[0 ]);
@@ -985,7 +977,6 @@ static void wp512_process_buffer(struct wctx->hash[5 ] ^= state[5 ] ^ block[5 ]; wctx->hash[6 ] ^= state[6 ] ^ block[6 ]; wctx->hash[7 ] ^= state[7 ] ^ block[7 ]; - }static void wp512_init (void *ctx) {
@@ -1058,7 +1049,6 @@ static void wp512_update(void *ctx, cons wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos; - }static void wp512_final (void *ctx,u8 *out)
@@ -1069,7 +1059,6 @@ static void wp512_final(void *ctx, u8 *ou8 *bitLength = wctx->bitLength;int bufferBits = wctx->bufferBits;int bufferPos = wctx->bufferPos; -u8 *digest = out; buffer[bufferPos] |=0x80U >> (bufferBits &7 ); bufferPos++;
@@ -1089,15 +1078,7 @@ static void wp512_final(void *ctx, u8 *o bitLength, WP512_LENGTHBYTES);wp512_process_buffer (wctx);for (i =0 ; i <WP512_DIGEST_SIZE /8 ; i++) { - digest[0 ] = (u8)(wctx->hash[i] >>56 ); - digest[1 ] = (u8)(wctx->hash[i] >>48 ); - digest[2 ] = (u8)(wctx->hash[i] >>40 ); - digest[3 ] = (u8)(wctx->hash[i] >>32 ); - digest[4 ] = (u8)(wctx->hash[i] >>24 ); - digest[5 ] = (u8)(wctx->hash[i] >>16 ); - digest[6 ] = (u8)(wctx->hash[i] >>8 ); - digest[7 ] = (u8)(wctx->hash[i] ); - digest +=8 ; +store_be64 (out,i, wctx->hash[i]); } wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos;
Herbert Xu
maintainercrypto/aes.c aes_set_key(void *ctx_arg, const u8 *in_ · line 269
Quoted 13 lines · Denis Vlasenko
crypto/aes.c +4
-4@@ -265,10 +263,10 @@ aes_set_key(void *ctx_arg, const u8 *in_ ctx->key_length = key_len; -E_KEY [0 ] =u32_in (in_key); -E_KEY [1 ] =u32_in (in_key +4 ); -E_KEY [2 ] =u32_in (in_key +8 ); -E_KEY [3 ] =u32_in (in_key +12 ); +E_KEY [0 ] =load_le32 (in_key,0 ); +E_KEY [1 ] =load_le32 (in_key,1 ); +E_KEY [2 ] =load_le32 (in_key,2 ); +E_KEY [3 ] =load_le32 (in_key,3 );
Please insert a space after the comma.
crypto/aes.c module_exit(aes_fini); · line 451
Quoted 5 lines
crypto/aes.c +0
-1@@ -448,4 +446,3 @@ module_exit(aes_fini);MODULE_DESCRIPTION ("Rijndael (AES) Cipher Algorithm" );MODULE_LICENSE ("Dual BSD/GPL" ); -
Please drop unrelated hunks like this.
crypto/des.c not_weak: · line 1117
Quoted 8 lines
crypto/des.c +1
-3@@ -1159,9 +1114,7 @@ not_weak: w |= (b1[k[18 +24 ]] | b0[k[19 +24 ]]) <<4 ; w |= (b1[k[20 +24 ]] | b0[k[21 +24 ]]) <<2 ; w |= b1[k[22 +24 ]] | b0[k[23 +24 ]]; - -ROR (w,4 ,28 );/* could be eliminated */ - expkey[1 ] = w; + expkey[1 ] =ror32 (w,4 );/* could be eliminated */
Please split the ROR => ror32 change out.
crypto/helper.h
Quoted 3 lines
diff -urpN
linux-2.6.12.0.orig/crypto/helper.hlinux-2.6.12.1.n/crypto/helper.hcrypto/helper.h +0
-0
This should probably be moved to include/linux. There's crypto stuff living under arch/ and drivers/crypto.
This patch is really good idea overall.
Thanks,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtQuoted 6 lines · Herbert Xu
Quoted 5 lines · Denis Vlasenko
crypto/aes.c +0
-0@@ -265,10 +263,10 @@ aes_set_key(void *ctx_arg, const u8 *in_ ctx->key_length = key_len;
Quoted 10 lines
crypto/aes.c aes_set_key(void *ctx_arg, const u8 *in_ · line 269
Quoted 8 lines
crypto/aes.c +4
-4-E_KEY [0 ] =u32_in (in_key); -E_KEY [1 ] =u32_in (in_key +4 ); -E_KEY [2 ] =u32_in (in_key +8 ); -E_KEY [3 ] =u32_in (in_key +12 ); +E_KEY [0 ] =load_le32 (in_key,0 ); +E_KEY [1 ] =load_le32 (in_key,1 ); +E_KEY [2 ] =load_le32 (in_key,2 ); +E_KEY [3 ] =load_le32 (in_key,3 );Please insert a space after the comma.
The second param is an index in implicit vector. Sably store_xxx and load_xxx syntax makes that non-obvious.
I deliberately did not put space there, trying to
give reader a hint that "dst,n" part is really
"dst[n]":
store_le32(dst,0, a); // like "dst[0] = a" but with (u32*) cast on dst + le32 conversion on a store_le32(dst,1, b);
Do you still want space added?
--
vda