update gm apis

This commit is contained in:
Zhi Guan
2017-02-19 23:41:47 +08:00
parent d7aca8255f
commit 90a001b539
52 changed files with 5370 additions and 7038 deletions

443
include/internal/sdf_meth.h Normal file
View File

@@ -0,0 +1,443 @@
/* ====================================================================
* Copyright (c) 2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
#ifndef HEADER_SDF_METH_H
#define HEADER_SDF_METH_H
#include <openssl/sgd.h>
#include <openssl/sdf.h>
#include "internal/dso.h"
typedef int (*SDF_OpenDevice_FuncPtr)(
void **phDeviceHandle);
typedef int (*SDF_CloseDevice_FuncPtr)(
void *hDeviceHandle);
typedef int (*SDF_OpenSession_FuncPtr)(
void *hDeviceHandle,
void **phSessionHandle);
typedef int (*SDF_CloseSession_FuncPtr)(
void *hSessionHandle);
typedef int (*SDF_GetDeviceInfo_FuncPtr)(
void *hSessionHandle,
DEVICEINFO *pstDeviceInfo);
typedef int (*SDF_GenerateRandom_FuncPtr)(
void *hSessionHandle,
unsigned int uiLength,
unsigned char *pucRandom);
typedef int (*SDF_GetPrivateKeyAccessRight_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
unsigned char *pucPassword,
unsigned int uiPwdLength);
typedef int (*SDF_ReleasePrivateKeyAccessRight_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex);
typedef int (*SDF_ExportSignPublicKey_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
RSArefPublicKey *pucPublicKey);
typedef int (*SDF_ExportEncPublicKey_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
RSArefPublicKey *pucPublicKey);
typedef int (*SDF_GenerateKeyPair_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyBits,
RSArefPublicKey *pucPublicKey,
RSArefPrivateKey *pucPrivateKey);
typedef int (*SDF_GenerateKeyWithIPK_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiIPKIndex,
unsigned int uiKeyBits,
unsigned char *pucKey,
unsigned int *puiKeyLength,
void **phKeyHandle);
typedef int (*SDF_GenerateKeyWithEPK_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyBits,
RSArefPublicKey *pucPublicKey,
unsigned char *pucKey,
unsigned int *puiKeyLength,
void **phKeyHandle);
typedef int (*SDF_ImportKeyWithISK_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiISKIndex,
unsigned char *pucKey,
unsigned int uiKeyLength,
void **phKeyHandle);
typedef int (*SDF_ExchangeDigitEnvelopeBaseOnRSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
RSArefPublicKey *pucPublicKey,
unsigned char *pucDEInput,
unsigned int uiDELength,
unsigned char *pucDEOutput,
unsigned int *puiDELength);
typedef int (*SDF_ExportSignPublicKey_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
ECCrefPublicKey *pucPublicKey);
typedef int (*SDF_ExportEncPublicKey_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
ECCrefPublicKey *pucPublicKey);
typedef int (*SDF_GenerateKeyPair_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiAlgID,
unsigned int uiKeyBits,
ECCrefPublicKey *pucPublicKey,
ECCrefPrivateKey *pucPrivateKey);
typedef int (*SDF_GenerateKeyWithIPK_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiIPKIndex,
unsigned int uiKeyBits,
ECCCipher *pucKey,
void **phKeyHandle);
typedef int (*SDF_GenerateKeyWithEPK_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyBits,
unsigned int uiAlgID,
ECCrefPublicKey *pucPublicKey,
ECCCipher *pucKey,
void **phKeyHandle);
typedef int (*SDF_ImportKeyWithISK_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiISKIndex,
ECCCipher *pucKey,
void **phKeyHandle);
typedef int (*SDF_GenerateAgreementDataWithECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiISKIndex,
unsigned int uiKeyBits,
unsigned char *pucSponsorID,
unsigned int uiSponsorIDLength,
ECCrefPublicKey *pucSponsorPublicKey,
ECCrefPublicKey *pucSponsorTmpPublicKey,
void **phAgreementHandle);
typedef int (*SDF_GenerateKeyWithECC_FuncPtr)(
void *hSessionHandle,
unsigned char *pucResponseID,
unsigned int uiResponseIDLength,
ECCrefPublicKey *pucResponsePublicKey,
ECCrefPublicKey *pucResponseTmpPublicKey,
void *hAgreementHandle,
void **phKeyHandle);
typedef int (*SDF_GenerateAgreementDataAndKeyWithECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiISKIndex,
unsigned int uiKeyBits,
unsigned char *pucResponseID,
unsigned int uiResponseIDLength,
unsigned char *pucSponsorID,
unsigned int uiSponsorIDLength,
ECCrefPublicKey *pucSponsorPublicKey,
ECCrefPublicKey *pucSponsorTmpPublicKey,
ECCrefPublicKey *pucResponsePublicKey,
ECCrefPublicKey *pucResponseTmpPublicKey,
void **phKeyHandle);
typedef int (*SDF_ExchangeDigitEnvelopeBaseOnECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
unsigned int uiAlgID,
ECCrefPublicKey *pucPublicKey,
ECCCipher *pucEncDataIn,
ECCCipher *pucEncDataOut);
typedef int (*SDF_GenerateKeyWithKEK_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyBits,
unsigned int uiAlgID,
unsigned int uiKEKIndex,
unsigned char *pucKey,
unsigned int *puiKeyLength,
void **phKeyHandle);
typedef int (*SDF_ImportKeyWithKEK_FuncPtr)(
void *hSessionHandle,
unsigned int uiAlgID,
unsigned int uiKEKIndex,
unsigned char *pucKey,
unsigned int uiKeyLength,
void **phKeyHandle);
typedef int (*SDF_DestroyKey_FuncPtr)(
void *hSessionHandle,
void *hKeyHandle);
typedef int (*SDF_ExternalPublicKeyOperation_RSA_FuncPtr)(
void *hSessionHandle,
RSArefPublicKey *pucPublicKey,
unsigned char *pucDataInput,
unsigned int uiInputLength,
unsigned char *pucDataOutput,
unsigned int *puiOutputLength);
typedef int (*SDF_InternalPublicKeyOperation_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
unsigned char *pucDataInput,
unsigned int uiInputLength,
unsigned char *pucDataOutput,
unsigned int *puiOutputLength);
typedef int (*SDF_InternalPrivateKeyOperation_RSA_FuncPtr)(
void *hSessionHandle,
unsigned int uiKeyIndex,
unsigned char *pucDataInput,
unsigned int uiInputLength,
unsigned char *pucDataOutput,
unsigned int *puiOutputLength);
typedef int (*SDF_ExternalVerify_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiAlgID,
ECCrefPublicKey *pucPublicKey,
unsigned char *pucDataInput,
unsigned int uiInputLength,
ECCSignature *pucSignature);
typedef int (*SDF_InternalSign_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiISKIndex,
unsigned char *pucData,
unsigned int uiDataLength,
ECCSignature *pucSignature);
typedef int (*SDF_InternalVerify_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiIPKIndex,
unsigned char *pucData,
unsigned int uiDataLength,
ECCSignature *pucSignature);
typedef int (*SDF_ExternalEncrypt_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiAlgID,
ECCrefPublicKey *pucPublicKey,
unsigned char *pucData,
unsigned int uiDataLength,
ECCCipher *pucEncData);
typedef int (*SDF_ExternalDecrypt_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiAlgID,
ECCrefPrivateKey *pucPrivateKey,
ECCCipher *pucEncData,
unsigned char *pucData,
unsigned int *puiDataLength);
typedef int (*SDF_InternalEncrypt_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiIPKIndex,
unsigned int uiAlgID,
unsigned char *pucData,
unsigned int uiDataLength,
ECCCipher *pucEncData);
typedef int (*SDF_InternalDecrypt_ECC_FuncPtr)(
void *hSessionHandle,
unsigned int uiISKIndex,
unsigned int uiAlgID,
ECCCipher *pucEncData,
unsigned char *pucData,
unsigned int *puiDataLength);
typedef int (*SDF_Encrypt_FuncPtr)(
void *hSessionHandle,
void *hKeyHandle,
unsigned int uiAlgID,
unsigned char *pucIV,
unsigned char *pucData,
unsigned int uiDataLength,
unsigned char *pucEncData,
unsigned int *puiEncDataLength);
typedef int (*SDF_Decrypt_FuncPtr)(
void *hSessionHandle,
void *hKeyHandle,
unsigned int uiAlgID,
unsigned char *pucIV,
unsigned char *pucEncData,
unsigned int uiEncDataLength,
unsigned char *pucData,
unsigned int *puiDataLength);
typedef int (*SDF_CalculateMAC_FuncPtr)(
void *hSessionHandle,
void *hKeyHandle,
unsigned int uiAlgID,
unsigned char *pucIV,
unsigned char *pucData,
unsigned int uiDataLength,
unsigned char *pucMAC,
unsigned int *puiMACLength);
typedef int (*SDF_HashInit_FuncPtr)(
void *hSessionHandle,
unsigned int uiAlgID,
ECCrefPublicKey *pucPublicKey,
unsigned char *pucID,
unsigned int uiIDLength);
typedef int (*SDF_HashUpdate_FuncPtr)(
void *hSessionHandle,
unsigned char *pucData,
unsigned int uiDataLength);
typedef int (*SDF_HashFinal_FuncPtr)(void *hSessionHandle,
unsigned char *pucHash,
unsigned int *puiHashLength);
typedef int (*SDF_CreateFile_FuncPtr)(
void *hSessionHandle,
unsigned char *pucFileName,
unsigned int uiNameLen,
unsigned int uiFileSize);
typedef int (*SDF_ReadFile_FuncPtr)(
void *hSessionHandle,
unsigned char *pucFileName,
unsigned int uiNameLen,
unsigned int uiOffset,
unsigned int *puiReadLength,
unsigned char *pucBuffer);
typedef int (*SDF_WriteFile_FuncPtr)(
void *hSessionHandle,
unsigned char *pucFileName,
unsigned int uiNameLen,
unsigned int uiOffset,
unsigned int uiWriteLength,
unsigned char *pucBuffer);
typedef int (*SDF_DeleteFile_FuncPtr)(
void *hSessionHandle,
unsigned char *pucFileName,
unsigned int uiNameLen);
typedef struct sdf_method_st {
char *name;
SDF_OpenDevice_FuncPtr OpenDevice;
SDF_CloseDevice_FuncPtr CloseDevice;
SDF_OpenSession_FuncPtr OpenSession;
SDF_CloseSession_FuncPtr CloseSession;
SDF_GetDeviceInfo_FuncPtr GetDeviceInfo;
SDF_GenerateRandom_FuncPtr GenerateRandom;
SDF_GetPrivateKeyAccessRight_FuncPtr GetPrivateKeyAccessRight;
SDF_ReleasePrivateKeyAccessRight_FuncPtr ReleasePrivateKeyAccessRight;
SDF_ExportSignPublicKey_RSA_FuncPtr ExportSignPublicKey_RSA;
SDF_ExportEncPublicKey_RSA_FuncPtr ExportEncPublicKey_RSA;
SDF_GenerateKeyPair_RSA_FuncPtr GenerateKeyPair_RSA;
SDF_GenerateKeyWithIPK_RSA_FuncPtr GenerateKeyWithIPK_RSA;
SDF_GenerateKeyWithEPK_RSA_FuncPtr GenerateKeyWithEPK_RSA;
SDF_ImportKeyWithISK_RSA_FuncPtr ImportKeyWithISK_RSA;
SDF_ExchangeDigitEnvelopeBaseOnRSA_FuncPtr ExchangeDigitEnvelopeBaseOnRSA;
SDF_ExportSignPublicKey_ECC_FuncPtr ExportSignPublicKey_ECC;
SDF_ExportEncPublicKey_ECC_FuncPtr ExportEncPublicKey_ECC;
SDF_GenerateKeyPair_ECC_FuncPtr GenerateKeyPair_ECC;
SDF_GenerateKeyWithIPK_ECC_FuncPtr GenerateKeyWithIPK_ECC;
SDF_GenerateKeyWithEPK_ECC_FuncPtr GenerateKeyWithEPK_ECC;
SDF_ImportKeyWithISK_ECC_FuncPtr ImportKeyWithISK_ECC;
SDF_GenerateAgreementDataWithECC_FuncPtr GenerateAgreementDataWithECC;
SDF_GenerateKeyWithECC_FuncPtr GenerateKeyWithECC;
SDF_GenerateAgreementDataAndKeyWithECC_FuncPtr GenerateAgreementDataAndKeyWithECC;
SDF_ExchangeDigitEnvelopeBaseOnECC_FuncPtr ExchangeDigitEnvelopeBaseOnECC;
SDF_GenerateKeyWithKEK_FuncPtr GenerateKeyWithKEK;
SDF_ImportKeyWithKEK_FuncPtr ImportKeyWithKEK;
SDF_DestroyKey_FuncPtr DestroyKey;
SDF_ExternalPublicKeyOperation_RSA_FuncPtr ExternalPublicKeyOperation_RSA;
SDF_InternalPublicKeyOperation_RSA_FuncPtr InternalPublicKeyOperation_RSA;
SDF_InternalPrivateKeyOperation_RSA_FuncPtr InternalPrivateKeyOperation_RSA;
SDF_ExternalVerify_ECC_FuncPtr ExternalVerify_ECC;
SDF_InternalSign_ECC_FuncPtr InternalSign_ECC;
SDF_InternalVerify_ECC_FuncPtr InternalVerify_ECC;
SDF_ExternalEncrypt_ECC_FuncPtr ExternalEncrypt_ECC;
SDF_ExternalDecrypt_ECC_FuncPtr ExternalDecrypt_ECC;
SDF_InternalEncrypt_ECC_FuncPtr InternalEncrypt_ECC;
SDF_InternalDecrypt_ECC_FuncPtr InternalDecrypt_ECC;
SDF_Encrypt_FuncPtr Encrypt;
SDF_Decrypt_FuncPtr Decrypt;
SDF_CalculateMAC_FuncPtr CalculateMAC;
SDF_HashInit_FuncPtr HashInit;
SDF_HashUpdate_FuncPtr HashUpdate;
SDF_HashFinal_FuncPtr HashFinal;
SDF_CreateFile_FuncPtr CreateFile;
SDF_ReadFile_FuncPtr ReadFile;
SDF_WriteFile_FuncPtr WriteFile;
SDF_DeleteFile_FuncPtr DeleteFile;
} SDF_METHOD;
SDF_METHOD *SDF_METHOD_load_library(const char *so_path);
#endif

616
include/internal/skf_meth.h Normal file
View File

@@ -0,0 +1,616 @@
/* ====================================================================
* Copyright (c) 2015 - 2017 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
#ifndef HEADER_SKF_METH_H
#define HEADER_SKF_METH_H
typedef signed char INT8;
typedef signed short INT16;
typedef signed int INT32;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef long BOOL;
typedef UINT8 BYTE;
typedef UINT8 CHAR;
typedef INT16 SHORT;
typedef UINT16 USHORT;
typedef INT32 LONG;
typedef UINT32 ULONG;
typedef UINT32 UINT;
typedef UINT16 WORD;
typedef UINT32 DWORD;
typedef UINT32 FLAGS;
typedef CHAR * LPSTR;
typedef void * HANDLE;
#ifdef __cplusplus
extern "C" {
#endif
typedef ULONG (*SKF_WaitForDevEvent_FuncPtr)(
LPSTR szDevName,
ULONG *pulDevNameLen,
ULONG *pulEvent);
typedef ULONG (*SKF_CancelWaitForDevEvent_FuncPtr)(
void);
typedef ULONG (*SKF_EnumDev_FuncPtr)(
BOOL bPresent,
LPSTR szNameList,
ULONG *pulSize);
typedef ULONG (*SKF_ConnectDev_FuncPtr)(
LPSTR szName,
DEVHANDLE *phDev);
typedef ULONG (*SKF_DisConnectDev_FuncPtr)(
DEVHANDLE hDev);
typedef ULONG (*SKF_GetDevState_FuncPtr)(
LPSTR szDevName,
ULONG *pulDevState);
typedef ULONG (*SKF_SetLabel_FuncPtr)(
DEVHANDLE hDev,
LPSTR szLabel);
typedef ULONG (*SKF_GetDevInfo_FuncPtr)(
DEVHANDLE hDev,
DEVINFO *pDevInfo);
typedef ULONG (*SKF_LockDev_FuncPtr)(
DEVHANDLE hDev,
ULONG ulTimeOut);
typedef ULONG (*SKF_UnlockDev_FuncPtr)(
DEVHANDLE hDev);
typedef ULONG (*SKF_Transmit_FuncPtr)(
DEVHANDLE hDev,
BYTE *pbCommand,
ULONG ulCommandLen,
BYTE *pbData,
ULONG *pulDataLen);
typedef ULONG (*SKF_ChangeDevAuthKey_FuncPtr)(
DEVHANDLE hDev,
BYTE *pbKeyValue,
ULONG ulKeyLen);
typedef ULONG (*SKF_DevAuth_FuncPtr)(
DEVHANDLE hDev,
BYTE *pbAuthData,
ULONG ulLen);
typedef ULONG (*SKF_ChangePIN_FuncPtr)(
HAPPLICATION hApplication,
ULONG ulPINType,
LPSTR szOldPin,
LPSTR szNewPin,
ULONG *pulRetryCount);
typedef LONG (*SKF_GetPINInfo_FuncPtr)(
HAPPLICATION hApplication,
ULONG ulPINType,
ULONG *pulMaxRetryCount,
ULONG *pulRemainRetryCount,
BOOL *pbDefaultPin);
typedef ULONG (*SKF_VerifyPIN_FuncPtr)(
HAPPLICATION hApplication,
ULONG ulPINType,
LPSTR szPIN,
ULONG *pulRetryCount);
typedef ULONG (*SKF_UnblockPIN_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szAdminPIN,
LPSTR szNewUserPIN,
ULONG *pulRetryCount);
typedef ULONG (*SKF_ClearSecureState_FuncPtr)(
HAPPLICATION hApplication);
typedef ULONG (*SKF_CreateApplication_FuncPtr)(
DEVHANDLE hDev,
LPSTR szAppName,
LPSTR szAdminPin,
DWORD dwAdminPinRetryCount,
LPSTR szUserPin,
DWORD dwUserPinRetryCount,
DWORD dwCreateFileRights,
HAPPLICATION *phApplication);
typedef ULONG (*SKF_EnumApplication_FuncPtr)(
DEVHANDLE hDev,
LPSTR szAppName,
ULONG *pulSize);
typedef ULONG (*SKF_DeleteApplication_FuncPtr)(
DEVHANDLE hDev,
LPSTR szAppName);
typedef ULONG (*SKF_OpenApplication_FuncPtr)(
DEVHANDLE hDev,
LPSTR szAppName,
HAPPLICATION *phApplication);
typedef ULONG (*SKF_CloseApplication_FuncPtr)(
HAPPLICATION hApplication);
typedef ULONG (*SKF_CreateFile_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szFileName,
ULONG ulFileSize,
ULONG ulReadRights,
ULONG ulWriteRights);
typedef ULONG (*SKF_DeleteFile_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szFileName);
typedef ULONG (*SKF_EnumFiles_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szFileList,
ULONG *pulSize);
typedef ULONG (*SKF_GetFileInfo_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szFileName,
FILEATTRIBUTE *pFileInfo);
typedef ULONG (*SKF_ReadFile_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szFileName,
ULONG ulOffset,
ULONG ulSize,
BYTE *pbOutData,
ULONG *pulOutLen);
typedef ULONG (*SKF_WriteFile_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szFileName,
ULONG ulOffset,
BYTE *pbData,
ULONG ulSize);
typedef ULONG (*SKF_CreateContainer_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szContainerName,
HCONTAINER *phContainer);
typedef ULONG (*SKF_DeleteContainer_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szContainerName);
typedef ULONG (*SKF_EnumContainer_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szContainerName,
ULONG *pulSize);
typedef ULONG (*SKF_OpenContainer_FuncPtr)(
HAPPLICATION hApplication,
LPSTR szContainerName,
HCONTAINER *phContainer);
typedef ULONG (*SKF_CloseContainer_FuncPtr)(
HCONTAINER hContainer);
typedef ULONG (*SKF_GetContainerType_FuncPtr)(
HCONTAINER hContainer,
ULONG *pulContainerType);
typedef ULONG (*SKF_ImportCertificate_FuncPtr)(
HCONTAINER hContainer,
BOOL bExportSignKey,
BYTE *pbCert,
ULONG ulCertLen);
typedef ULONG (*SKF_ExportCertificate_FuncPtr)(
HCONTAINER hContainer,
BOOL bSignFlag,
BYTE *pbCert,
ULONG *pulCertLen);
typedef ULONG (*SKF_ExportPublicKey_FuncPtr)(
HCONTAINER hContainer,
BOOL bSignFlag,
BYTE *pbBlob,
ULONG *pulBlobLen);
typedef ULONG (*SKF_GenRandom_FuncPtr)(
DEVHANDLE hDev,
BYTE *pbRandom,
ULONG ulRandomLen);
typedef ULONG (*SKF_GenExtRSAKey_FuncPtr)(
DEVHANDLE hDev,
ULONG ulBitsLen,
RSAPRIVATEKEYBLOB *pBlob);
typedef ULONG (*SKF_GenRSAKeyPair_FuncPtr)(
HCONTAINER hContainer,
ULONG ulBitsLen,
RSAPUBLICKEYBLOB *pBlob);
typedef ULONG (*SKF_ImportRSAKeyPair_FuncPtr)(
HCONTAINER hContainer,
ULONG ulSymAlgId,
BYTE *pbWrappedKey,
ULONG ulWrappedKeyLen,
BYTE *pbEncryptedData,
ULONG ulEncryptedDataLen);
typedef ULONG (*SKF_RSASignData_FuncPtr)(
HCONTAINER hContainer,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbSignature,
ULONG *pulSignLen);
typedef ULONG (*SKF_RSAVerify_FuncPtr)(
DEVHANDLE hDev,
RSAPUBLICKEYBLOB *pRSAPubKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbSignature,
ULONG ulSignLen);
typedef ULONG (*SKF_RSAExportSessionKey_FuncPtr)(
HCONTAINER hContainer,
ULONG ulAlgId,
RSAPUBLICKEYBLOB *pPubKey,
BYTE *pbData,
ULONG *pulDataLen,
HANDLE *phSessionKey);
typedef ULONG (*SKF_ExtRSAPubKeyOperation_FuncPtr)(
DEVHANDLE hDev,
RSAPUBLICKEYBLOB *pRSAPubKeyBlob,
BYTE *pbInput,
ULONG ulInputLen,
BYTE *pbOutput,
ULONG *pulOutputLen);
typedef ULONG (*SKF_ExtRSAPriKeyOperation_FuncPtr)(
DEVHANDLE hDev,
RSAPRIVATEKEYBLOB *pRSAPriKeyBlob,
BYTE *pbInput,
ULONG ulInputLen,
BYTE *pbOutput,
ULONG *pulOutputLen);
typedef ULONG (*SKF_GenECCKeyPair_FuncPtr)(
HCONTAINER hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pBlob);
typedef ULONG (*SKF_ImportECCKeyPair_FuncPtr)(
HCONTAINER hContainer,
ENVELOPEDKEYBLOB *pEnvelopedKeyBlob);
typedef ULONG (*SKF_ECCSignData_FuncPtr)(
HCONTAINER hContainer,
BYTE *pbDigest,
ULONG ulDigestLen,
ECCSIGNATUREBLOB *pSignature);
typedef ULONG (*SKF_ECCVerify_FuncPtr)(
DEVHANDLE hDev,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
ECCSIGNATUREBLOB *pSignature);
typedef ULONG (*SKF_ECCExportSessionKey_FuncPtr)(
HCONTAINER hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pPubKey,
ECCCIPHERBLOB *pData,
HANDLE *phSessionKey);
typedef ULONG (*SKF_ExtECCEncrypt_FuncPtr)(
DEVHANDLE hDev,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
BYTE *pbPlainText,
ULONG ulPlainTextLen,
ECCCIPHERBLOB *pCipherText);
typedef ULONG (*SKF_ExtECCDecrypt_FuncPtr)(
DEVHANDLE hDev,
ECCPRIVATEKEYBLOB *pECCPriKeyBlob,
ECCCIPHERBLOB *pCipherText,
BYTE *pbPlainText,
ULONG *pulPlainTextLen);
typedef ULONG (*SKF_ExtECCSign_FuncPtr)(
DEVHANDLE hDev,
ECCPRIVATEKEYBLOB *pECCPriKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
ECCSIGNATUREBLOB *pSignature);
typedef ULONG (*SKF_ExtECCVerify_FuncPtr)(
DEVHANDLE hDev,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
BYTE *pbData,
ULONG ulDataLen,
ECCSIGNATUREBLOB *pSignature);
typedef ULONG (*SKF_GenerateAgreementDataWithECC_FuncPtr)(
HCONTAINER hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pTempECCPubKeyBlob,
BYTE *pbID,
ULONG ulIDLen,
HANDLE *phAgreementHandle);
typedef ULONG (*SKF_GenerateAgreementDataAndKeyWithECC_FuncPtr)(
HANDLE hContainer,
ULONG ulAlgId,
ECCPUBLICKEYBLOB *pSponsorECCPubKeyBlob,
ECCPUBLICKEYBLOB *pSponsorTempECCPubKeyBlob,
ECCPUBLICKEYBLOB *pTempECCPubKeyBlob,
BYTE *pbID,
ULONG ulIDLen,
BYTE *pbSponsorID,
ULONG ulSponsorIDLen,
HANDLE *phKeyHandle);
typedef ULONG (*SKF_GenerateKeyWithECC_FuncPtr)(
HANDLE hAgreementHandle,
ECCPUBLICKEYBLOB *pECCPubKeyBlob,
ECCPUBLICKEYBLOB *pTempECCPubKeyBlob,
BYTE *pbID,
ULONG ulIDLen,
HANDLE *phKeyHandle);
typedef ULONG (*SKF_ImportSessionKey_FuncPtr)(
HCONTAINER hContainer,
ULONG ulAlgId,
BYTE *pbWrapedData,
ULONG ulWrapedLen,
HANDLE *phKey);
typedef ULONG (*SKF_SetSymmKey_FuncPtr)(
DEVHANDLE hDev,
BYTE *pbKey,
ULONG ulAlgID,
HANDLE *phKey);
typedef ULONG (*SKF_EncryptInit_FuncPtr)(
HANDLE hKey,
BLOCKCIPHERPARAM EncryptParam);
typedef ULONG (*SKF_Encrypt_FuncPtr)(
HANDLE hKey,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbEncryptedData,
ULONG *pulEncryptedLen);
typedef ULONG (*SKF_EncryptUpdate_FuncPtr)(
HANDLE hKey,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbEncryptedData,
ULONG *pulEncryptedLen);
typedef ULONG (*SKF_EncryptFinal_FuncPtr)(
HANDLE hKey,
BYTE *pbEncryptedData,
ULONG *pulEncryptedDataLen);
typedef ULONG (*SKF_DecryptInit_FuncPtr)(
HANDLE hKey,
BLOCKCIPHERPARAM DecryptParam);
typedef ULONG (*SKF_Decrypt_FuncPtr)(
HANDLE hKey,
BYTE *pbEncryptedData,
ULONG ulEncryptedLen,
BYTE *pbData,
ULONG *pulDataLen);
typedef ULONG (*SKF_DecryptUpdate_FuncPtr)(
HANDLE hKey,
BYTE *pbEncryptedData,
ULONG ulEncryptedLen,
BYTE *pbData,
ULONG *pulDataLen);
typedef ULONG (*SKF_DecryptFinal_FuncPtr)(
HANDLE hKey,
BYTE *pbDecryptedData,
ULONG *pulDecryptedDataLen);
typedef ULONG (*SKF_DigestInit_FuncPtr)(
DEVHANDLE hDev,
ULONG ulAlgID,
ECCPUBLICKEYBLOB *pPubKey,
BYTE *pbID,
ULONG ulIDLen,
HANDLE *phHash);
typedef ULONG (*SKF_Digest_FuncPtr)(
HANDLE hHash,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbHashData,
ULONG *pulHashLen);
typedef ULONG (*SKF_DigestUpdate_FuncPtr)(
HANDLE hHash,
BYTE *pbData,
ULONG ulDataLen);
typedef ULONG (*SKF_DigestFinal_FuncPtr)(
HANDLE hHash,
BYTE *pHashData,
ULONG *pulHashLen);
typedef ULONG (*SKF_MacInit_FuncPtr)(
HANDLE hKey,
BLOCKCIPHERPARAM *pMacParam,
HANDLE *phMac);
typedef ULONG (*SKF_Mac_FuncPtr)(
HANDLE hMac,
BYTE *pbData,
ULONG ulDataLen,
BYTE *pbMacData,
ULONG *pulMacLen);
typedef ULONG (*SKF_MacUpdate_FuncPtr)(
HANDLE hMac,
BYTE *pbData,
ULONG ulDataLen);
typedef ULONG (*SKF_MacFinal_FuncPtr)(
HANDLE hMac,
BYTE *pbMacData,
ULONG *pulMacDataLen);
typedef ULONG (*SKF_CloseHandle_FuncPtr)(
HANDLE hHandle);
typedef struct skf_method_st {
char *name;
SKF_WaitForDevEvent_FuncPtr WaitForDevEvent;
SKF_CancelWaitForDevEvent_FuncPtr CancelWaitForDevEvent;
SKF_EnumDev_FuncPtr EnumDev;
SKF_ConnectDev_FuncPtr ConnectDev;
SKF_DisConnectDev_FuncPtr DisConnectDev;
SKF_GetDevState_FuncPtr GetDevState;
SKF_SetLabel_FuncPtr SetLabel;
SKF_GetDevInfo_FuncPtr GetDevInfo;
SKF_LockDev_FuncPtr LockDev;
SKF_UnlockDev_FuncPtr UnlockDev;
SKF_Transmit_FuncPtr Transmit;
SKF_ChangeDevAuthKey_FuncPtr ChangeDevAuthKey;
SKF_DevAuth_FuncPtr DevAuth;
SKF_ChangePIN_FuncPtr ChangePIN;
SKF_GetPINInfo_FuncPtr GetPINInfo;
SKF_VerifyPIN_FuncPtr VerifyPIN;
SKF_UnblockPIN_FuncPtr UnblockPIN;
SKF_ClearSecureState_FuncPtr ClearSecureState;
SKF_CreateApplication_FuncPtr CreateApplication;
SKF_EnumApplication_FuncPtr EnumApplication;
SKF_DeleteApplication_FuncPtr DeleteApplication;
SKF_OpenApplication_FuncPtr OpenApplication;
SKF_CloseApplication_FuncPtr CloseApplication;
SKF_CreateFile_FuncPtr CreateFile;
SKF_DeleteFile_FuncPtr DeleteFile;
SKF_EnumFiles_FuncPtr EnumFiles;
SKF_GetFileInfo_FuncPtr GetFileInfo;
SKF_ReadFile_FuncPtr ReadFile;
SKF_WriteFile_FuncPtr WriteFile;
SKF_CreateContainer_FuncPtr CreateContainer;
SKF_DeleteContainer_FuncPtr DeleteContainer;
SKF_EnumContainer_FuncPtr EnumContainer;
SKF_OpenContainer_FuncPtr OpenContainer;
SKF_CloseContainer_FuncPtr CloseContainer;
SKF_GetContainerType_FuncPtr GetContainerType;
SKF_ImportCertificate_FuncPtr ImportCertificate;
SKF_ExportCertificate_FuncPtr ExportCertificate;
SKF_ExportPublicKey_FuncPtr ExportPublicKey;
SKF_GenRandom_FuncPtr GenRandom;
SKF_GenExtRSAKey_FuncPtr GenExtRSAKey;
SKF_GenRSAKeyPair_FuncPtr GenRSAKeyPair;
SKF_ImportRSAKeyPair_FuncPtr ImportRSAKeyPair;
SKF_RSASignData_FuncPtr RSASignData;
SKF_RSAVerify_FuncPtr RSAVerify;
SKF_RSAExportSessionKey_FuncPtr RSAExportSessionKey;
SKF_ExtRSAPubKeyOperation_FuncPtr ExtRSAPubKeyOperation;
SKF_ExtRSAPriKeyOperation_FuncPtr ExtRSAPriKeyOperation;
SKF_GenECCKeyPair_FuncPtr GenECCKeyPair;
SKF_ImportECCKeyPair_FuncPtr ImportECCKeyPair;
SKF_ECCSignData_FuncPtr ECCSignData;
SKF_ECCVerify_FuncPtr ECCVerify;
SKF_ECCExportSessionKey_FuncPtr ECCExportSessionKey;
SKF_ExtECCEncrypt_FuncPtr ExtECCEncrypt;
SKF_ExtECCDecrypt_FuncPtr ExtECCDecrypt;
SKF_ExtECCSign_FuncPtr ExtECCSign;
SKF_ExtECCVerify_FuncPtr ExtECCVerify;
SKF_GenerateAgreementDataWithECC_FuncPtr GenerateAgreementDataWithECC;
SKF_GenerateAgreementDataAndKeyWithECC_FuncPtr GenerateAgreementDataAndKeyWithECC;
SKF_GenerateKeyWithECC_FuncPtr GenerateKeyWithECC;
SKF_ImportSessionKey_FuncPtr ImportSessionKey;
SKF_SetSymmKey_FuncPtr SetSymmKey;
SKF_EncryptInit_FuncPtr EncryptInit;
SKF_Encrypt_FuncPtr Encrypt;
SKF_EncryptUpdate_FuncPtr EncryptUpdate;
SKF_EncryptFinal_FuncPtr EncryptFinal;
SKF_DecryptInit_FuncPtr DecryptInit;
SKF_Decrypt_FuncPtr Decrypt;
SKF_DecryptUpdate_FuncPtr DecryptUpdate;
SKF_DecryptFinal_FuncPtr DecryptFinal;
SKF_DigestInit_FuncPtr DigestInit;
SKF_Digest_FuncPtr Digest;
SKF_DigestUpdate_FuncPtr DigestUpdate;
SKF_DigestFinal_FuncPtr DigestFinal;
SKF_MacInit_FuncPtr MacInit;
SKF_Mac_FuncPtr Mac;
SKF_MacUpdate_FuncPtr MacUpdate;
SKF_MacFinal_FuncPtr MacFinal;
SKF_CloseHandle_FuncPtr CloseHandle;
} SKF_METHOD;
SKF_METHOD *SKF_METHOD_load_library(const char *so_path);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -80,6 +80,7 @@ int ERR_load_SAF_strings(void);
# define SAF_F_SAF_BASE64_ENCODE 104
# define SAF_F_SAF_BASE64_ENCODEFINAL 105
# define SAF_F_SAF_BASE64_ENCODEUPDATE 106
# define SAF_F_SAF_CHANGEPIN 123
# define SAF_F_SAF_CREATESYMMKEYOBJ 107
# define SAF_F_SAF_ECCPUBLICKEYENC 108
# define SAF_F_SAF_ECCPUBLICKEYENCBYCERT 109
@@ -89,7 +90,14 @@ int ERR_load_SAF_strings(void);
# define SAF_F_SAF_GENECCKEYPAIR 113
# define SAF_F_SAF_GENERATEAGREEMENTDATAWITHECC 114
# define SAF_F_SAF_GENERATEKEYWITHECC 115
# define SAF_F_SAF_GENERATEKEYWITHEPK 124
# define SAF_F_SAF_GENRANDOM 125
# define SAF_F_SAF_GETECCPUBLICKEY 116
# define SAF_F_SAF_GETVERSION 126
# define SAF_F_SAF_IMPORTENCEDKEY 127
# define SAF_F_SAF_INITIALIZE 128
# define SAF_F_SAF_LOGIN 129
# define SAF_F_SAF_LOGOUT 130
# define SAF_F_SAF_MACFINAL 117
# define SAF_F_SAF_MACUPDATE 118
# define SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA 119
@@ -100,7 +108,10 @@ int ERR_load_SAF_strings(void);
/* Reason codes. */
# define SAF_R_BUFFER_TOO_SMALL 100
# define SAF_R_CBCMAC_FAILURE 101
# define SAF_R_CMAC_FAILURE 115
# define SAF_R_ENCRYPT_KEY_FAILURE 116
# define SAF_R_GEN_RANDOM 102
# define SAF_R_GEN_RANDOM_FAILURE 117
# define SAF_R_INT_OVERFLOW 103
# define SAF_R_INVALID_ALGOR 104
# define SAF_R_INVALID_CONTEXT 105
@@ -111,6 +122,7 @@ int ERR_load_SAF_strings(void);
# define SAF_R_INVALID_KEY_USAGE 110
# define SAF_R_INVALID_LENGTH 111
# define SAF_R_MAC_FAILURE 112
# define SAF_R_NOT_SUPPORTED 118
# define SAF_R_OPERATION_NOT_INITIALIZED 113
# define SAF_R_SAF_ERROR 114

