}
if (op->sym->m_src->nb_segs > 1) {
- if (session->cipher.mode != IMB_CIPHER_GCM) {
+ if (session->cipher.mode != IMB_CIPHER_GCM
+ && session->cipher.mode !=
+ IMB_CIPHER_CHACHA20_POLY1305) {
op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
IPSEC_MB_LOG(ERR, "Device only supports SGL for AES-GCM"
- " algorithm.");
+ " or CHACHA20_POLY1305 algorithms.");
return -1;
}
sgl = 1;
job->u.CHACHA20_POLY1305.aad = op->sym->aead.aad.data;
job->u.CHACHA20_POLY1305.aad_len_in_bytes =
session->aead.aad_len;
+ if (sgl) {
+ job->u.CHACHA20_POLY1305.ctx = &qp_data->chacha_sgl_ctx;
+ job->cipher_mode = IMB_CIPHER_CHACHA20_POLY1305_SGL;
+ job->hash_alg = IMB_AUTH_CHACHA20_POLY1305_SGL;
+ }
job->enc_keys = session->cipher.expanded_aes_keys.encode;
job->dec_keys = session->cipher.expanded_aes_keys.encode;
break;
break;
case IMB_AUTH_GCM_SGL:
+ case IMB_AUTH_CHACHA20_POLY1305_SGL:
job->hash_start_src_offset_in_bytes = 0;
job->msg_len_to_hash_in_bytes = 0;
job->iv = rte_crypto_op_ctod_offset(op, uint8_t *,
op->sym->aead.data.offset;
job->msg_len_to_hash_in_bytes =
op->sym->aead.data.length;
-
job->iv = rte_crypto_op_ctod_offset(op, uint8_t *,
session->iv.offset);
break;
job->msg_len_to_cipher_in_bytes = op->sym->aead.data.length;
break;
case IMB_CIPHER_GCM_SGL:
+ case IMB_CIPHER_CHACHA20_POLY1305_SGL:
job->msg_len_to_cipher_in_bytes = 0;
job->cipher_start_src_offset_in_bytes = 0;
break;
* by the driver when verifying a digest provided
* by the user (using authentication verify operation)
*/
- struct gcm_context_data gcm_sgl_ctx;
+ union {
+ struct gcm_context_data gcm_sgl_ctx;
+ struct chacha20_poly1305_context_data chacha_sgl_ctx;
+ };
};
/* Maximum length for digest */