LCOV - code coverage report
Current view: top level - lib/ipsec - ses.c (source / functions) Hit Total Coverage
Test: Code coverage Lines: 0 19 0.0 %
Date: 2025-01-02 22:41:34 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 20 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: BSD-3-Clause
       2                 :            :  * Copyright(c) 2018-2020 Intel Corporation
       3                 :            :  */
       4                 :            : 
       5                 :            : #include <rte_ipsec.h>
       6                 :            : #include "sa.h"
       7                 :            : 
       8                 :            : static int
       9                 :          0 : session_check(struct rte_ipsec_session *ss)
      10                 :            : {
      11   [ #  #  #  # ]:          0 :         if (ss == NULL || ss->sa == NULL)
      12                 :            :                 return -EINVAL;
      13                 :            : 
      14         [ #  # ]:          0 :         if (ss->type == RTE_SECURITY_ACTION_TYPE_NONE ||
      15                 :            :                 ss->type == RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO) {
      16         [ #  # ]:          0 :                 if (ss->crypto.ses == NULL)
      17                 :          0 :                         return -EINVAL;
      18                 :            :         } else {
      19         [ #  # ]:          0 :                 if (ss->security.ses == NULL)
      20                 :            :                         return -EINVAL;
      21         [ #  # ]:          0 :                 if ((ss->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO ||
      22                 :            :                                 ss->type ==
      23                 :          0 :                                 RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) &&
      24         [ #  # ]:          0 :                                 ss->security.ctx == NULL)
      25                 :          0 :                         return -EINVAL;
      26                 :            :         }
      27                 :            : 
      28                 :            :         return 0;
      29                 :            : }
      30                 :            : 
      31                 :            : int
      32                 :          0 : rte_ipsec_session_prepare(struct rte_ipsec_session *ss)
      33                 :            : {
      34                 :            :         int32_t rc;
      35                 :            :         struct rte_ipsec_sa_pkt_func fp;
      36                 :            : 
      37                 :          0 :         rc = session_check(ss);
      38         [ #  # ]:          0 :         if (rc != 0)
      39                 :            :                 return rc;
      40                 :            : 
      41                 :          0 :         rc = ipsec_sa_pkt_func_select(ss, ss->sa, &fp);
      42         [ #  # ]:          0 :         if (rc != 0)
      43                 :            :                 return rc;
      44                 :            : 
      45                 :          0 :         ss->pkt_func = fp;
      46                 :            : 
      47         [ #  # ]:          0 :         if (ss->type == RTE_SECURITY_ACTION_TYPE_NONE)
      48                 :          0 :                 rte_cryptodev_sym_session_opaque_data_set(ss->crypto.ses,
      49                 :            :                         (uintptr_t)ss);
      50                 :            :         else
      51                 :          0 :                 rte_security_session_opaque_data_set(ss->security.ses, (uintptr_t)ss);
      52                 :            : 
      53                 :            :         return 0;
      54                 :            : }

Generated by: LCOV version 1.14