• 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 CRYPT_HYBRIDKEM_H
17 #define CRYPT_HYBRIDKEM_H
18 #include <stdint.h>
19 #include "crypt_types.h"
20 
21 #include "hitls_build.h"
22 #ifdef HITLS_CRYPTO_ECDH
23 
24 typedef struct HybridKemCtx CRYPT_HybridKemCtx;
25 
26 CRYPT_HybridKemCtx *CRYPT_HYBRID_KEM_NewCtx(void);
27 
28 CRYPT_HybridKemCtx *CRYPT_HYBRID_KEM_NewCtxEx(void *libCtx);
29 
30 void CRYPT_HYBRID_KEM_FreeCtx(CRYPT_HybridKemCtx *ctx);
31 
32 int32_t CRYPT_HYBRID_KEM_KeyCtrl(CRYPT_HybridKemCtx *ctx, int32_t opt, void *val, uint32_t len);
33 
34 int32_t CRYPT_HYBRID_KEM_GenKey(CRYPT_HybridKemCtx *ctx);
35 
36 int32_t CRYPT_HYBRID_KEM_SetEncapsKey(CRYPT_HybridKemCtx *ctx, const BSL_Param *param);
37 int32_t CRYPT_HYBRID_KEM_SetDecapsKey(CRYPT_HybridKemCtx *ctx, const BSL_Param *param);
38 
39 int32_t CRYPT_HYBRID_KEM_GetEncapsKey(const CRYPT_HybridKemCtx *ctx, BSL_Param *param);
40 int32_t CRYPT_HYBRID_KEM_GetDecapsKey(const CRYPT_HybridKemCtx *ctx, BSL_Param *param);
41 
42 int32_t CRYPT_HYBRID_KEM_Encaps(const CRYPT_HybridKemCtx *ctx, uint8_t *cipher, uint32_t *cipherLen,
43     uint8_t *share, uint32_t *shareLen);
44 
45 int32_t CRYPT_HYBRID_KEM_Decaps(const CRYPT_HybridKemCtx *ctx, uint8_t *cipher, uint32_t cipherLen,
46     uint8_t *share, uint32_t *shareLen);
47 
48 #endif
49 #endif    // CRYPT_HYBRIDKEM_H
50