X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fcrypto%2Fzuc%2Frte_zuc_pmd.c;h=9f9298d0653dab16c2cdfc9868478c4098080036;hb=0fbd75a99fc9d2c8c7618d677d3f50fb9872b80c;hp=3923e3c66702cb1c6d0ca414c9670af4bdb307c6;hpb=5082f991f6def0ef06e9ff1cf9f39ef3b78657c5;p=dpdk.git diff --git a/drivers/crypto/zuc/rte_zuc_pmd.c b/drivers/crypto/zuc/rte_zuc_pmd.c index 3923e3c667..9f9298d065 100644 --- a/drivers/crypto/zuc/rte_zuc_pmd.c +++ b/drivers/crypto/zuc/rte_zuc_pmd.c @@ -115,6 +115,13 @@ zuc_set_session_parameters(struct zuc_session *sess, /* Only ZUC EEA3 supported */ if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_ZUC_EEA3) return -EINVAL; + + if (cipher_xform->cipher.iv.length != ZUC_IV_KEY_LENGTH) { + ZUC_LOG_ERR("Wrong IV length"); + return -EINVAL; + } + sess->iv_offset = cipher_xform->cipher.iv.offset; + /* Copy the key */ memcpy(sess->pKey_cipher, cipher_xform->cipher.key.data, ZUC_IV_KEY_LENGTH); @@ -178,13 +185,6 @@ process_zuc_cipher_op(struct rte_crypto_op **ops, uint8_t *cipher_keys[ZUC_MAX_BURST]; for (i = 0; i < num_ops; i++) { - /* Sanity checks. */ - if (unlikely(ops[i]->sym->cipher.iv.length != ZUC_IV_KEY_LENGTH)) { - ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; - ZUC_LOG_ERR("iv"); - break; - } - if (((ops[i]->sym->cipher.data.length % BYTE_LEN) != 0) || ((ops[i]->sym->cipher.data.offset % BYTE_LEN) != 0)) { @@ -214,7 +214,7 @@ process_zuc_cipher_op(struct rte_crypto_op **ops, rte_pktmbuf_mtod(ops[i]->sym->m_src, uint8_t *) + (ops[i]->sym->cipher.data.offset >> 3); iv[i] = rte_crypto_op_ctod_offset(ops[i], uint8_t *, - ops[i]->sym->cipher.iv.offset); + session->iv_offset); num_bytes[i] = ops[i]->sym->cipher.data.length >> 3; cipher_keys[i] = session->pKey_cipher;