aboutsummaryrefslogtreecommitdiff
path: root/sys/mips/cavium
diff options
context:
space:
mode:
Diffstat (limited to 'sys/mips/cavium')
-rw-r--r--sys/mips/cavium/cryptocteon/cavium_crypto.c708
-rw-r--r--sys/mips/cavium/cryptocteon/cryptocteon.c26
-rw-r--r--sys/mips/cavium/cryptocteon/cryptocteonvar.h8
3 files changed, 0 insertions, 742 deletions
diff --git a/sys/mips/cavium/cryptocteon/cavium_crypto.c b/sys/mips/cavium/cryptocteon/cavium_crypto.c
index e68a2757b466..ac15c2974274 100644
--- a/sys/mips/cavium/cryptocteon/cavium_crypto.c
+++ b/sys/mips/cavium/cryptocteon/cavium_crypto.c
@@ -90,12 +90,10 @@ __FBSDID("$FreeBSD$");
} while (0)
#define ESP_HEADER_LENGTH 8
-#define DES_CBC_IV_LENGTH 8
#define AES_CBC_IV_LENGTH 16
#define ESP_HMAC_LEN 12
#define ESP_HEADER_LENGTH 8
-#define DES_CBC_IV_LENGTH 8
/****************************************************************************/
@@ -320,125 +318,6 @@ octo_calc_hash(uint8_t auth, unsigned char *key, uint64_t *inner, uint64_t *oute
}
/****************************************************************************/
-/* DES functions */
-
-int
-octo_des_cbc_encrypt(
- struct octo_sess *od,
- struct iovec *iov, size_t iovcnt, size_t iovlen,
- int auth_off, int auth_len,
- int crypt_off, int crypt_len,
- uint8_t *icv, uint8_t *ivp)
-{
- uint64_t *data;
- int data_i, data_l;
-
- dprintf("%s()\n", __func__);
-
- if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL ||
- (crypt_off & 0x7) || (crypt_off + crypt_len > iovlen))) {
- dprintf("%s: Bad parameters od=%p iov=%p iovlen=%jd "
- "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
- "icv=%p ivp=%p\n", __func__, od, iov, iovlen,
- auth_off, auth_len, crypt_off, crypt_len, icv, ivp);
- return -EINVAL;
- }
-
- IOV_INIT(iov, data, data_i, data_l);
-
- CVMX_PREFETCH0(ivp);
- CVMX_PREFETCH0(od->octo_enckey);
-
-
- /* load 3DES Key */
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
- if (od->octo_encklen == 24) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
- } else if (od->octo_encklen == 8) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
- } else {
- dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen);
- return -EINVAL;
- }
-
- CVMX_MT_3DES_IV(* (uint64_t *) ivp);
-
- while (crypt_off > 0) {
- IOV_CONSUME(iov, data, data_i, data_l);
- crypt_off -= 8;
- }
-
- while (crypt_len > 0) {
- CVMX_MT_3DES_ENC_CBC(*data);
- CVMX_MF_3DES_RESULT(*data);
- IOV_CONSUME(iov, data, data_i, data_l);
- crypt_len -= 8;
- }
-
- return 0;
-}
-
-
-int
-octo_des_cbc_decrypt(
- struct octo_sess *od,
- struct iovec *iov, size_t iovcnt, size_t iovlen,
- int auth_off, int auth_len,
- int crypt_off, int crypt_len,
- uint8_t *icv, uint8_t *ivp)
-{
- uint64_t *data;
- int data_i, data_l;
-
- dprintf("%s()\n", __func__);
-
- if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL ||
- (crypt_off & 0x7) || (crypt_off + crypt_len > iovlen))) {
- dprintf("%s: Bad parameters od=%p iov=%p iovlen=%jd "
- "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
- "icv=%p ivp=%p\n", __func__, od, iov, iovlen,
- auth_off, auth_len, crypt_off, crypt_len, icv, ivp);
- return -EINVAL;
- }
-
- IOV_INIT(iov, data, data_i, data_l);
-
- CVMX_PREFETCH0(ivp);
- CVMX_PREFETCH0(od->octo_enckey);
-
- /* load 3DES Key */
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
- if (od->octo_encklen == 24) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
- } else if (od->octo_encklen == 8) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
- } else {
- dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen);
- return -EINVAL;
- }
-
- CVMX_MT_3DES_IV(* (uint64_t *) ivp);
-
- while (crypt_off > 0) {
- IOV_CONSUME(iov, data, data_i, data_l);
- crypt_off -= 8;
- }
-
- while (crypt_len > 0) {
- CVMX_MT_3DES_DEC_CBC(*data);
- CVMX_MF_3DES_RESULT(*data);
- IOV_CONSUME(iov, data, data_i, data_l);
- crypt_len -= 8;
- }
-
- return 0;
-}
-
-/****************************************************************************/
/* AES functions */
int
@@ -778,593 +657,6 @@ octo_null_sha1_encrypt(
}
/****************************************************************************/
-/* DES MD5 */
-
-int
-octo_des_cbc_md5_encrypt(
- struct octo_sess *od,
- struct iovec *iov, size_t iovcnt, size_t iovlen,
- int auth_off, int auth_len,
- int crypt_off, int crypt_len,
- uint8_t *icv, uint8_t *ivp)
-{
- int next = 0;
- union {
- uint32_t data32[2];
- uint64_t data64[1];
- } mydata;
- uint64_t *data = &mydata.data64[0];
- uint32_t *data32;
- uint64_t tmp1, tmp2;
- int data_i, data_l, alen = auth_len;
-
- dprintf("%s()\n", __func__);
-
- if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL ||
- (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) ||
- (crypt_len & 0x7) ||
- (auth_len & 0x7) ||
- (auth_off & 0x3) || (auth_off + auth_len > iovlen))) {
- dprintf("%s: Bad parameters od=%p iov=%p iovlen=%jd "
- "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
- "icv=%p ivp=%p\n", __func__, od, iov, iovlen,
- auth_off, auth_len, crypt_off, crypt_len, icv, ivp);
- return -EINVAL;
- }
-
- IOV_INIT(iov, data32, data_i, data_l);
-
- CVMX_PREFETCH0(ivp);
- CVMX_PREFETCH0(od->octo_enckey);
-
- /* load 3DES Key */
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
- if (od->octo_encklen == 24) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
- } else if (od->octo_encklen == 8) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
- } else {
- dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen);
- return -EINVAL;
- }
-
- CVMX_MT_3DES_IV(* (uint64_t *) ivp);
-
- /* Load MD5 IV */
- CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
- CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
-
- while (crypt_off > 0 && auth_off > 0) {
- IOV_CONSUME(iov, data32, data_i, data_l);
- crypt_off -= 4;
- auth_off -= 4;
- }
-
- while (crypt_len > 0 || auth_len > 0) {
- uint32_t *first = data32;
- mydata.data32[0] = *first;
- IOV_CONSUME(iov, data32, data_i, data_l);
- mydata.data32[1] = *data32;
- if (crypt_off <= 0) {
- if (crypt_len > 0) {
- CVMX_MT_3DES_ENC_CBC(*data);
- CVMX_MF_3DES_RESULT(*data);
- crypt_len -= 8;
- }
- } else
- crypt_off -= 8;
- if (auth_off <= 0) {
- if (auth_len > 0) {
- CVM_LOAD_MD5_UNIT(*data, next);
- auth_len -= 8;
- }
- } else
- auth_off -= 8;
- *first = mydata.data32[0];
- *data32 = mydata.data32[1];
- IOV_CONSUME(iov, data32, data_i, data_l);
- }
-
- /* finish the hash */
- CVMX_PREFETCH0(od->octo_hmouter);
-#if 0
- if (__predict_false(inplen)) {
- uint64_t tmp = 0;
- uint8_t *p = (uint8_t *) & tmp;
- p[inplen] = 0x80;
- do {
- inplen--;
- p[inplen] = ((uint8_t *) data)[inplen];
- } while (inplen);
- CVM_LOAD_MD5_UNIT(tmp, next);
- } else {
- CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
- }
-#else
- CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
-#endif
-
- /* Finish Inner hash */
- while (next != 7) {
- CVM_LOAD_MD5_UNIT(((uint64_t) 0x0ULL), next);
- }
- CVMX_ES64(tmp1, ((alen + 64) << 3));
- CVM_LOAD_MD5_UNIT(tmp1, next);
-
- /* Get the inner hash of HMAC */
- CVMX_MF_HSH_IV(tmp1, 0);
- CVMX_MF_HSH_IV(tmp2, 1);
-
- /* Initialize hash unit */
- CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
- CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
-
- CVMX_MT_HSH_DAT(tmp1, 0);
- CVMX_MT_HSH_DAT(tmp2, 1);
- CVMX_MT_HSH_DAT(0x8000000000000000ULL, 2);
- CVMX_MT_HSH_DATZ(3);
- CVMX_MT_HSH_DATZ(4);
- CVMX_MT_HSH_DATZ(5);
- CVMX_MT_HSH_DATZ(6);
- CVMX_ES64(tmp1, ((64 + 16) << 3));
- CVMX_MT_HSH_STARTMD5(tmp1);
-
- /* save the HMAC */
- data32 = (uint32_t *)icv;
- CVMX_MF_HSH_IV(tmp1, 0);
- *data32 = (uint32_t) (tmp1 >> 32);
- data32++;
- *data32 = (uint32_t) tmp1;
- data32++;
- CVMX_MF_HSH_IV(tmp1, 1);
- *data32 = (uint32_t) (tmp1 >> 32);
-
- return 0;
-}
-
-int
-octo_des_cbc_md5_decrypt(
- struct octo_sess *od,
- struct iovec *iov, size_t iovcnt, size_t iovlen,
- int auth_off, int auth_len,
- int crypt_off, int crypt_len,
- uint8_t *icv, uint8_t *ivp)
-{
- int next = 0;
- union {
- uint32_t data32[2];
- uint64_t data64[1];
- } mydata;
- uint64_t *data = &mydata.data64[0];
- uint32_t *data32;
- uint64_t tmp1, tmp2;
- int data_i, data_l, alen = auth_len;
-
- dprintf("%s()\n", __func__);
-
- if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL ||
- (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) ||
- (crypt_len & 0x7) ||
- (auth_len & 0x7) ||
- (auth_off & 0x3) || (auth_off + auth_len > iovlen))) {
- dprintf("%s: Bad parameters od=%p iov=%p iovlen=%jd "
- "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
- "icv=%p ivp=%p\n", __func__, od, iov, iovlen,
- auth_off, auth_len, crypt_off, crypt_len, icv, ivp);
- return -EINVAL;
- }
-
- IOV_INIT(iov, data32, data_i, data_l);
-
- CVMX_PREFETCH0(ivp);
- CVMX_PREFETCH0(od->octo_enckey);
-
- /* load 3DES Key */
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
- if (od->octo_encklen == 24) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
- } else if (od->octo_encklen == 8) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
- } else {
- dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen);
- return -EINVAL;
- }
-
- CVMX_MT_3DES_IV(* (uint64_t *) ivp);
-
- /* Load MD5 IV */
- CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
- CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
-
- while (crypt_off > 0 && auth_off > 0) {
- IOV_CONSUME(iov, data32, data_i, data_l);
- crypt_off -= 4;
- auth_off -= 4;
- }
-
- while (crypt_len > 0 || auth_len > 0) {
- uint32_t *first = data32;
- mydata.data32[0] = *first;
- IOV_CONSUME(iov, data32, data_i, data_l);
- mydata.data32[1] = *data32;
- if (auth_off <= 0) {
- if (auth_len > 0) {
- CVM_LOAD_MD5_UNIT(*data, next);
- auth_len -= 8;
- }
- } else
- auth_off -= 8;
- if (crypt_off <= 0) {
- if (crypt_len > 0) {
- CVMX_MT_3DES_DEC_CBC(*data);
- CVMX_MF_3DES_RESULT(*data);
- crypt_len -= 8;
- }
- } else
- crypt_off -= 8;
- *first = mydata.data32[0];
- *data32 = mydata.data32[1];
- IOV_CONSUME(iov, data32, data_i, data_l);
- }
-
- /* finish the hash */
- CVMX_PREFETCH0(od->octo_hmouter);
-#if 0
- if (__predict_false(inplen)) {
- uint64_t tmp = 0;
- uint8_t *p = (uint8_t *) & tmp;
- p[inplen] = 0x80;
- do {
- inplen--;
- p[inplen] = ((uint8_t *) data)[inplen];
- } while (inplen);
- CVM_LOAD_MD5_UNIT(tmp, next);
- } else {
- CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
- }
-#else
- CVM_LOAD_MD5_UNIT(0x8000000000000000ULL, next);
-#endif
-
- /* Finish Inner hash */
- while (next != 7) {
- CVM_LOAD_MD5_UNIT(((uint64_t) 0x0ULL), next);
- }
- CVMX_ES64(tmp1, ((alen + 64) << 3));
- CVM_LOAD_MD5_UNIT(tmp1, next);
-
- /* Get the inner hash of HMAC */
- CVMX_MF_HSH_IV(tmp1, 0);
- CVMX_MF_HSH_IV(tmp2, 1);
-
- /* Initialize hash unit */
- CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
- CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
-
- CVMX_MT_HSH_DAT(tmp1, 0);
- CVMX_MT_HSH_DAT(tmp2, 1);
- CVMX_MT_HSH_DAT(0x8000000000000000ULL, 2);
- CVMX_MT_HSH_DATZ(3);
- CVMX_MT_HSH_DATZ(4);
- CVMX_MT_HSH_DATZ(5);
- CVMX_MT_HSH_DATZ(6);
- CVMX_ES64(tmp1, ((64 + 16) << 3));
- CVMX_MT_HSH_STARTMD5(tmp1);
-
- /* save the HMAC */
- data32 = (uint32_t *)icv;
- CVMX_MF_HSH_IV(tmp1, 0);
- *data32 = (uint32_t) (tmp1 >> 32);
- data32++;
- *data32 = (uint32_t) tmp1;
- data32++;
- CVMX_MF_HSH_IV(tmp1, 1);
- *data32 = (uint32_t) (tmp1 >> 32);
-
- return 0;
-}
-
-/****************************************************************************/
-/* DES SHA */
-
-int
-octo_des_cbc_sha1_encrypt(
- struct octo_sess *od,
- struct iovec *iov, size_t iovcnt, size_t iovlen,
- int auth_off, int auth_len,
- int crypt_off, int crypt_len,
- uint8_t *icv, uint8_t *ivp)
-{
- int next = 0;
- union {
- uint32_t data32[2];
- uint64_t data64[1];
- } mydata;
- uint64_t *data = &mydata.data64[0];
- uint32_t *data32;
- uint64_t tmp1, tmp2, tmp3;
- int data_i, data_l, alen = auth_len;
-
- dprintf("%s()\n", __func__);
-
- if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL ||
- (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) ||
- (crypt_len & 0x7) ||
- (auth_len & 0x7) ||
- (auth_off & 0x3) || (auth_off + auth_len > iovlen))) {
- dprintf("%s: Bad parameters od=%p iov=%p iovlen=%jd "
- "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
- "icv=%p ivp=%p\n", __func__, od, iov, iovlen,
- auth_off, auth_len, crypt_off, crypt_len, icv, ivp);
- return -EINVAL;
- }
-
- IOV_INIT(iov, data32, data_i, data_l);
-
- CVMX_PREFETCH0(ivp);
- CVMX_PREFETCH0(od->octo_enckey);
-
- /* load 3DES Key */
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
- if (od->octo_encklen == 24) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
- } else if (od->octo_encklen == 8) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
- } else {
- dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen);
- return -EINVAL;
- }
-
- CVMX_MT_3DES_IV(* (uint64_t *) ivp);
-
- /* Load SHA1 IV */
- CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
- CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
- CVMX_MT_HSH_IV(od->octo_hminner[2], 2);
-
- while (crypt_off > 0 && auth_off > 0) {
- IOV_CONSUME(iov, data32, data_i, data_l);
- crypt_off -= 4;
- auth_off -= 4;
- }
-
- while (crypt_len > 0 || auth_len > 0) {
- uint32_t *first = data32;
- mydata.data32[0] = *first;
- IOV_CONSUME(iov, data32, data_i, data_l);
- mydata.data32[1] = *data32;
- if (crypt_off <= 0) {
- if (crypt_len > 0) {
- CVMX_MT_3DES_ENC_CBC(*data);
- CVMX_MF_3DES_RESULT(*data);
- crypt_len -= 8;
- }
- } else
- crypt_off -= 8;
- if (auth_off <= 0) {
- if (auth_len > 0) {
- CVM_LOAD_SHA_UNIT(*data, next);
- auth_len -= 8;
- }
- } else
- auth_off -= 8;
- *first = mydata.data32[0];
- *data32 = mydata.data32[1];
- IOV_CONSUME(iov, data32, data_i, data_l);
- }
-
- /* finish the hash */
- CVMX_PREFETCH0(od->octo_hmouter);
-#if 0
- if (__predict_false(inplen)) {
- uint64_t tmp = 0;
- uint8_t *p = (uint8_t *) & tmp;
- p[inplen] = 0x80;
- do {
- inplen--;
- p[inplen] = ((uint8_t *) data)[inplen];
- } while (inplen);
- CVM_LOAD_SHA_UNIT(tmp, next);
- } else {
- CVM_LOAD_SHA_UNIT(0x8000000000000000ULL, next);
- }
-#else
- CVM_LOAD_SHA_UNIT(0x8000000000000000ULL, next);
-#endif
-
- /* Finish Inner hash */
- while (next != 7) {
- CVM_LOAD_SHA_UNIT(((uint64_t) 0x0ULL), next);
- }
- CVM_LOAD_SHA_UNIT((uint64_t) ((alen + 64) << 3), next);
-
- /* Get the inner hash of HMAC */
- CVMX_MF_HSH_IV(tmp1, 0);
- CVMX_MF_HSH_IV(tmp2, 1);
- tmp3 = 0;
- CVMX_MF_HSH_IV(tmp3, 2);
-
- /* Initialize hash unit */
- CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
- CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
- CVMX_MT_HSH_IV(od->octo_hmouter[2], 2);
-
- CVMX_MT_HSH_DAT(tmp1, 0);
- CVMX_MT_HSH_DAT(tmp2, 1);
- tmp3 |= 0x0000000080000000;
- CVMX_MT_HSH_DAT(tmp3, 2);
- CVMX_MT_HSH_DATZ(3);
- CVMX_MT_HSH_DATZ(4);
- CVMX_MT_HSH_DATZ(5);
- CVMX_MT_HSH_DATZ(6);
- CVMX_MT_HSH_STARTSHA((uint64_t) ((64 + 20) << 3));
-
- /* save the HMAC */
- data32 = (uint32_t *)icv;
- CVMX_MF_HSH_IV(tmp1, 0);
- *data32 = (uint32_t) (tmp1 >> 32);
- data32++;
- *data32 = (uint32_t) tmp1;
- data32++;
- CVMX_MF_HSH_IV(tmp1, 1);
- *data32 = (uint32_t) (tmp1 >> 32);
-
- return 0;
-}
-
-int
-octo_des_cbc_sha1_decrypt(
- struct octo_sess *od,
- struct iovec *iov, size_t iovcnt, size_t iovlen,
- int auth_off, int auth_len,
- int crypt_off, int crypt_len,
- uint8_t *icv, uint8_t *ivp)
-{
- int next = 0;
- union {
- uint32_t data32[2];
- uint64_t data64[1];
- } mydata;
- uint64_t *data = &mydata.data64[0];
- uint32_t *data32;
- uint64_t tmp1, tmp2, tmp3;
- int data_i, data_l, alen = auth_len;
-
- dprintf("%s()\n", __func__);
-
- if (__predict_false(od == NULL || iov==NULL || iovlen==0 || ivp==NULL ||
- (crypt_off & 0x3) || (crypt_off + crypt_len > iovlen) ||
- (crypt_len & 0x7) ||
- (auth_len & 0x7) ||
- (auth_off & 0x3) || (auth_off + auth_len > iovlen))) {
- dprintf("%s: Bad parameters od=%p iov=%p iovlen=%jd "
- "auth_off=%d auth_len=%d crypt_off=%d crypt_len=%d "
- "icv=%p ivp=%p\n", __func__, od, iov, iovlen,
- auth_off, auth_len, crypt_off, crypt_len, icv, ivp);
- return -EINVAL;
- }
-
- IOV_INIT(iov, data32, data_i, data_l);
-
- CVMX_PREFETCH0(ivp);
- CVMX_PREFETCH0(od->octo_enckey);
-
- /* load 3DES Key */
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 0);
- if (od->octo_encklen == 24) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[1], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[2], 2);
- } else if (od->octo_encklen == 8) {
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 1);
- CVMX_MT_3DES_KEY(((uint64_t *) od->octo_enckey)[0], 2);
- } else {
- dprintf("%s: Bad key length %d\n", __func__, od->octo_encklen);
- return -EINVAL;
- }
-
- CVMX_MT_3DES_IV(* (uint64_t *) ivp);
-
- /* Load SHA1 IV */
- CVMX_MT_HSH_IV(od->octo_hminner[0], 0);
- CVMX_MT_HSH_IV(od->octo_hminner[1], 1);
- CVMX_MT_HSH_IV(od->octo_hminner[2], 2);
-
- while (crypt_off > 0 && auth_off > 0) {
- IOV_CONSUME(iov, data32, data_i, data_l);
- crypt_off -= 4;
- auth_off -= 4;
- }
-
- while (crypt_len > 0 || auth_len > 0) {
- uint32_t *first = data32;
- mydata.data32[0] = *first;
- IOV_CONSUME(iov, data32, data_i, data_l);
- mydata.data32[1] = *data32;
- if (auth_off <= 0) {
- if (auth_len > 0) {
- CVM_LOAD_SHA_UNIT(*data, next);
- auth_len -= 8;
- }
- } else
- auth_off -= 8;
- if (crypt_off <= 0) {
- if (crypt_len > 0) {
- CVMX_MT_3DES_DEC_CBC(*data);
- CVMX_MF_3DES_RESULT(*data);
- crypt_len -= 8;
- }
- } else
- crypt_off -= 8;
- *first = mydata.data32[0];
- *data32 = mydata.data32[1];
- IOV_CONSUME(iov, data32, data_i, data_l);
- }
-
- /* finish the hash */
- CVMX_PREFETCH0(od->octo_hmouter);
-#if 0
- if (__predict_false(inplen)) {
- uint64_t tmp = 0;
- uint8_t *p = (uint8_t *) & tmp;
- p[inplen] = 0x80;
- do {
- inplen--;
- p[inplen] = ((uint8_t *) data)[inplen];
- } while (inplen);
- CVM_LOAD_SHA_UNIT(tmp, next);
- } else {
- CVM_LOAD_SHA_UNIT(0x8000000000000000ULL, next);
- }
-#else
- CVM_LOAD_SHA_UNIT(0x8000000000000000ULL, next);
-#endif
-
- /* Finish Inner hash */
- while (next != 7) {
- CVM_LOAD_SHA_UNIT(((uint64_t) 0x0ULL), next);
- }
- CVM_LOAD_SHA_UNIT((uint64_t) ((alen + 64) << 3), next);
-
- /* Get the inner hash of HMAC */
- CVMX_MF_HSH_IV(tmp1, 0);
- CVMX_MF_HSH_IV(tmp2, 1);
- tmp3 = 0;
- CVMX_MF_HSH_IV(tmp3, 2);
-
- /* Initialize hash unit */
- CVMX_MT_HSH_IV(od->octo_hmouter[0], 0);
- CVMX_MT_HSH_IV(od->octo_hmouter[1], 1);
- CVMX_MT_HSH_IV(od->octo_hmouter[2], 2);
-
- CVMX_MT_HSH_DAT(tmp1, 0);
- CVMX_MT_HSH_DAT(tmp2, 1);
- tmp3 |= 0x0000000080000000;
- CVMX_MT_HSH_DAT(tmp3, 2);
- CVMX_MT_HSH_DATZ(3);
- CVMX_MT_HSH_DATZ(4);
- CVMX_MT_HSH_DATZ(5);
- CVMX_MT_HSH_DATZ(6);
- CVMX_MT_HSH_STARTSHA((uint64_t) ((64 + 20) << 3));
- /* save the HMAC */
- data32 = (uint32_t *)icv;
- CVMX_MF_HSH_IV(tmp1, 0);
- *data32 = (uint32_t) (tmp1 >> 32);
- data32++;
- *data32 = (uint32_t) tmp1;
- data32++;
- CVMX_MF_HSH_IV(tmp1, 1);
- *data32 = (uint32_t) (tmp1 >> 32);
-
- return 0;
-}
-
-/****************************************************************************/
/* AES MD5 */
int
diff --git a/sys/mips/cavium/cryptocteon/cryptocteon.c b/sys/mips/cavium/cryptocteon/cryptocteon.c
index 56030979f24e..2fe2e9f29c63 100644
--- a/sys/mips/cavium/cryptocteon/cryptocteon.c
+++ b/sys/mips/cavium/cryptocteon/cryptocteon.c
@@ -121,14 +121,6 @@ cryptocteon_cipher_supported(const struct crypto_session_params *csp)
{
switch (csp->csp_cipher_alg) {
- case CRYPTO_DES_CBC:
- case CRYPTO_3DES_CBC:
- if (csp->csp_ivlen != 8)
- return (false);
- if (csp->csp_cipher_klen != 8 &&
- csp->csp_cipher_klen != 24)
- return (false);
- break;
case CRYPTO_AES_CBC:
if (csp->csp_ivlen != 16)
return (false);
@@ -229,11 +221,6 @@ cryptocteon_newsession(device_t dev, crypto_session_t cses,
break;
case CSP_MODE_CIPHER:
switch (csp->csp_cipher_alg) {
- case CRYPTO_DES_CBC:
- case CRYPTO_3DES_CBC:
- ocd->octo_encrypt = octo_des_cbc_encrypt;
- ocd->octo_decrypt = octo_des_cbc_decrypt;
- break;
case CRYPTO_AES_CBC:
ocd->octo_encrypt = octo_aes_cbc_encrypt;
ocd->octo_decrypt = octo_aes_cbc_decrypt;
@@ -242,19 +229,6 @@ cryptocteon_newsession(device_t dev, crypto_session_t cses,
break;
case CSP_MODE_ETA:
switch (csp->csp_cipher_alg) {
- case CRYPTO_DES_CBC:
- case CRYPTO_3DES_CBC:
- switch (csp->csp_auth_alg) {
- case CRYPTO_MD5_HMAC:
- ocd->octo_encrypt = octo_des_cbc_md5_encrypt;
- ocd->octo_decrypt = octo_des_cbc_md5_decrypt;
- break;
- case CRYPTO_SHA1_HMAC:
- ocd->octo_encrypt = octo_des_cbc_sha1_encrypt;
- ocd->octo_decrypt = octo_des_cbc_sha1_encrypt;
- break;
- }
- break;
case CRYPTO_AES_CBC:
switch (csp->csp_auth_alg) {
case CRYPTO_MD5_HMAC:
diff --git a/sys/mips/cavium/cryptocteon/cryptocteonvar.h b/sys/mips/cavium/cryptocteon/cryptocteonvar.h
index e7bc445deefb..2e071f7240b3 100644
--- a/sys/mips/cavium/cryptocteon/cryptocteonvar.h
+++ b/sys/mips/cavium/cryptocteon/cryptocteonvar.h
@@ -67,14 +67,6 @@ void octo_calc_hash(uint8_t, unsigned char *, uint64_t *, uint64_t *);
octo_encrypt_t octo_null_md5_encrypt;
octo_encrypt_t octo_null_sha1_encrypt;
-octo_encrypt_t octo_des_cbc_encrypt;
-octo_encrypt_t octo_des_cbc_md5_encrypt;
-octo_encrypt_t octo_des_cbc_sha1_encrypt;
-
-octo_decrypt_t octo_des_cbc_decrypt;
-octo_decrypt_t octo_des_cbc_md5_decrypt;
-octo_decrypt_t octo_des_cbc_sha1_decrypt;
-
octo_encrypt_t octo_aes_cbc_encrypt;
octo_encrypt_t octo_aes_cbc_md5_encrypt;
octo_encrypt_t octo_aes_cbc_sha1_encrypt;