cipher.c (9624d5c9c7ff6836bbf9f9b230fd1fcf3d56f91a) | cipher.c (231baecdef7a906579925ccf1bd45aa734f32320) |
---|---|
1/* 2 * Copyright 2016 Broadcom 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License, version 2, as 6 * published by the Free Software Foundation (the "GPL"). 7 * 8 * This program is distributed in the hope that it will be useful, but --- 703 unchanged lines hidden (view full) --- 712 int err = 0; 713 unsigned int chunksize = 0; /* length of hash carry + new data */ 714 /* 715 * length of new data, not from hash carry, to be submitted in 716 * this hw request 717 */ 718 unsigned int new_data_len; 719 | 1/* 2 * Copyright 2016 Broadcom 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License, version 2, as 6 * published by the Free Software Foundation (the "GPL"). 7 * 8 * This program is distributed in the hope that it will be useful, but --- 703 unchanged lines hidden (view full) --- 712 int err = 0; 713 unsigned int chunksize = 0; /* length of hash carry + new data */ 714 /* 715 * length of new data, not from hash carry, to be submitted in 716 * this hw request 717 */ 718 unsigned int new_data_len; 719 |
720 unsigned int chunk_start = 0; | 720 unsigned int __maybe_unused chunk_start = 0; |
721 u32 db_size; /* Length of data field, incl gcm and hash padding */ 722 int pad_len = 0; /* total pad len, including gcm, hash, stat padding */ 723 u32 data_pad_len = 0; /* length of GCM/CCM padding */ 724 u32 stat_pad_len = 0; /* length of padding to align STATUS word */ 725 struct brcm_message *mssg; /* mailbox message */ 726 struct spu_request_opts req_opts; 727 struct spu_cipher_parms cipher_parms; 728 struct spu_hash_parms hash_parms; --- 941 unchanged lines hidden (view full) --- 1670 * @cl: mailbox client structure for SPU driver 1671 * @msg: mailbox message containing SPU response 1672 */ 1673static void spu_rx_callback(struct mbox_client *cl, void *msg) 1674{ 1675 struct spu_hw *spu = &iproc_priv.spu; 1676 struct brcm_message *mssg = msg; 1677 struct iproc_reqctx_s *rctx; | 721 u32 db_size; /* Length of data field, incl gcm and hash padding */ 722 int pad_len = 0; /* total pad len, including gcm, hash, stat padding */ 723 u32 data_pad_len = 0; /* length of GCM/CCM padding */ 724 u32 stat_pad_len = 0; /* length of padding to align STATUS word */ 725 struct brcm_message *mssg; /* mailbox message */ 726 struct spu_request_opts req_opts; 727 struct spu_cipher_parms cipher_parms; 728 struct spu_hash_parms hash_parms; --- 941 unchanged lines hidden (view full) --- 1670 * @cl: mailbox client structure for SPU driver 1671 * @msg: mailbox message containing SPU response 1672 */ 1673static void spu_rx_callback(struct mbox_client *cl, void *msg) 1674{ 1675 struct spu_hw *spu = &iproc_priv.spu; 1676 struct brcm_message *mssg = msg; 1677 struct iproc_reqctx_s *rctx; |
1678 struct iproc_ctx_s *ctx; 1679 struct crypto_async_request *areq; | |
1680 int err = 0; 1681 1682 rctx = mssg->ctx; 1683 if (unlikely(!rctx)) { 1684 /* This is fatal */ 1685 pr_err("%s(): no request context", __func__); 1686 err = -EFAULT; 1687 goto cb_finish; 1688 } | 1678 int err = 0; 1679 1680 rctx = mssg->ctx; 1681 if (unlikely(!rctx)) { 1682 /* This is fatal */ 1683 pr_err("%s(): no request context", __func__); 1684 err = -EFAULT; 1685 goto cb_finish; 1686 } |
1689 areq = rctx->parent; 1690 ctx = rctx->ctx; | |
1691 1692 /* process the SPU status */ 1693 err = spu->spu_status_process(rctx->msg_buf.rx_stat); 1694 if (err != 0) { 1695 if (err == SPU_INVALID_ICV) 1696 atomic_inc(&iproc_priv.bad_icv); 1697 err = -EBADMSG; 1698 goto cb_finish; --- 118 unchanged lines hidden (view full) --- 1817 unsigned int keylen) 1818{ 1819 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); 1820 u32 tmp[DES_EXPKEY_WORDS]; 1821 1822 if (keylen == DES_KEY_SIZE) { 1823 if (des_ekey(tmp, key) == 0) { 1824 if (crypto_ablkcipher_get_flags(cipher) & | 1687 1688 /* process the SPU status */ 1689 err = spu->spu_status_process(rctx->msg_buf.rx_stat); 1690 if (err != 0) { 1691 if (err == SPU_INVALID_ICV) 1692 atomic_inc(&iproc_priv.bad_icv); 1693 err = -EBADMSG; 1694 goto cb_finish; --- 118 unchanged lines hidden (view full) --- 1813 unsigned int keylen) 1814{ 1815 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); 1816 u32 tmp[DES_EXPKEY_WORDS]; 1817 1818 if (keylen == DES_KEY_SIZE) { 1819 if (des_ekey(tmp, key) == 0) { 1820 if (crypto_ablkcipher_get_flags(cipher) & |
1825 CRYPTO_TFM_REQ_WEAK_KEY) { | 1821 CRYPTO_TFM_REQ_FORBID_WEAK_KEYS) { |
1826 u32 flags = CRYPTO_TFM_RES_WEAK_KEY; 1827 1828 crypto_ablkcipher_set_flags(cipher, flags); 1829 return -EINVAL; 1830 } 1831 } 1832 1833 ctx->cipher_type = CIPHER_TYPE_DES; --- 1037 unchanged lines hidden (view full) --- 2871 switch (ctx->alg->cipher_info.alg) { 2872 case CIPHER_ALG_DES: 2873 if (ctx->enckeylen == DES_KEY_SIZE) { 2874 u32 tmp[DES_EXPKEY_WORDS]; 2875 u32 flags = CRYPTO_TFM_RES_WEAK_KEY; 2876 2877 if (des_ekey(tmp, keys.enckey) == 0) { 2878 if (crypto_aead_get_flags(cipher) & | 1822 u32 flags = CRYPTO_TFM_RES_WEAK_KEY; 1823 1824 crypto_ablkcipher_set_flags(cipher, flags); 1825 return -EINVAL; 1826 } 1827 } 1828 1829 ctx->cipher_type = CIPHER_TYPE_DES; --- 1037 unchanged lines hidden (view full) --- 2867 switch (ctx->alg->cipher_info.alg) { 2868 case CIPHER_ALG_DES: 2869 if (ctx->enckeylen == DES_KEY_SIZE) { 2870 u32 tmp[DES_EXPKEY_WORDS]; 2871 u32 flags = CRYPTO_TFM_RES_WEAK_KEY; 2872 2873 if (des_ekey(tmp, keys.enckey) == 0) { 2874 if (crypto_aead_get_flags(cipher) & |
2879 CRYPTO_TFM_REQ_WEAK_KEY) { | 2875 CRYPTO_TFM_REQ_FORBID_WEAK_KEYS) { |
2880 crypto_aead_set_flags(cipher, flags); 2881 return -EINVAL; 2882 } 2883 } 2884 2885 ctx->cipher_type = CIPHER_TYPE_DES; 2886 } else { 2887 goto badkey; --- 2039 unchanged lines hidden --- | 2876 crypto_aead_set_flags(cipher, flags); 2877 return -EINVAL; 2878 } 2879 } 2880 2881 ctx->cipher_type = CIPHER_TYPE_DES; 2882 } else { 2883 goto badkey; --- 2039 unchanged lines hidden --- |