• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of the openHiTLS project.
3  *
4  * openHiTLS is licensed under the Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *
8  *     http://license.coscl.org.cn/MulanPSL2
9  *
10  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13  * See the Mulan PSL v2 for more details.
14  */
15 
16 #ifndef __PROVIDER_TEST_UTILS_H__
17 #define __PROVIDER_TEST_UTILS_H__
18 
19 #include <stdint.h>
20 #include <stdbool.h>
21 #include "bsl_params.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 /**
27  * @brief Group information
28  */
29 typedef struct {
30     char *name;           // group name
31     int32_t paraId;             // parameter id CRYPT_PKEY_ParaId
32     int32_t algId;              // algorithm id CRYPT_PKEY_AlgId
33     int32_t secBits;           // security bits
34     uint16_t groupId;           // iana group id, HITLS_NamedGroup
35     int32_t pubkeyLen;         // public key length(CH keyshare / SH keyshare)
36     int32_t sharedkeyLen;      // shared key length
37     int32_t ciphertextLen;     // ciphertext length(SH keyshare)
38     uint32_t versionBits;       // TLS_VERSION_MASK
39     bool isKem;                // true: KEM, false: KEX
40 } Provider_Group;
41 
42 BSL_Param *TestFindParam(BSL_Param *param, int32_t key);
43 const BSL_Param *TestFindConstParam(const BSL_Param *param, int32_t key);
44 int32_t TestParamInitValue(BSL_Param *param, int32_t key, uint32_t type, void *val, uint32_t valueLen);
45 
46 int32_t TestCryptGetGroupCaps(const Provider_Group *tlsGroup, uint32_t groupCount,
47     CRYPT_EAL_ProcessFuncCb cb, void *args);
48 
49 #ifdef __cplusplus
50 }
51 #endif
52 
53 #endif
54 
55