Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181016
b: refs/heads/master
c: 0d8fb0a
h: refs/heads/master
v: v3
  • Loading branch information
Richard Hartmann authored and Herbert Xu committed Feb 16, 2010
1 parent 4a2e512 commit 2ea9e42
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3922538fe1625e6ddded56c08c290b3440846cfd
refs/heads/master: 0d8fb0a139093297851f56e2070bf580e9667dd7
18 changes: 9 additions & 9 deletions trunk/crypto/blowfish.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* Cryptographic API.
*
* Blowfish Cipher Algorithm, by Bruce Schneier.
Expand Down Expand Up @@ -299,7 +299,7 @@ static const u32 bf_sbox[256 * 4] = {
0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6,
};

/*
/*
* Round loop unrolling macros, S is a pointer to a S-Box array
* organized in 4 unsigned longs at a row.
*/
Expand All @@ -315,7 +315,7 @@ static const u32 bf_sbox[256 * 4] = {

/*
* The blowfish encipher, processes 64-bit blocks.
* NOTE: This function MUSTN'T respect endianess
* NOTE: This function MUSTN'T respect endianess
*/
static void encrypt_block(struct bf_ctx *bctx, u32 *dst, u32 *src)
{
Expand Down Expand Up @@ -395,7 +395,7 @@ static void bf_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
out_blk[1] = cpu_to_be32(yl);
}

/*
/*
* Calculates the blowfish S and P boxes for encryption and decryption.
*/
static int bf_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
Expand All @@ -417,10 +417,10 @@ static int bf_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)

/* Actual subkey generation */
for (j = 0, i = 0; i < 16 + 2; i++) {
temp = (((u32 )key[j] << 24) |
((u32 )key[(j + 1) % keylen] << 16) |
((u32 )key[(j + 2) % keylen] << 8) |
((u32 )key[(j + 3) % keylen]));
temp = (((u32)key[j] << 24) |
((u32)key[(j + 1) % keylen] << 16) |
((u32)key[(j + 2) % keylen] << 8) |
((u32)key[(j + 3) % keylen]));

P[i] = P[i] ^ temp;
j = (j + 4) % keylen;
Expand All @@ -444,7 +444,7 @@ static int bf_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
S[count + 1] = data[1];
}
}

/* Bruce says not to bother with the weak key check. */
return 0;
}
Expand Down

0 comments on commit 2ea9e42

Please sign in to comment.