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

	if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
		goto process_auth_encryption_gcm_err;

	if (aadlen > 0)
		if (EVP_EncryptUpdate(ctx, NULL, &len, aad, aadlen) <= 0)
			goto process_auth_encryption_gcm_err;

	if (srclen > 0)
		if (process_openssl_encryption_update(mbuf_src, offset, &dst,
				srclen, ctx, 0))
			goto process_auth_encryption_gcm_err;

	/* Workaround open ssl bug in version less then 1.0.1f */
	if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
		goto process_auth_encryption_gcm_err;

	if (EVP_EncryptFinal_ex(ctx, dst, &len) <= 0)
		goto process_auth_encryption_gcm_err;

	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag) <= 0)
		goto process_auth_encryption_gcm_err;

	return 0;

process_auth_encryption_gcm_err:
	OPENSSL_LOG(ERR, "Process openssl auth encryption gcm failed");
	return -EINVAL;
}
/** Process AES-GCM encrypt algorithm */
Process AES-GCM encrypt algorithm
Process AES - GCM encrypt algorithm
static int
process_openssl_auth_encryption_gcm(struct rte_mbuf *mbuf_src, int offset,
		int srclen, uint8_t *aad, int aadlen, uint8_t *iv,
		uint8_t *dst, uint8_t *tag, EVP_CIPHER_CTX *ctx)
{
	int len = 0, unused = 0;
	uint8_t empty[] = {};
	if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0)
		goto process_auth_encryption_gcm_err;
	if (aadlen > 0)
		if (EVP_EncryptUpdate(ctx, NULL, &len, aad, aadlen) <= 0)
			goto process_auth_encryption_gcm_err;
	if (srclen > 0)
		if (process_openssl_encryption_update(mbuf_src, offset, &dst,
				srclen, ctx, 0))
			goto process_auth_encryption_gcm_err;
	if (EVP_EncryptUpdate(ctx, empty, &unused, empty, 0) <= 0)
		goto process_auth_encryption_gcm_err;
	if (EVP_EncryptFinal_ex(ctx, dst, &len) <= 0)
		goto process_auth_encryption_gcm_err;
	if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_GET_TAG, 16, tag) <= 0)
		goto process_auth_encryption_gcm_err;
	return 0;
process_auth_encryption_gcm_err:
	OPENSSL_LOG(ERR, "Process openssl auth encryption gcm failed");
	return -EINVAL;
}
static int process_openssl_auth_encryption_gcm ( struct rte_mbuf * mbuf_src , int offset , int srclen , uint8_t * aad , int aadlen , uint8_t * iv , uint8_t * dst , uint8_t * tag , EVP_CIPHER_CTX * ctx ) { int len = 0 , unused = 0 ; uint8_t empty [ ] = { } ; if ( EVP_EncryptInit_ex ( ctx , NULL , NULL , NULL , iv ) <= 0 ) goto process_auth_encryption_gcm_err ; if ( aadlen > 0 ) if ( EVP_EncryptUpdate ( ctx , NULL , & len , aad , aadlen ) <= 0 ) goto process_auth_encryption_gcm_err ; if ( srclen > 0 ) if ( process_openssl_encryption_update ( mbuf_src , offset , & dst , srclen , ctx , 0 ) ) goto process_auth_encryption_gcm_err ; if ( EVP_EncryptUpdate ( ctx , empty , & unused , empty , 0 ) <= 0 ) goto process_auth_encryption_gcm_err ; if ( EVP_EncryptFinal_ex ( ctx , dst , & len ) <= 0 ) goto process_auth_encryption_gcm_err ; if ( EVP_CIPHER_CTX_ctrl ( ctx , EVP_CTRL_GCM_GET_TAG , 16 , tag ) <= 0 ) goto process_auth_encryption_gcm_err ; return 0 ; process_auth_encryption_gcm_err : OPENSSL_LOG ( ERR , " " ) ; return - EINVAL ; }
Process AES-GCM encrypt algorithm
Process AES - GCM encrypt algorithm
/* Workaround open ssl bug in version less then 1.0.1f */