summaryrefslogtreecommitdiff
path: root/target/linux/generic/files/crypto/ocf/cryptocteon
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2011-07-24 14:17:58 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2011-07-24 14:17:58 +0000
commit00dd85d8f61db55d6e08d224ed30f077075e9766 (patch)
tree7cabb1d9085c88122c18b953a731e548953a544b /target/linux/generic/files/crypto/ocf/cryptocteon
parent8ecad9c51ad06d4eaa325e5a9f4c42adb4b4eecb (diff)
downloadmtk-20170518-00dd85d8f61db55d6e08d224ed30f077075e9766.zip
mtk-20170518-00dd85d8f61db55d6e08d224ed30f077075e9766.tar.gz
mtk-20170518-00dd85d8f61db55d6e08d224ed30f077075e9766.tar.bz2
ocf-linux: version bump to 20110720
Fixes problem with TFM allocation in cryptosoft.c Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Hauke: * remove ubsec_ssb package and take it from ocf-linux * use patches from ocf-linux package * refresh all patches * readd some build fixes for OpenWrt. * readd CRYPTO_MANAGER dependency SVN-Revision: 27753
Diffstat (limited to 'target/linux/generic/files/crypto/ocf/cryptocteon')
-rw-r--r--target/linux/generic/files/crypto/ocf/cryptocteon/cryptocteon.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/target/linux/generic/files/crypto/ocf/cryptocteon/cryptocteon.c b/target/linux/generic/files/crypto/ocf/cryptocteon/cryptocteon.c
index fa377e5..741e4fa 100644
--- a/target/linux/generic/files/crypto/ocf/cryptocteon/cryptocteon.c
+++ b/target/linux/generic/files/crypto/ocf/cryptocteon/cryptocteon.c
@@ -28,10 +28,8 @@
*/
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
-#include <generated/autoconf.h>
-#else
-#include <linux/autoconf.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) && !defined(AUTOCONF_INCLUDED)
+#include <linux/config.h>
#endif
#include <linux/module.h>
#include <linux/init.h>
@@ -69,15 +67,6 @@ struct octo_sess {
int octo_mlen;
int octo_ivsize;
-#if 0
- int (*octo_decrypt)(struct scatterlist *sg, int sg_len,
- uint8_t *key, int key_len, uint8_t * iv,
- uint64_t *hminner, uint64_t *hmouter);
-
- int (*octo_encrypt)(struct scatterlist *sg, int sg_len,
- uint8_t *key, int key_len, uint8_t * iv,
- uint64_t *hminner, uint64_t *hmouter);
-#else
int (*octo_encrypt)(struct octo_sess *od,
struct scatterlist *sg, int sg_len,
int auth_off, int auth_len,
@@ -88,7 +77,6 @@ struct octo_sess {
int auth_off, int auth_len,
int crypt_off, int crypt_len,
int icv_off, uint8_t *ivp);
-#endif
uint64_t octo_hminner[3];
uint64_t octo_hmouter[3];
@@ -264,7 +252,7 @@ octo_newsession(device_t dev, u_int32_t *sid, struct cryptoini *cri)
break;
case CRYPTO_SHA1_HMAC:
(*ocd)->octo_encrypt = octo_des_cbc_sha1_encrypt;
- (*ocd)->octo_decrypt = octo_des_cbc_sha1_encrypt;
+ (*ocd)->octo_decrypt = octo_des_cbc_sha1_decrypt;
octo_calc_hash(1, macini->cri_key, (*ocd)->octo_hminner,
(*ocd)->octo_hmouter);
break;
@@ -305,13 +293,13 @@ octo_newsession(device_t dev, u_int32_t *sid, struct cryptoini *cri)
break;
case CRYPTO_MD5_HMAC:
(*ocd)->octo_encrypt = octo_null_md5_encrypt;
- (*ocd)->octo_decrypt = octo_null_md5_encrypt;
+ (*ocd)->octo_decrypt = octo_null_md5_encrypt; /* encrypt == decrypt */
octo_calc_hash(0, macini->cri_key, (*ocd)->octo_hminner,
(*ocd)->octo_hmouter);
break;
case CRYPTO_SHA1_HMAC:
(*ocd)->octo_encrypt = octo_null_sha1_encrypt;
- (*ocd)->octo_decrypt = octo_null_sha1_encrypt;
+ (*ocd)->octo_decrypt = octo_null_sha1_encrypt; /* encrypt == decrypt */
octo_calc_hash(1, macini->cri_key, (*ocd)->octo_hminner,
(*ocd)->octo_hmouter);
break;
@@ -433,12 +421,22 @@ octo_process(device_t dev, struct cryptop *crp, int hint)
}
if (enccrd) {
- if (enccrd->crd_flags & CRD_F_IV_EXPLICIT) {
- ivp = enccrd->crd_iv;
+ if (enccrd->crd_flags & CRD_F_ENCRYPT) {
+ if (enccrd->crd_flags & CRD_F_IV_EXPLICIT)
+ ivp = enccrd->crd_iv;
+ else
+ read_random((ivp = iv_data), od->octo_ivsize);
+ if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0)
+ crypto_copyback(crp->crp_flags, crp->crp_buf,
+ enccrd->crd_inject, od->octo_ivsize, ivp);
} else {
- ivp = iv_data;
- crypto_copydata(crp->crp_flags, crp->crp_buf,
- enccrd->crd_inject, od->octo_ivsize, (caddr_t) ivp);
+ if (enccrd->crd_flags & CRD_F_IV_EXPLICIT) {
+ ivp = enccrd->crd_iv;
+ } else {
+ ivp = iv_data;
+ crypto_copydata(crp->crp_flags, crp->crp_buf,
+ enccrd->crd_inject, od->octo_ivsize, (caddr_t) ivp);
+ }
}
if (maccrd) {