View File

@@ -95,81 +95,63 @@ int ERR_load_SDF_strings(void);
/* Function codes. */
# define SDF_F_SDF_CALCULATEMAC 100
# define SDF_F_SDF_CLOSEDEVICE 145
# define SDF_F_SDF_CLOSESESSION 101
# define SDF_F_SDF_DECODE_EC_SIGNATURE 102
# define SDF_F_SDF_DECRYPT 103
# define SDF_F_SDF_ENCODE_EC_SIGNATURE 104
# define SDF_F_SDF_ENCRYPT 105
# define SDF_F_SDF_EXPORTENCPUBLICKEY_ECC 106
# define SDF_F_SDF_EXPORTENCPUBLICKEY_RSA 107
# define SDF_F_SDF_EXPORTSIGNPUBLICKEY_ECC 108
# define SDF_F_SDF_EXPORTSIGNPUBLICKEY_RSA 109
# define SDF_F_SDF_EXTERNALDECRYPT_ECC 110
# define SDF_F_SDF_EXTERNALENCRYPT_ECC 111
# define SDF_F_SDF_EXTERNALPRIVATEKEYOPERATION_RSA 112
# define SDF_F_SDF_EXTERNALPUBLICKEYOPERATION_RSA 113
# define SDF_F_SDF_EXTERNALSIGN_ECC 114
# define SDF_F_SDF_EXTERNALVERIFY_ECC 115
# define SDF_F_SDF_GENERATEKEYPAIR_ECC 116
# define SDF_F_SDF_GENERATEKEYPAIR_RSA 117
# define SDF_F_SDF_GENERATEKEYWITHEPK_ECC 118
# define SDF_F_SDF_GENERATEKEYWITHEPK_RSA 119
# define SDF_F_SDF_GENERATEKEYWITHIPK_ECC 120
# define SDF_F_SDF_GENERATEKEYWITHIPK_RSA 121
# define SDF_F_SDF_GENERATERANDOM 122
# define SDF_F_SDF_GETDEVICEINFO 123
# define SDF_F_SDF_GETPRIVATEKEYACCESSRIGHT 124
# define SDF_F_SDF_GET_CIPHER 125
# define SDF_F_SDF_GET_DIGEST 126
# define SDF_F_SDF_HASHFINAL 127
# define SDF_F_SDF_HASHINIT 128
# define SDF_F_SDF_HASHUPDATE 129
# define SDF_F_SDF_IMPORTKEY 130
# define SDF_F_SDF_IMPORTKEYWITHISK_ECC 131
# define SDF_F_SDF_IMPORTKEYWITHISK_RSA 132
# define SDF_F_SDF_INTERNALDECRYPT_ECC 133
# define SDF_F_SDF_INTERNALENCRYPT_ECC 134
# define SDF_F_SDF_INTERNALPRIVATEKEYOPERATION_RSA 135
# define SDF_F_SDF_INTERNALPUBLICKEYOPERATION_RSA 136
# define SDF_F_SDF_INTERNALSIGN_ECC 137
# define SDF_F_SDF_INTERNALVERIFY_ECC 138
# define SDF_F_SDF_LOAD_EC_PRIVATE_KEY 139
# define SDF_F_SDF_LOAD_EC_PUBLIC_KEY 140
# define SDF_F_SDF_LOAD_RSA_PRIVATE_KEY 141
# define SDF_F_SDF_LOAD_RSA_PUBLIC_KEY 142
# define SDF_F_SDF_OPENDEVICE 143
# define SDF_F_SDF_OPENSESSION 144
# define SDF_F_SDF_RELEASEPRIVATEKEYACCESSRIGHT 146
# define SDF_F_SDF_CLOSEDEVICE 101
# define SDF_F_SDF_CLOSESESSION 102
# define SDF_F_SDF_CREATEFILE 103
# define SDF_F_SDF_DECRYPT 104
# define SDF_F_SDF_DELETEFILE 105
# define SDF_F_SDF_DESTROYKEY 106
# define SDF_F_SDF_ENCRYPT 107
# define SDF_F_SDF_EXCHANGEDIGITENVELOPEBASEONECC 108
# define SDF_F_SDF_EXCHANGEDIGITENVELOPEBASEONRSA 109
# define SDF_F_SDF_EXPORTENCPUBLICKEY_ECC 110
# define SDF_F_SDF_EXPORTENCPUBLICKEY_RSA 111
# define SDF_F_SDF_EXPORTSIGNPUBLICKEY_ECC 112
# define SDF_F_SDF_EXPORTSIGNPUBLICKEY_RSA 113
# define SDF_F_SDF_EXTERNALENCRYPT_ECC 114
# define SDF_F_SDF_EXTERNALPRIVATEKEYOPERATION_RSA 115
# define SDF_F_SDF_EXTERNALPUBLICKEYOPERATION_RSA 116
# define SDF_F_SDF_EXTERNALVERIFY_ECC 117
# define SDF_F_SDF_GENERATEAGREEMENTDATAANDKEYWITHECC 118
# define SDF_F_SDF_GENERATEAGREEMENTDATAWITHECC 119
# define SDF_F_SDF_GENERATEKEYPAIR_ECC 120
# define SDF_F_SDF_GENERATEKEYPAIR_RSA 121
# define SDF_F_SDF_GENERATEKEYWITHECC 122
# define SDF_F_SDF_GENERATEKEYWITHEPK_ECC 123
# define SDF_F_SDF_GENERATEKEYWITHEPK_RSA 124
# define SDF_F_SDF_GENERATEKEYWITHIPK_ECC 125
# define SDF_F_SDF_GENERATEKEYWITHIPK_RSA 126
# define SDF_F_SDF_GENERATEKEYWITHKEK 127
# define SDF_F_SDF_GENERATERANDOM 128
# define SDF_F_SDF_GETDEVICEINFO 129
# define SDF_F_SDF_GETPRIVATEKEYACCESSRIGHT 130
# define SDF_F_SDF_HASHFINAL 131
# define SDF_F_SDF_HASHINIT 132
# define SDF_F_SDF_HASHUPDATE 133
# define SDF_F_SDF_IMPORTKEY 134
# define SDF_F_SDF_IMPORTKEYWITHISK_ECC 135
# define SDF_F_SDF_IMPORTKEYWITHISK_RSA 136
# define SDF_F_SDF_IMPORTKEYWITHKEK 137
# define SDF_F_SDF_INTERNALPRIVATEKEYOPERATION_RSA 138
# define SDF_F_SDF_INTERNALPUBLICKEYOPERATION_RSA 147
# define SDF_F_SDF_INTERNALSIGN_ECC 139
# define SDF_F_SDF_INTERNALVERIFY_ECC 140
# define SDF_F_SDF_METHOD_LOAD_LIBRARY 141
# define SDF_F_SDF_OPENDEVICE 142
# define SDF_F_SDF_OPENSESSION 143
# define SDF_F_SDF_READFILE 144
# define SDF_F_SDF_RELEASEPRIVATEKEYACCESSRIGHT 145
# define SDF_F_SDF_WRITEFILE 146
/* Reason codes. */
# define SDF_R_BUFFER_TOO_SMALL 100
# define SDF_R_BUUTER_TOO_SMALL 101
# define SDF_R_CBCMAC_FAILURE 102
# define SDF_R_CMAC_FAILURE 126
# define SDF_R_COMPUTE_SM2_ID_FAILURE 103
# define SDF_R_ENGINE_LOAD_KEY_FAILURE 104
# define SDF_R_GET_PRIVATE_KEY_FAILED 105
# define SDF_R_GET_PUBLIC_KEY_FAILED 106
# define SDF_R_INVALID_ALGOR 107
# define SDF_R_INVALID_DEVICE_HANDLE 122
# define SDF_R_INVALID_EC_CIPHERTEXT 108
# define SDF_R_INVALID_EC_PRIVATE_KEY 109
# define SDF_R_INVALID_EC_PUBLIC_KEY 110
# define SDF_R_INVALID_INPUT_LENGTH 111
# define SDF_R_INVALID_KEY_HANDLE 112
# define SDF_R_INVALID_KEY_INDEX 123
# define SDF_R_INVALID_KEY_LENGTH 113
# define SDF_R_INVALID_KEY_USAGE 114
# define SDF_R_INVALID_LENGTH 115
# define SDF_R_INVALID_OPERATION_STATE 116
# define SDF_R_INVALID_PASSWORD_LENGTH 124
# define SDF_R_INVALID_SESSION 117
# define SDF_R_INVALID_SESSION_HANDLE 125
# define SDF_R_KEY_TYPE_NOT_MATCH 118
# define SDF_R_LOAD_ENGINE_FAILURE 119
# define SDF_R_RANDOM_FAILURE 120
# define SDF_R_SDF_SESSION_NO_ENGINE 121
# define SDF_R_INVALID_KEY_LENGTH 100
# define SDF_R_INVALID_SDF_LIBRARY 101
# define SDF_R_INVALID_SESSION_HANDLE 102
# define SDF_R_LOAD_LIBRARY_FAILURE 107
# define SDF_R_NOT_SUPPORTED 103
# define SDF_R_OPERATION_FAILED 104
# define SDF_R_SDF_METHOD_RETURN_FAILURE 105
# define SDF_R_SDF_OPERATION_FAILED 106
# ifdef __cplusplus
}

View File

@@ -464,7 +464,7 @@ int SAF_GenerateKeyWithEPK(
unsigned char *pucPublicKey,
unsigned int uiPublicKeyLen,
unsigned char *pucSymmKey,
unsigned int uiSymmKeyLen,
unsigned int *puiSymmKeyLen,
void **phKeyHandle);
int SAF_ImportEncedKey(