src/dpdk/drivers/crypto/openssl/rte_openssl_pmd.c
static int
process_openssl_auth_decryption_ccm(struct rte_mbuf *mbuf_src, int offset,
		int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
		uint8_t *dst, uint8_t *tag, uint8_t tag_len,
		EVP_CIPHER_CTX *ctx)
{
	int len = 0;

	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, tag_len, tag) <= 0)
		goto process_auth_decryption_ccm_err;

	if (EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
		goto process_auth_decryption_ccm_err;

	if (EVP_DecryptUpdate(ctx, NULL, &len, NULL, srclen) <= 0)
		goto process_auth_decryption_ccm_err;

	if (aadlen > 0)
		/*
		 * For AES-CCM, the actual AAD is placed
		 * 18 bytes after the start of the AAD field,
		 * according to the API.
		 */
		if (EVP_DecryptUpdate(ctx, NULL, &len, aad + 18, aadlen) <= 0)
			goto process_auth_decryption_ccm_err;

	if (srclen > 0)
		if (process_openssl_decryption_update(mbuf_src, offset, &dst,
				srclen, ctx, 0))
			return -EFAULT;

	return 0;

process_auth_decryption_ccm_err:
	OPENSSL_LOG(ERR, "Process openssl auth decryption ccm failed");
	return -EINVAL;
}
/** Process AES-CCM decrypt algorithm */
Process AES-CCM decrypt algorithm
Process AES - CCM decrypt algorithm
static int
process_openssl_auth_decryption_ccm(struct rte_mbuf *mbuf_src, int offset,
		int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
		uint8_t *dst, uint8_t *tag, uint8_t tag_len,
		EVP_CIPHER_CTX *ctx)
{
	int len = 0;
	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_CCM_SET_TAG, tag_len, tag) <= 0)
		goto process_auth_decryption_ccm_err;
	if (EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
		goto process_auth_decryption_ccm_err;
	if (EVP_DecryptUpdate(ctx, NULL, &len, NULL, srclen) <= 0)
		goto process_auth_decryption_ccm_err;
	if (aadlen > 0)
		if (EVP_DecryptUpdate(ctx, NULL, &len, aad + 18, aadlen) <= 0)
			goto process_auth_decryption_ccm_err;
	if (srclen > 0)
		if (process_openssl_decryption_update(mbuf_src, offset, &dst,
				srclen, ctx, 0))
			return -EFAULT;
	return 0;
process_auth_decryption_ccm_err:
	OPENSSL_LOG(ERR, "Process openssl auth decryption ccm failed");
	return -EINVAL;
}
static int process_openssl_auth_decryption_ccm ( struct rte_mbuf * mbuf_src , int offset , int srclen , uint8_t * aad , int aadlen , uint8_t * iv , uint8_t * dst , uint8_t * tag , uint8_t tag_len , EVP_CIPHER_CTX * ctx ) { int len = 0 ; if ( EVP_CIPHER_CTX_ctrl ( ctx , EVP_CTRL_CCM_SET_TAG , tag_len , tag ) <= 0 ) goto process_auth_decryption_ccm_err ; if ( EVP_DecryptInit_ex ( ctx , NULL , NULL , NULL , iv ) <= 0 ) goto process_auth_decryption_ccm_err ; if ( EVP_DecryptUpdate ( ctx , NULL , & len , NULL , srclen ) <= 0 ) goto process_auth_decryption_ccm_err ; if ( aadlen > 0 ) if ( EVP_DecryptUpdate ( ctx , NULL , & len , aad + 18 , aadlen ) <= 0 ) goto process_auth_decryption_ccm_err ; if ( srclen > 0 ) if ( process_openssl_decryption_update ( mbuf_src , offset , & dst , srclen , ctx , 0 ) ) return - EFAULT ; return 0 ; process_auth_decryption_ccm_err : OPENSSL_LOG ( ERR , " " ) ; return - EINVAL ; }
Process AES-CCM decrypt algorithm
Process AES - CCM decrypt algorithm
/*
		 * For AES-CCM, the actual AAD is placed
		 * 18 bytes after the start of the AAD field,
		 * according to the API.
		 */