diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-22 15:51:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-22 15:51:33 -0400 |
commit | 6bbd9b6d694ff7242d63cda2faac4bd59ee4328e (patch) | |
tree | 0641aa896e2ea01f4692973e5fbea429408854f4 /crypto/serpent.c | |
parent | a489d159229fcc07bbb7566ac4fac745b79197ad (diff) | |
parent | 3c164bd8153c4644a22dc2101b003c67cd2a0d0a (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (64 commits)
[BLOCK] dm-crypt: trivial comment improvements
[CRYPTO] api: Deprecate crypto_digest_* and crypto_alg_available
[CRYPTO] padlock: Convert padlock-sha to use crypto_hash
[CRYPTO] users: Use crypto_comp and crypto_has_*
[CRYPTO] api: Add crypto_comp and crypto_has_*
[CRYPTO] users: Use crypto_hash interface instead of crypto_digest
[SCSI] iscsi: Use crypto_hash interface instead of crypto_digest
[CRYPTO] digest: Remove old HMAC implementation
[CRYPTO] doc: Update documentation for hash and me
[SCTP]: Use HMAC template and hash interface
[IPSEC]: Use HMAC template and hash interface
[CRYPTO] tcrypt: Use HMAC template and hash interface
[CRYPTO] hmac: Add crypto template implementation
[CRYPTO] digest: Added user API for new hash type
[CRYPTO] api: Mark parts of cipher interface as deprecated
[PATCH] scatterlist: Add const to sg_set_buf/sg_init_one pointer argument
[CRYPTO] drivers: Remove obsolete block cipher operations
[CRYPTO] users: Use block ciphers where applicable
[SUNRPC] GSS: Use block ciphers where applicable
[IPSEC] ESP: Use block ciphers where applicable
...
Diffstat (limited to 'crypto/serpent.c')
-rw-r--r-- | crypto/serpent.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/crypto/serpent.c b/crypto/serpent.c index de60cdddbf4a..465d091cd3ec 100644 --- a/crypto/serpent.c +++ b/crypto/serpent.c | |||
@@ -216,7 +216,7 @@ struct serpent_ctx { | |||
216 | 216 | ||
217 | 217 | ||
218 | static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, | 218 | static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, |
219 | unsigned int keylen, u32 *flags) | 219 | unsigned int keylen) |
220 | { | 220 | { |
221 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); | 221 | struct serpent_ctx *ctx = crypto_tfm_ctx(tfm); |
222 | u32 *k = ctx->expkey; | 222 | u32 *k = ctx->expkey; |
@@ -224,13 +224,6 @@ static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key, | |||
224 | u32 r0,r1,r2,r3,r4; | 224 | u32 r0,r1,r2,r3,r4; |
225 | int i; | 225 | int i; |
226 | 226 | ||
227 | if ((keylen < SERPENT_MIN_KEY_SIZE) | ||
228 | || (keylen > SERPENT_MAX_KEY_SIZE)) | ||
229 | { | ||
230 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
231 | return -EINVAL; | ||
232 | } | ||
233 | |||
234 | /* Copy key, add padding */ | 227 | /* Copy key, add padding */ |
235 | 228 | ||
236 | for (i = 0; i < keylen; ++i) | 229 | for (i = 0; i < keylen; ++i) |
@@ -497,21 +490,15 @@ static struct crypto_alg serpent_alg = { | |||
497 | }; | 490 | }; |
498 | 491 | ||
499 | static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, | 492 | static int tnepres_setkey(struct crypto_tfm *tfm, const u8 *key, |
500 | unsigned int keylen, u32 *flags) | 493 | unsigned int keylen) |
501 | { | 494 | { |
502 | u8 rev_key[SERPENT_MAX_KEY_SIZE]; | 495 | u8 rev_key[SERPENT_MAX_KEY_SIZE]; |
503 | int i; | 496 | int i; |
504 | 497 | ||
505 | if ((keylen < SERPENT_MIN_KEY_SIZE) | ||
506 | || (keylen > SERPENT_MAX_KEY_SIZE)) { | ||
507 | *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
508 | return -EINVAL; | ||
509 | } | ||
510 | |||
511 | for (i = 0; i < keylen; ++i) | 498 | for (i = 0; i < keylen; ++i) |
512 | rev_key[keylen - i - 1] = key[i]; | 499 | rev_key[keylen - i - 1] = key[i]; |
513 | 500 | ||
514 | return serpent_setkey(tfm, rev_key, keylen, flags); | 501 | return serpent_setkey(tfm, rev_key, keylen); |
515 | } | 502 | } |
516 | 503 | ||
517 | static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) | 504 | static void tnepres_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) |