Esempio n. 1
0
ULONG DEVAPI SKF_ChangeDevAuthKey(DEVHANDLE hDev,
	BYTE *pbKeyValue,
	ULONG ulKeyLen)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 2
0
ULONG DEVAPI SKF_DevAuth(DEVHANDLE hDev,
	BYTE *pbAuthData,
	ULONG ulLen)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 3
0
ULONG DEVAPI SKF_GetDevInfo(DEVHANDLE hDev,
	DEVINFO *pDevInfo)
{
	DEVINFO devInfo;
	PRINT_LOG();

	bzero(&devInfo, sizeof(DEVINFO));
	devInfo.Version.major = 1;
	devInfo.Version.minor = 0;
	strcpy((char *)&devInfo.Manufacturer, "GmSSL Project (http://gmssl.org)");
	strcpy((char *)&devInfo.Issuer, "GmSSL Project (http://gmssl.org)");
	strcpy((char *)&devInfo.Label, "SKF Softotken");
	strcpy((char *)&devInfo.SerialNumber, "000001");
	devInfo.HWVersion.major = 1;
	devInfo.HWVersion.minor = 0;
	devInfo.FirmwareVersion.major = 1;
	devInfo.FirmwareVersion.minor = 0;
	devInfo.AlgSymCap = 0x0000041F;
	devInfo.AlgAsymCap = 0x00030700;
	devInfo.AlgHashCap = 0x00000007;
	devInfo.DevAuthAlgId = SGD_SM4_CBC;
	devInfo.TotalSpace = 0;
	devInfo.FreeSpace = 0;
	devInfo.MaxECCBufferSize = 0; /* FIXME: max inlen of ECC encrypt */
	devInfo.MaxBufferSize = 0; /* FIXME: max inlen of SM4 encrypt */

	memcpy(pDevInfo, &devInfo, sizeof(DEVINFO));
	return SAR_OK;
}
Esempio n. 4
0
ULONG DEVAPI SKF_GenRandom(DEVHANDLE hDev,
	BYTE *pbRandom,
	ULONG ulRandomLen)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 5
0
File: tgc.c Progetto: BwRy/tgcd
/*-----------------------------------------------------------------------------
 Add an element to the list
-----------------------------------------------------------------------------*/
int tgc_add_list(socket_pair_list **list, int sdi, int sdx)
{
	socket_pair_list	*pair;

	if (sdi<0 || sdx<0)
		return E_TGC_NOCANDO;
	
	if ( !(pair=(socket_pair_list *) malloc(sizeof(socket_pair_list))) ) {
		PRINT_LOG(1, "Out of memory!");
		return E_TGC_IE;
	}
	pair->sdi = sdi;
	pair->sdx = sdx;
	pair->prev = NULL;

	if (*list) {
		pair->next = *list;
		(*list)->prev = pair;
		*list = pair;
	} else {
		pair->next = NULL;
		*list = pair;
	}

	return 0;
}
Esempio n. 6
0
ULONG DEVAPI SKF_GetContainerType(HCONTAINER hContainer,
	ULONG *pulContainerType)
{
	PRINT_LOG();
	*pulContainerType = CONTAINER_TYPE_ECC;
	return SAR_OK;
}
Esempio n. 7
0
ULONG DEVAPI SKF_DisConnectDev(DEVHANDLE hDev)
{
	PRINT_LOG();
	if (hDev) {
		free(hDev);
	}
	return SAR_OK;
}
Esempio n. 8
0
ULONG DEVAPI SKF_MacFinal(HANDLE hMac,
	BYTE *pbMac,
	ULONG *pulMacLen)
{
	PRINT_LOG();
	*pulMacLen = 16;
	return SAR_OK;
}
Esempio n. 9
0
ULONG DEVAPI SKF_CloseApplication(HAPPLICATION hApplication)
{
	PRINT_LOG();
	if (hApplication) {
		free(hApplication);
	}
	return SAR_OK;
}
Esempio n. 10
0
ULONG DEVAPI SKF_ECCSignData(HCONTAINER hContainer,
	BYTE *pbData,
	ULONG ulDataLen,
	ECCSIGNATUREBLOB *pSignature)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 11
0
ULONG DEVAPI SKF_OpenContainer(HAPPLICATION hApplication,
	LPSTR szContainerName,
	HCONTAINER *phContainer)
{
	PRINT_LOG();
	*phContainer = malloc(256);
	return SAR_OK;
}
Esempio n. 12
0
ULONG DEVAPI SKF_DecryptFinal(HANDLE hKey,
	BYTE *pbDecryptedData,
	ULONG *pulDecryptedDataLen)
{
	PRINT_LOG();
	*pulDecryptedDataLen = 0;
	return SAR_OK;
}
Esempio n. 13
0
ULONG DEVAPI SKF_DigestFinal(HANDLE hHash,
	BYTE *pHashData,
	ULONG *pulHashLen)
{
	PRINT_LOG();
	*pulHashLen = 32;
	return SAR_OK;
}
Esempio n. 14
0
ULONG DEVAPI SKF_OpenApplication(DEVHANDLE hDev,
	LPSTR szAppName,
	HAPPLICATION *phApplication)
{
	PRINT_LOG();
	*phApplication = malloc(256);
	return SAR_OK;
}
Esempio n. 15
0
ULONG DEVAPI SKF_GetFileInfo(HAPPLICATION hApplication,
	LPSTR szFileName,
	FILEATTRIBUTE *pFileInfo)
{
	PRINT_LOG();
	bzero(pFileInfo, sizeof(*pFileInfo));
	return SAR_OK;
}
Esempio n. 16
0
ULONG DEVAPI SKF_ImportCertificate(HCONTAINER hContainer,
	BOOL bSignFlag,
	BYTE *pbCert,
	ULONG ulCertLen)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 17
