[v3 PATCH 24/31] crypto: ixp4xx - Remove rfc3686 implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The rfc3686 implementation in ixp4xx is pretty much the same
as the generic rfc3686 wrapper.  So it can simply be removed to
reduce complexity.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---

 drivers/crypto/ixp4xx_crypto.c |   53 -----------------------------------------
 1 file changed, 53 deletions(-)

diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index f478bb0a566af..c93f5db8d0503 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -180,7 +180,6 @@ struct ixp_ctx {
 	int enckey_len;
 	u8 enckey[MAX_KEYLEN];
 	u8 salt[MAX_IVLEN];
-	u8 nonce[CTR_RFC3686_NONCE_SIZE];
 	unsigned salted;
 	atomic_t configuring;
 	struct completion completion;
@@ -848,22 +847,6 @@ static int ablk_des3_setkey(struct crypto_skcipher *tfm, const u8 *key,
 	       ablk_setkey(tfm, key, key_len);
 }
 
-static int ablk_rfc3686_setkey(struct crypto_skcipher *tfm, const u8 *key,
-		unsigned int key_len)
-{
-	struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm);
-
-	/* the nonce is stored in bytes at end of key */
-	if (key_len < CTR_RFC3686_NONCE_SIZE)
-		return -EINVAL;
-
-	memcpy(ctx->nonce, key + (key_len - CTR_RFC3686_NONCE_SIZE),
-			CTR_RFC3686_NONCE_SIZE);
-
-	key_len -= CTR_RFC3686_NONCE_SIZE;
-	return ablk_setkey(tfm, key, key_len);
-}
-
 static int ablk_perform(struct skcipher_request *req, int encrypt)
 {
 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
@@ -947,28 +930,6 @@ static int ablk_decrypt(struct skcipher_request *req)
 	return ablk_perform(req, 0);
 }
 
-static int ablk_rfc3686_crypt(struct skcipher_request *req)
-{
-	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
-	struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm);
-	u8 iv[CTR_RFC3686_BLOCK_SIZE];
-	u8 *info = req->iv;
-	int ret;
-
-	/* set up counter block */
-        memcpy(iv, ctx->nonce, CTR_RFC3686_NONCE_SIZE);
-	memcpy(iv + CTR_RFC3686_NONCE_SIZE, info, CTR_RFC3686_IV_SIZE);
-
-	/* initialize counter portion of counter block */
-	*(__be32 *)(iv + CTR_RFC3686_NONCE_SIZE + CTR_RFC3686_IV_SIZE) =
-		cpu_to_be32(1);
-
-	req->iv = iv;
-	ret = ablk_perform(req, 1);
-	req->iv = info;
-	return ret;
-}
-
 static int aead_perform(struct aead_request *req, int encrypt,
 		int cryptoffset, int eff_cryptlen, u8 *iv)
 {
@@ -1269,20 +1230,6 @@ static struct ixp_alg ixp4xx_algos[] = {
 	},
 	.cfg_enc = CIPH_ENCR | MOD_AES | MOD_CTR,
 	.cfg_dec = CIPH_ENCR | MOD_AES | MOD_CTR,
-}, {
-	.crypto	= {
-		.base.cra_name		= "rfc3686(ctr(aes))",
-		.base.cra_blocksize	= 1,
-
-		.min_keysize		= AES_MIN_KEY_SIZE,
-		.max_keysize		= AES_MAX_KEY_SIZE,
-		.ivsize			= AES_BLOCK_SIZE,
-		.setkey			= ablk_rfc3686_setkey,
-		.encrypt		= ablk_rfc3686_crypt,
-		.decrypt		= ablk_rfc3686_crypt,
-	},
-	.cfg_enc = CIPH_ENCR | MOD_AES | MOD_CTR,
-	.cfg_dec = CIPH_ENCR | MOD_AES | MOD_CTR,
 } };
 
 static struct ixp_aead_alg ixp4xx_aeads[] = {



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux