MCPcopy Create free account
hub / github.com/F-Stack/f-stack / get_local_cipher_ctx

Function get_local_cipher_ctx

dpdk/drivers/crypto/openssl/rte_openssl_pmd.c:1607–1639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1605/*----------------------------------------------------------------------------*/
1606
1607static inline EVP_CIPHER_CTX *
1608get_local_cipher_ctx(struct openssl_session *sess, struct openssl_qp *qp)
1609{
1610 /* If the array is not being used, just return the main context. */
1611 if (sess->ctx_copies_len == 0)
1612 return sess->cipher.ctx;
1613
1614 EVP_CIPHER_CTX **lctx = &sess->qp_ctx[qp->id].cipher;
1615
1616 if (unlikely(*lctx == NULL)) {
1617#if OPENSSL_VERSION_NUMBER >= 0x30200000L
1618 /* EVP_CIPHER_CTX_dup() added in OSSL 3.2 */
1619 *lctx = EVP_CIPHER_CTX_dup(sess->cipher.ctx);
1620 return *lctx;
1621#elif OPENSSL_VERSION_NUMBER >= 0x30000000L
1622 if (sess->chain_order == OPENSSL_CHAIN_COMBINED) {
1623 /* AESNI special-cased to use openssl_aesni_ctx_clone()
1624 * to allow for working around lack of
1625 * EVP_CIPHER_CTX_copy support for 3.0.0 <= OSSL Version
1626 * < 3.2.0.
1627 */
1628 if (openssl_aesni_ctx_clone(lctx, sess) != 0)
1629 *lctx = NULL;
1630 return *lctx;
1631 }
1632#endif
1633
1634 *lctx = EVP_CIPHER_CTX_new();
1635 EVP_CIPHER_CTX_copy(*lctx, sess->cipher.ctx);
1636 }
1637
1638 return *lctx;
1639}
1640
1641static inline EVP_MD_CTX *
1642get_local_auth_ctx(struct openssl_session *sess, struct openssl_qp *qp)

Callers 2

Calls 1

openssl_aesni_ctx_cloneFunction · 0.85

Tested by

no test coverage detected