0
ULONG DEVAPI SKF_CloseHandle(HANDLE handle)
{
	PRINT_LOG();
	if (handle) {
		free(handle);
	}
	return SAR_OK;
}
Esempio n. 18
0
ULONG DEVAPI SKF_MacInit(HANDLE hKey,
	BLOCKCIPHERPARAM *pMacParam,
	HANDLE *phMac)
{
	PRINT_LOG();
	*phMac = malloc(256);
	return SAR_OK;
}
Esempio n. 19
0
ULONG DEVAPI SKF_SetSymmKey(DEVHANDLE hDev,
	BYTE *pbKey,
	ULONG ulAlgID,
	HANDLE *phKey)
{
	PRINT_LOG();
	*phKey = malloc(256);
	return SAR_OK;
}
Esempio n. 20
0
ULONG DEVAPI SKF_ExportPublicKey(HCONTAINER hContainer,
	BOOL bSignFlag,
	BYTE *pbBlob,
	ULONG *pulBlobLen)
{
	PRINT_LOG();
	*pulBlobLen = 1024;
	return SAR_OK;
}
Esempio n. 21
0
ULONG DEVAPI SKF_ExtECCVerify(DEVHANDLE hDev,
	ECCPUBLICKEYBLOB *pECCPubKeyBlob,
	BYTE *pbData,
	ULONG ulDataLen,
	PECCSIGNATUREBLOB pSignature)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 22
0
ULONG DEVAPI SKF_ExtECCSign(DEVHANDLE hDev,
	ECCPRIVATEKEYBLOB *pECCPriKeyBlob,
	BYTE *pbData,
	ULONG ulDataLen,
	ECCSIGNATUREBLOB *pSignature)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 23
0
/* ----------------------------------------------------------------
 * 功    能: 取出消息队列的msqid_ds数据并返回
 *            的机构中
 * 输入参数: iMsgid     消息队列的标识符
 * 输出参数: ptDs       消息队列的msqid_ds结构
 * 返 回 值: 0  成功/-1 失败
 * 作    者:
 * 日    期:2012/12/27
 * 调用说明:
 * 修改日志:修改日期    修改者      修改内容简述
 * ----------------------------------------------------------------
 */
int GetMsgQueStat(int iMsgid, struct msqid_ds *ptDs)
{
    if (iMsgid <= 0)
    {
        PRINT_LOG(ERROR_LVL, "GetMsgQueStat input-para[iMsgid=%d] error", 
                  iMsgid);
        return FAIL;
    }

    if (msgctl(iMsgid, IPC_STAT, ptDs) < 0)
    {
        PRINT_LOG(ERROR_LVL, "call msgctl IPC_STAT(msgid=%d) fail[%d-%s]",
                  iMsgid, errno, strerror(errno));
        return FAIL;
    }

    return SUCC;
}
Esempio n. 24
0
ULONG DEVAPI SKF_VerifyPIN(HAPPLICATION hApplication,
	ULONG ulPINType,
	LPSTR szPIN,
	ULONG *pulRetryCount)
{
	PRINT_LOG();
	*pulRetryCount = 10;
	return SAR_OK;
}
Esempio n. 25
0
ULONG DEVAPI SKF_WriteFile(HAPPLICATION hApplication,
	LPSTR szFileName,
	ULONG  ulOffset,
	BYTE *pbData,
	ULONG ulSize)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 26
0
ULONG DEVAPI SKF_ExtECCEncrypt(DEVHANDLE hDev,
	ECCPUBLICKEYBLOB *pECCPubKeyBlob,
	BYTE *pbPlainText,
	ULONG ulPlainTextLen,
	ECCCIPHERBLOB *pCipherText)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 27
0
ULONG DEVAPI SKF_UnblockPIN(HAPPLICATION hApplication,
	LPSTR szAdminPIN,
	LPSTR szNewUserPIN,
	ULONG *pulRetryCount)
{
	PRINT_LOG();
	*pulRetryCount = 10;
	return SAR_OK;
}
Esempio n. 28
0
ULONG DEVAPI SKF_CreateFile(HAPPLICATION hApplication,
	LPSTR szFileName,
	ULONG ulFileSize,
	ULONG ulReadRights,
	ULONG ulWriteRights)
{
	PRINT_LOG();
	return SAR_OK;
}
Esempio n. 29
0
int CloseSocket(int iSockFd)
{
    if (close(iSockFd) != 0)
    {
        PRINT_LOG(ERROR_LVL, "close client connection error!\n");
    }

    return( SUCC );
}
Esempio n. 30
0
File: tgc.c Progetto: BwRy/tgcd
/*-----------------------------------------------------------------------------
 Ask CC for a new connection
-----------------------------------------------------------------------------*/
int tgc_send(int sd, char cmd)
{
	if (write(sd, &cmd, 1)<1) {
		PRINT_LOG(3, "Failed sending connection request");
		return E_TGC_NOCANDO;
	}

	return E_TGC_OK;
}