src/dpdk/drivers/crypto/qat/qat_sym.c
static inline int
bpi_cipher_decrypt(uint8_t *src, uint8_t *dst,
		uint8_t *iv, int ivlen, int srclen,
		void *bpi_ctx)
{
	EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
	int encrypted_ivlen;
	uint8_t encrypted_iv[BPI_MAX_ENCR_IV_LEN];
	uint8_t *encr = encrypted_iv;

	/* ECB method: encrypt (not decrypt!) the IV, then XOR with plaintext */
	if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
								<= 0)
		goto cipher_decrypt_err;

	for (; srclen != 0; --srclen, ++dst, ++src, ++encr)
		*dst = *src ^ *encr;

	return 0;

cipher_decrypt_err:
	QAT_DP_LOG(ERR, "libcrypto ECB cipher decrypt for BPI IV failed");
	return -EINVAL;
}
/** Decrypt a single partial block
 *  Depends on openssl libcrypto
 *  Uses ECB+XOR to do CFB encryption, same result, more performant
 */
Decrypt a single partial block
Depends on openssl libcrypto
Uses ECB+XOR to do CFB encryption, same result, more performant
Decrypt a single partial block Depends on openssl libcrypto Uses ECB + XOR to do CFB encryption same result more performant
static inline int
bpi_cipher_decrypt(uint8_t *src, uint8_t *dst,
		uint8_t *iv, int ivlen, int srclen,
		void *bpi_ctx)
{
	EVP_CIPHER_CTX *ctx = (EVP_CIPHER_CTX *)bpi_ctx;
	int encrypted_ivlen;
	uint8_t encrypted_iv[BPI_MAX_ENCR_IV_LEN];
	uint8_t *encr = encrypted_iv;
	if (EVP_EncryptUpdate(ctx, encrypted_iv, &encrypted_ivlen, iv, ivlen)
								<= 0)
		goto cipher_decrypt_err;
	for (; srclen != 0; --srclen, ++dst, ++src, ++encr)
		*dst = *src ^ *encr;
	return 0;
cipher_decrypt_err:
	QAT_DP_LOG(ERR, "libcrypto ECB cipher decrypt for BPI IV failed");
	return -EINVAL;
}
static inline int bpi_cipher_decrypt ( uint8_t * src , uint8_t * dst , uint8_t * iv , int ivlen , int srclen , void * bpi_ctx ) { EVP_CIPHER_CTX * ctx = ( EVP_CIPHER_CTX * ) bpi_ctx ; int encrypted_ivlen ; uint8_t encrypted_iv [ BPI_MAX_ENCR_IV_LEN ] ; uint8_t * encr = encrypted_iv ; if ( EVP_EncryptUpdate ( ctx , encrypted_iv , & encrypted_ivlen , iv , ivlen ) <= 0 ) goto cipher_decrypt_err ; for ( ; srclen != 0 ; -- srclen , ++ dst , ++ src , ++ encr ) * dst = * src ^ * encr ; return 0 ; cipher_decrypt_err : QAT_DP_LOG ( ERR , " " ) ; return - EINVAL ; }
Decrypt a single partial block
  Depends on openssl libcrypto
  Uses ECB+XOR to do CFB encryption, same result, more performant
Decrypt a single partial block Depends on openssl libcrypto Uses ECB + XOR to do CFB encryption same result more performant
/* ECB method: encrypt (not decrypt!) the IV, then XOR with plaintext */