| 1450 | } |
| 1451 | |
| 1452 | static int cpu_crypto_auth(struct ccp_qp *qp, |
| 1453 | struct rte_crypto_op *op, |
| 1454 | struct ccp_session *sess, |
| 1455 | EVP_MD_CTX *ctx) |
| 1456 | { |
| 1457 | uint8_t *src, *dst; |
| 1458 | int srclen, status; |
| 1459 | struct rte_mbuf *mbuf_src, *mbuf_dst; |
| 1460 | const EVP_MD *algo = NULL; |
| 1461 | EVP_PKEY *pkey; |
| 1462 | |
| 1463 | algo_select(sess->auth.algo, &algo); |
| 1464 | pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, NULL, sess->auth.key, |
| 1465 | sess->auth.key_length); |
| 1466 | mbuf_src = op->sym->m_src; |
| 1467 | mbuf_dst = op->sym->m_dst ? op->sym->m_dst : op->sym->m_src; |
| 1468 | srclen = op->sym->auth.data.length; |
| 1469 | src = rte_pktmbuf_mtod_offset(mbuf_src, uint8_t *, |
| 1470 | op->sym->auth.data.offset); |
| 1471 | |
| 1472 | if (sess->auth.op == CCP_AUTH_OP_VERIFY) { |
| 1473 | dst = qp->temp_digest; |
| 1474 | } else { |
| 1475 | dst = op->sym->auth.digest.data; |
| 1476 | if (dst == NULL) { |
| 1477 | dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *, |
| 1478 | op->sym->auth.data.offset + |
| 1479 | sess->auth.digest_length); |
| 1480 | } |
| 1481 | } |
| 1482 | status = process_cpu_auth_hmac(src, dst, NULL, |
| 1483 | pkey, srclen, |
| 1484 | ctx, |
| 1485 | algo, |
| 1486 | sess->auth.digest_length); |
| 1487 | if (status) { |
| 1488 | op->status = RTE_CRYPTO_OP_STATUS_ERROR; |
| 1489 | return status; |
| 1490 | } |
| 1491 | |
| 1492 | if (sess->auth.op == CCP_AUTH_OP_VERIFY) { |
| 1493 | if (memcmp(dst, op->sym->auth.digest.data, |
| 1494 | sess->auth.digest_length) != 0) { |
| 1495 | op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; |
| 1496 | } else { |
| 1497 | op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; |
| 1498 | } |
| 1499 | } else { |
| 1500 | op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; |
| 1501 | } |
| 1502 | EVP_PKEY_free(pkey); |
| 1503 | return 0; |
| 1504 | } |
| 1505 | |
| 1506 | static void |
| 1507 | ccp_perform_passthru(struct ccp_passthru *pst, |
no test coverage detected