diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-06 01:39:33 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-12-06 01:39:33 +0100 |
commit | 6533e74370acfa51653608b1dc5e1292c72970c9 (patch) | |
tree | dbd3b13cb10df6f341a82a5a449fcf5a4b9d9b66 /des.c | |
parent | a583bb24fb23728c9c4ed6c6c573d526ab654c49 (diff) | |
download | crypto-6533e74370acfa51653608b1dc5e1292c72970c9.zip crypto-6533e74370acfa51653608b1dc5e1292c72970c9.tar.gz |
remove extra spaces
Diffstat (limited to 'des.c')
-rw-r--r-- | des.c | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -1,4 +1,4 @@ -/* +/* * Cryptographic API. * * DES & Triple DES EDE Cipher Algorithms. @@ -9,7 +9,7 @@ * scatterlist interface. Changed LGPL to GPL per section 3 of the LGPL. * * Copyright (c) 1992 Dana L. How. - * Copyright (c) Raimar Falke <rf13@inf.tu-dresden.de> + * Copyright (c) Raimar Falke <rf13@inf.tu-dresden.de> * Copyright (c) Gisle Sælensminde <gisle@ii.uib.no> * Copyright (C) 2001 Niels Möller. * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> @@ -260,7 +260,7 @@ static const u8 parity[] = { static void des_small_fips_encrypt(u32 *expkey, u8 *dst, const u8 *src) { u32 x, y, z; - + x = src[7]; x <<= 8; x |= src[6]; @@ -632,7 +632,7 @@ static void des_small_fips_encrypt(u32 *expkey, u8 *dst, const u8 *src) static void des_small_fips_decrypt(u32 *expkey, u8 *dst, const u8 *src) { u32 x, y, z; - + x = src[7]; x <<= 8; x |= src[6]; @@ -1020,7 +1020,7 @@ static int setkey(u32 *expkey, const u8 *key, unsigned int keylen, u32 *flags) n |= parity[key[6]]; n <<= 4; n |= parity[key[7]]; w = 0x88888888L; - + if ((*flags & CRYPTO_TFM_REQ_WEAK_KEY) && !((n - (w >> 3)) & w)) { /* 1 in 10^10 keys passes this test */ if (n < 0x41415151) { @@ -1076,7 +1076,7 @@ static int setkey(u32 *expkey, const u8 *key, unsigned int keylen, u32 *flags) } } } - + goto not_weak; weak: *flags |= CRYPTO_TFM_RES_WEAK_KEY; @@ -1089,7 +1089,7 @@ not_weak: n = 56; b0 = bits0; b1 = bits1; - + do { w = (256 | *key++) << 2; do { @@ -1099,11 +1099,11 @@ not_weak: b0[n] = 4 & w; } while ( w >= 16 ); } while ( n ); - + /* put the bits in the correct places */ n = 16; k = rotors; - + do { w = (b1[k[ 0 ]] | b0[k[ 1 ]]) << 4; w |= (b1[k[ 2 ]] | b0[k[ 3 ]]) << 2; @@ -1121,7 +1121,7 @@ not_weak: w |= (b1[k[20 ]] | b0[k[21 ]]) << 2; w |= b1[k[22 ]] | b0[k[23 ]]; expkey[0] = w; - + w = (b1[k[ 0+24]] | b0[k[ 1+24]]) << 4; w |= (b1[k[ 2+24]] | b0[k[ 3+24]]) << 2; w |= b1[k[ 4+24]] | b0[k[ 5+24]]; @@ -1137,7 +1137,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; @@ -1163,7 +1163,7 @@ void des_decrypt(void *ctx, u8 *dst, const u8 *src) des_small_fips_decrypt(((struct des_ctx *)ctx)->expkey, dst, src); } -/* +/* * RFC2451: * * For DES-EDE3, there is no known need to reject weak or @@ -1182,27 +1182,27 @@ int des3_ede_setkey(void *ctx, const u8 *key, unsigned int i, off; struct des3_ede_ctx *dctx = ctx; - if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && + if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], DES_KEY_SIZE))) { *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED; return -1; } - + for (i = 0, off = 0; i < 3; i++, off += DES_EXPKEY_WORDS, key += DES_KEY_SIZE) { int ret = setkey(&dctx->expkey[off], key, DES_KEY_SIZE, flags); if (ret < 0) return ret; - } + } return 0; } void des3_ede_encrypt(void *ctx, u8 *dst, const u8 *src) { struct des3_ede_ctx *dctx = ctx; - + des_small_fips_encrypt(dctx->expkey, dst, src); des_small_fips_decrypt(&dctx->expkey[DES_EXPKEY_WORDS], dst, dst); des_small_fips_encrypt(&dctx->expkey[DES_EXPKEY_WORDS * 2], dst, dst); |