1 /* 2 * Copyright 2014-2022 The GmSSL Project. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the License); you may 5 * not use this file except in compliance with the License. 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 */ 9 10 11 #ifndef HEADER_SKF_WISEC_H 12 #define HEADER_SKF_WISEC_H 13 14 #include "skf.h" 15 16 17 #define WISEC_SM1 (SGD_SM1) 18 #define WISEC_SM1_ECB (SGD_SM1_ECB) 19 #define WISEC_SM1_CBC (SGD_SM1_CBC) 20 #define WISEC_SM1_CFB (SGD_SM1_CFB) 21 #define WISEC_SM1_OFB (SGD_SM1_OFB) 22 #define WISEC_SM1_MAC (SGD_SM1_MAC) 23 24 #define WISEC_SSF33 (SGD_SSF33) 25 #define WISEC_SSF33_ECB (SGD_SSF33_ECB) 26 #define WISEC_SSF33_CBC (SGD_SSF33_CBC) 27 #define WISEC_SSF33_CFB (SGD_SSF33_CFB) 28 #define WISEC_SSF33_OFB (SGD_SSF33_OFB) 29 #define WISEC_SSF33_MAC (SGD_SSF33_MAC) 30 31 #define WISEC_SM4 (SGD_SM4) 32 #define WISEC_SM4_ECB (WISEC_SM4|SGD_ECB) 33 #define WISEC_SM4_CBC (WISEC_SM4|SGD_CBC) 34 #define WISEC_SM4_CFB (WISEC_SM4|SGD_CFB) 35 #define WISEC_SM4_OFB (WISEC_SM4|SGD_OFB) 36 #define WISEC_SM4_MAC (WISEC_SM4|SGD_MAC) 37 38 #define WISEC_AES 0x00000800 39 #define WISEC_128 0x00000000 40 #define WISEC_192 0x00000010 41 #define WISEC_256 0x00000020 42 #define WISEC_AES128 (WISEC_AES|WISEC_128) 43 #define WISEC_AES192 (WISEC_AES|WISEC_192) 44 #define WISEC_AES256 (WISEC_AES|WISEC_256) 45 #define WISEC_AES128_ECB (WISEC_AES128|SGD_ECB) 46 #define WISEC_AES128_CBC (WISEC_AES128|SGD_CBC) 47 #define WISEC_AES128_CFB (WISEC_AES128|SGD_CFB) 48 #define WISEC_AES128_OFB (WISEC_AES128|SGD_OFB) 49 #define WISEC_AES128_MAC (WISEC_AES128|SGD_MAC) 50 #define WISEC_AES192_ECB (WISEC_AES192|SGD_ECB) 51 #define WISEC_AES192_CBC (WISEC_AES192|SGD_CBC) 52 #define WISEC_AES192_CFB (WISEC_AES192|SGD_CFB) 53 #define WISEC_AES192_OFB (WISEC_AES192|SGD_OFB) 54 #define WISEC_AES192_MAC (WISEC_AES192|SGD_MAC) 55 #define WISEC_AES256_ECB (WISEC_AES256|SGD_ECB) 56 #define WISEC_AES256_CBC (WISEC_AES256|SGD_CBC) 57 #define WISEC_AES256_CFB (WISEC_AES256|SGD_CFB) 58 #define WISEC_AES256_OFB (WISEC_AES256|SGD_OFB) 59 #define WISEC_AES256_MAC (WISEC_AES256|SGD_MAC) 60 61 #define WISEC_DES 0x00001000 62 #define WISEC_DES_ECB (WISEC_DES|SGD_ECB) 63 #define WISEC_DES_CBC (WISEC_DES|SGD_CBC) 64 #define WISEC_DES_CFB (WISEC_DES|SGD_CFB) 65 #define WISEC_DES_OFB (WISEC_DES|SGD_OFB) 66 #define WISEC_DES_MAC (WISEC_DES|SGD_MAC) 67 68 #define WISEC_D3DES 0x00001010 69 #define WISEC_D3DES_ECB (WISEC_D3DES|SGD_ECB) 70 #define WISEC_D3DES_CBC (WISEC_D3DES|SGD_CBC) 71 #define WISEC_D3DES_CFB (WISEC_D3DES|SGD_CFB) 72 #define WISEC_D3DES_OFB (WISEC_D3DES|SGD_OFB) 73 #define WISEC_D3DES_MAC (WISEC_D3DES|SGD_MAC) 74 75 #define WISEC_T3DES 0x00001020 76 #define WISEC_T3DES_ECB (WISEC_T3DES|SGD_ECB) 77 #define WISEC_T3DES_CBC (WISEC_T3DES|SGD_CBC) 78 #define WISEC_T3DES_CFB (WISEC_T3DES|SGD_CFB) 79 #define WISEC_T3DES_OFB (WISEC_T3DES|SGD_OFB) 80 #define WISEC_T3DES_MAC (WISEC_T3DES|SGD_MAC) 81 82 #define WISEC_SM3 (SGD_SM3) 83 #define WISEC_SHA1 (SGD_SHA1) 84 #define WISEC_SHA256 (SGD_SHA256) 85 86 #define WISEC_RSA (SGD_RSA) 87 #define WISEC_RSA_SIGN (SGD_RSA_SIGN) 88 #define WISEC_RSA_ENC (SGD_RSA_ENC) 89 #define WISEC_SM2 (SGD_SM2) 90 #define WISEC_SM2_1 (SGD_SM2_1) 91 #define WISEC_SM2_2 (SGD_SM2_2) 92 #define WISEC_SM2_3 (SGD_SM2_3) 93 94 95 #define WISEC_AUTH_BLOCKED 0x0A000033 96 #define WISEC_CERTNOUSAGEERR 0x0A000034 97 #define WISEC_INVALIDCONTAINERERR 0x0A000035 98 #define WISEC_CONTAINER_NOT_EXISTS 0x0A000036 99 #define WISEC_CONTAINER_EXISTS 0x0A000037 100 #define WISEC_CERTUSAGEERR 0x0A000038 101 #define WISEC_KEYNOUSAGEERR 0x0A000039 102 #define WISEC_FILEATTRIBUTEERR 0x0A00003A 103 #define WISEC_DEVNOAUTH 0x0A00003B 104 105 /* 106 ULONG DEVAPI SKFE_SetSN(DEVHANDLE hDev, CHAR *SN, UINT SNLen); 107 ULONG DEVAPI SKFE_GenExtECCKey(DEVHANDLE hDev, PECCPRIVATEKEYBLOB pPriBlob, PECCPUBLICKEYBLOB pPubBlob); 108 ULONG DEVAPI SKF_ECCDecrypt(HCONTAINER hContainer, PECCCIPHERBLOB pCipherText, BYTE *pbPlainText,ULONG *pulPlainTextLen); 109 ULONG DEVAPI SKF_GenerateKey(HCONTAINER hContainer, ULONG ulAlgId, HANDLE *phSessionKey) ; 110 ULONG DEVAPI SKF_ECCExportSessionKeyByHandle(HANDLE phSessionKey, ECCPUBLICKEYBLOB *pPubKey,PECCCIPHERBLOB pData); 111 ULONG DEVAPI SKF_RSAExportSessionKeyByHandle(HANDLE phSessionKey, RSAPUBLICKEYBLOB*pPubKey,BYTE *pbData, ULONG *pulDataLen); 112 ULONG DEVAPI SKF_PrvKeyDecrypt(HCONTAINER hContainer, PECCCIPHERBLOB pCipherText, BYTE *pbData, ULONG *pbDataLen); 113 ULONG DEVAPI SKF_PrvKeyDecrypt(HCONTAINER hContainer, ULONG ulType, PECCCIPHERBLOB pCipherText, BYTE *pbData, ULONG *pbDataLen); 114 ULONG DEVAPI SKF_RSAPrvKeyDecrypt(HCONTAINER hContainer, BYTE *pCipherData, ULONG pCipherDataLen, BYTE *pbData, ULONG *pbDataLen); 115 */ 116 117 #endif 118