1/* SPDX-License-Identifier: BSD-3-Clause */ 2/* Copyright(c) 2007-2022 Intel Corporation */ 3 4/** 5 ***************************************************************************** 6 * @file lac_sym_qat_constants_table.h 7 * 8 * @ingroup LacSymQat 9 * 10 * API to be used for the CySym constants table. 11 * 12 *****************************************************************************/ 13 14#ifndef LAC_SYM_QAT_CONSTANTS_TABLE_H 15#define LAC_SYM_QAT_CONSTANTS_TABLE_H 16 17#include "cpa.h" 18#include "icp_qat_fw_la.h" 19 20typedef struct lac_sym_qat_constants_s { 21 /* Note these arrays must match the tables in lac_sym_qat_constants.c 22 * icp_qat_hw_cipher_lookup_tbl and icp_qat_hw_auth_lookup_tbl */ 23 uint8_t cipher_offset[ICP_QAT_HW_CIPHER_DELIMITER] 24 [ICP_QAT_HW_CIPHER_MODE_DELIMITER][2][2]; 25 uint8_t auth_offset[ICP_QAT_HW_AUTH_ALGO_DELIMITER] 26 [ICP_QAT_HW_AUTH_MODE_DELIMITER][2]; 27} lac_sym_qat_constants_t; 28 29/** 30 ******************************************************************************* 31 * @ingroup LacSymQat 32 * LacSymQat_ConstantsInitLookupTables 33 * 34 * 35 * @description 36 * The SymCy constants table is 1K of static data which is passed down 37 * to the FW to be stored in SHRAM for use by the FW. 38 * This function populates the associated lookup tables which the IA 39 * driver uses. 40 * Where there is config data available in the constants table the lookup 41 * table stores the offset into the constants table. 42 * Where there's no suitable config data available in the constants table 43 * zero is stored in the lookup table. 44 * 45 * @return none 46 * 47 *****************************************************************************/ 48void LacSymQat_ConstantsInitLookupTables(CpaInstanceHandle instanceHandle); 49 50/** 51******************************************************************************* 52* @ingroup LacSymQat 53* LacSymQat_ConstantsGetCipherOffset 54* 55* @description 56* This function looks up the cipher constants lookup array for 57* a specific cipher algorithm, mode, direction and convert flag. 58* If the lookup table value is zero then there's no suitable config data 59* available in the constants table. 60* If the value > zero, then there is config data available in the constants 61* table which is stored in SHRAM for use by the FW. The value is the offset 62* into the constants table, it is returned to the caller in poffset. 63* 64* 65* @param[in] Cipher Algorithm 66* @param[in] Cipher Mode 67* @param[in] Direction - encrypt/decrypt 68* @param[in] convert / no convert 69* @param[out] offset into constants table 70* 71* @return none 72* 73*****************************************************************************/ 74void LacSymQat_ConstantsGetCipherOffset(CpaInstanceHandle instanceHandle, 75 uint8_t algo, 76 uint8_t mode, 77 uint8_t direction, 78 uint8_t convert, 79 uint8_t *poffset); 80 81/** 82******************************************************************************* 83* @ingroup LacSymQat 84* LacSymQat_ConstantsGetAuthOffset 85* 86* @description 87* This function looks up the auth constants lookup array for 88* a specific auth algorithm, mode, direction and convert flag. 89* If the lookup table value is zero then there's no suitable config data 90* available in the constants table. 91* If the value > zero, then there is config data available in the constants 92* table which is stored in SHRAM for use by the FW. The value is the offset 93* into the constants table, it is returned to the caller in poffset. 94* 95* 96* @param[in] auth Algorithm 97* @param[in] auth Mode 98* @param[in] nested / no nested 99* @param[out] offset into constants table 100* 101* @return none 102* 103*****************************************************************************/ 104void LacSymQat_ConstantsGetAuthOffset(CpaInstanceHandle instanceHandle, 105 uint8_t algo, 106 uint8_t mode, 107 uint8_t nested, 108 uint8_t *poffset); 109 110#endif /* LAC_SYM_QAT_SHRAM_CONSTANTS_TABLE_H */ 111