Security Audit. Checkpoint changes thus far to c code.

This commit is contained in:
Jim Norman
2006-04-17 21:53:18 +00:00
parent 0d5ef76eb5
commit d47212b28d
14 changed files with 785 additions and 2018 deletions

View File

@@ -1,36 +0,0 @@
#######################################################################
#
# Copyright (C) 2006 Novell, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
#######################################################################
SUBDIRS = $(TARGET_OS)
DIST_SUBDIRS = linux
CFILES =
EXTRA_DIST = *.c
.PHONY: package package-clean package-install package-uninstall
package package-clean package-install package-uninstall:
$(MAKE) -C $(TARGET_OS) $@
maintainer-clean-local:
rm -f Makefile.in

View File

@@ -45,7 +45,7 @@ extern "C"
void* sscs_CacheOpenSecretStore
(
void *secretStoreID,
uint32_t ssFlags,
uint32_t ssFlags,
void *reserved
)
@@ -54,27 +54,19 @@ void* sscs_CacheOpenSecretStore
SSCS_LINUX_SS_HANDLE_T *platHandle = NULL;
int32_t retVal = 0;
ssHandle = (SSCS_SECRETSTORE_HANDLE_T *)malloc(sizeof(SSCS_SECRETSTORE_HANDLE_T));
ssHandle = (SSCS_SECRETSTORE_HANDLE_T *)malloc((sizeof(SSCS_SECRETSTORE_HANDLE_T) + (sizeof(SSCS_LINUX_SS_HANDLE_T))));
if(NULL == ssHandle)
{
return NULL;
}
platHandle = (SSCS_LINUX_SS_HANDLE_T *)malloc(sizeof(SSCS_LINUX_SS_HANDLE_T));
if(NULL == platHandle)
{
free(ssHandle);
return NULL;
}
memset(ssHandle,0,sizeof(SSCS_SECRETSTORE_HANDLE_T));
memset(platHandle,0,sizeof(SSCS_LINUX_SS_HANDLE_T));
ssHandle->platHandle = platHandle;
memset(ssHandle,0,sizeof(SSCS_SECRETSTORE_HANDLE_T));
ssHandle->platHandle = ssHandle + sizeof(SSCS_SECRETSTORE_HANDLE_T);
retVal = ipc_OpenSecretStore(secretStoreID,ssHandle);
if(retVal)
{
free(platHandle);
memset(ssHandle, 0, sizeof(SSCS_SECRETSTORE_HANDLE_T) + (sizeof(SSCS_LINUX_SS_HANDLE_T)));
free(ssHandle);
return NULL;
}
@@ -106,8 +98,7 @@ int32_t sscs_CacheCloseSecretStore
if(ssHandleCopy->platHandle)
{
retVal = ipc_CloseSecretStore(ssHandleCopy, ssFlags);
free(ssHandleCopy->platHandle);
retVal = ipc_CloseSecretStore(ssHandleCopy, ssFlags);
}
if(ssHandleCopy)

View File

@@ -227,8 +227,8 @@ int32_t ipc_OpenSecretStore
break;
}
*(int *)ssHandle->platHandle = IPC_CREATE();
if(*(int *)ssHandle->platHandle < 0)
ssHandle->platHandle = IPC_CREATE();
if(ssHandle->platHandle < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
break;
@@ -259,13 +259,13 @@ int32_t ipc_OpenSecretStore
memcpy(pReq,ssID->ssName,ssNameLen);
pReq += ssNameLen;
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,(char *)gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,(char *)gpReqBuf, msgLen);
if(retVal < 0)
{
DMSG(("Write failed : %s\n",strerror(errno)));
DMSG(("Closing socket : %d\n",*(int*)ssHandle->platHandle));
DMSG(("ipc_OpenSecretStore:IPC_WRITE returned :%d\n",retVal));
IPC_CLOSE(*(int *)ssHandle->platHandle);
IPC_CLOSE(ssHandle->platHandle);
retCode = NSSCS_E_SYSTEM_FAILURE;
break;
}
@@ -276,7 +276,7 @@ int32_t ipc_OpenSecretStore
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_OPENSS);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_OPENSS);
if(retVal < 0)
{
//log debug info here
@@ -284,7 +284,7 @@ int32_t ipc_OpenSecretStore
DMSG(("Read failed : %s\n",strerror(errno)));
DMSG(("Closing socket : %d\n",*(int*)ssHandle->platHandle));
IPC_CLOSE(*(int *)ssHandle->platHandle);
IPC_CLOSE(ssHandle->platHandle);
retCode = NSSCS_E_SYSTEM_FAILURE;
break;
}
@@ -302,7 +302,7 @@ int32_t ipc_OpenSecretStore
{
DMSG(("ipc_OpenSecretStore:sscs returned :%d\n",sockReturn));
DMSG(("Closing socket : %d\n",*(int*)ssHandle->platHandle));
IPC_CLOSE(*(int *)ssHandle->platHandle);
IPC_CLOSE(ssHandle->platHandle);
retCode = mapReturnCode(sockReturn);
break;
}
@@ -351,7 +351,7 @@ int32_t ipc_CloseSecretStore
//marshall ssflags
memcpy(pReq, &ssFlags, MSG_DWORD_LEN);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
retVal = NSSCS_E_SYSTEM_FAILURE;
@@ -361,7 +361,7 @@ int32_t ipc_CloseSecretStore
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -379,7 +379,7 @@ int32_t ipc_CloseSecretStore
}while(0);
DMSG(("Closing socket : %d\n",*(int*)ssHandle->platHandle));
IPC_CLOSE(*(int *)ssHandle->platHandle);
IPC_CLOSE(ssHandle->platHandle);
return retCode; // map return code
}
@@ -419,7 +419,7 @@ int32_t ipc_RemoveSecretStore
pReq += MSGID_LEN;
memcpy(pReq, &msgLen, MSG_LEN);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -428,7 +428,7 @@ int32_t ipc_RemoveSecretStore
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -497,7 +497,7 @@ int32_t ipc_EnumerateKeychainIDs
pReq += MSGID_LEN;
memcpy(pReq, &msgLen, MSG_LEN);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -507,7 +507,7 @@ int32_t ipc_EnumerateKeychainIDs
// Read reply
pReply = gpReplyBuf;
memset(pReply,0,MIN_REPLY_BUF_LEN);
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -523,7 +523,7 @@ int32_t ipc_EnumerateKeychainIDs
memcpy(&bufLen,pReply, MSG_DWORD_LEN);
if( 0 == bufLen )
{
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
if(retVal < 0)
{
//log debug info here
@@ -546,13 +546,13 @@ int32_t ipc_EnumerateKeychainIDs
n = msgLen - MSG_REPLY_GENERAL;
while(n)
{
int bytes = IPC_READ(*(int *)ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
int bytes = IPC_READ(ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
if( bytes > 0 )
n -= MIN_REPLY_BUF_LEN;
else
break;
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,
retVal = IPC_READ(ssHandle->platHandle,
&sockReturn, MSG_DWORD_LEN);
if(retVal < 0)
{
@@ -565,7 +565,7 @@ int32_t ipc_EnumerateKeychainIDs
else
tmpBuf = (SS_UTF8_T *)pReply; // Save this ptr to free later.
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,pReply, bufLen*sizeof(char));
retVal = IPC_READ(ssHandle->platHandle,pReply, bufLen*sizeof(char));
tmpPtr = (SS_UTF8_T *)pReply;
tmpPtr[bufLen] = nulc;
@@ -587,7 +587,7 @@ int32_t ipc_EnumerateKeychainIDs
free(tmpBuf);
tmpBuf = NULL;
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
kcIDList->enumHandle = 0;
retCode = NSSS_E_ENUM_BUFF_TOO_SHORT;
@@ -605,7 +605,7 @@ int32_t ipc_EnumerateKeychainIDs
}
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
if(retVal < 0)
{
//log debug info here
@@ -677,7 +677,7 @@ int32_t ipc_AddKeychain
memcpy((SS_UTF8_T*)pReq,keychainID->keychainID,keychainIDLen);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -687,7 +687,7 @@ int32_t ipc_AddKeychain
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -759,7 +759,7 @@ int32_t ipc_RemoveKeychain
pReq += MSG_STRING_LEN;
memcpy(pReq,keychainID->keychainID, keychainIDLen);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -768,7 +768,7 @@ int32_t ipc_RemoveKeychain
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -853,7 +853,7 @@ int32_t ipc_EnumerateSecretIDs
pReq += MSG_STRING_LEN;
memcpy((SS_UTF8_T *)pReq,(SS_UTF8_T *)keychainID->keychainID,keychainIDLen);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -863,7 +863,7 @@ int32_t ipc_EnumerateSecretIDs
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if( retVal < 0 )
{
//log debug info here
@@ -881,7 +881,7 @@ int32_t ipc_EnumerateSecretIDs
if( 0 == bufLen )
{
// Cleanup the channel by reading the return code.
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
secretIDList->returnedIDs = 0;
retCode = mapReturnCode(sockReturn);
break;
@@ -899,13 +899,13 @@ int32_t ipc_EnumerateSecretIDs
n = msgLen - MSG_REPLY_GENERAL;
while(n)
{
int bytes = IPC_READ((*(int *)ssHandle->platHandle), gpReplyBuf, MIN_REPLY_BUF_LEN);
int bytes = IPC_READ((ssHandle->platHandle), gpReplyBuf, MIN_REPLY_BUF_LEN);
if(bytes > 0 )
n -= MIN_REPLY_BUF_LEN;
else
break;
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,
retVal = IPC_READ(ssHandle->platHandle,
&sockReturn, MSG_DWORD_LEN);
if(retVal < 0)
{
@@ -920,7 +920,7 @@ int32_t ipc_EnumerateSecretIDs
else
tmpBuf = (SS_UTF8_T *)pReply; // Save this ptr to free later.
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,pReply, bufLen*sizeof(SS_UTF8_T));
retVal = IPC_READ(ssHandle->platHandle,pReply, bufLen*sizeof(SS_UTF8_T));
DMSG(("Read returns..%d\n",retVal));
tmpPtr = (SS_UTF8_T *)pReply;
tmpPtr[bufLen] = nulc;
@@ -941,7 +941,7 @@ int32_t ipc_EnumerateSecretIDs
free(tmpBuf);
tmpBuf = NULL;
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
secretIDList->enumHandle = 0;
retCode = NSSS_E_ENUM_BUFF_TOO_SHORT;
break;
@@ -958,7 +958,7 @@ int32_t ipc_EnumerateSecretIDs
}
}
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
if(retVal < 0)
{
//log debug info here
@@ -1049,7 +1049,7 @@ int32_t ipc_ReadSecret
memcpy(pReq, epPassword->pword, epPassword->pwordLen);
pReq += epPassword->pwordLen;
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1059,7 +1059,7 @@ int32_t ipc_ReadSecret
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if( 0 == retVal )
{
//log debug info here
@@ -1075,7 +1075,7 @@ int32_t ipc_ReadSecret
if( 0 == dataLen )
{
// Cleanup the channel by reading the return code.
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
if( retVal < 0 )
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -1089,7 +1089,7 @@ int32_t ipc_ReadSecret
if(dataLen <= (uint32_t)secretData->len)
{
// Read the secret into application buffer.
retVal = IPC_READ(*(int *)ssHandle->platHandle, secretData->data, dataLen);
retVal = IPC_READ(ssHandle->platHandle, secretData->data, dataLen);
if( retVal < 0 )
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -1108,20 +1108,20 @@ int32_t ipc_ReadSecret
n = dataLen;
while(n)
{
int bytes = IPC_READ(*(int *)ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
int bytes = IPC_READ(ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
if( bytes > 0)
n -= MIN_REPLY_BUF_LEN;
else
break;
}
// Read the sscs return code also.
IPC_READ(*(int *)ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = NSSCS_E_ENUM_BUFF_TOO_SHORT;
break;
}
}
// Read the sscs return code also.
IPC_READ(*(int *)ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = mapReturnCode(sockReturn);
} while(0);
@@ -1288,11 +1288,11 @@ int ipc_WriteSecret
if(tmpBuf != NULL)
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,tmpBuf,msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,tmpBuf,msgLen);
}
else
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,gpReqBuf, msgLen);
}
if(retVal < 0)
{
@@ -1303,7 +1303,7 @@ int ipc_WriteSecret
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -1411,7 +1411,7 @@ int32_t ipc_RemoveSecret
memcpy(pReq, &pwordlen, MSG_STRING_LEN);
}
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1421,7 +1421,7 @@ int32_t ipc_RemoveSecret
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -1486,7 +1486,7 @@ int32_t ipc_GetSecretStoreInfo
memcpy(pReq, &msgLen, MSG_LEN);
pReq += MSG_LEN;
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1496,7 +1496,7 @@ int32_t ipc_GetSecretStoreInfo
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply,
retVal = IPC_READ(ssHandle->platHandle, pReply,
MSG_REPLY_GETSSINFO);
if(retVal < 0)
{
@@ -1575,7 +1575,7 @@ int32_t ipc_GetKeychainInfo
pReq += MSG_LEN;
memcpy(pReq,keychainID->keychainID,keychainID->len);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1585,7 +1585,7 @@ int32_t ipc_GetKeychainInfo
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply,MSG_REPLY_GETKEYCHAIN_INFO);
retVal = IPC_READ(ssHandle->platHandle, pReply,MSG_REPLY_GETKEYCHAIN_INFO);
if(retVal < 0)
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -1653,7 +1653,7 @@ int32_t ipc_LockCache
pReq += MSGID_LEN;
memcpy(pReq, &msgLen, MSG_LEN);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1662,7 +1662,7 @@ int32_t ipc_LockCache
}
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL)
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL)
;
if(retVal < 0)
{
@@ -1725,7 +1725,7 @@ int32_t ipc_UnlockCache
pReq += MSGID_LEN;
memcpy(pReq, &msgLen, MSG_LEN);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
// log debug info here
@@ -1734,7 +1734,7 @@ int32_t ipc_UnlockCache
}
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -1814,7 +1814,7 @@ int32_t ipc_SetMasterPasscode
memcpy((SS_UTF8_T*)pReq,((SSCS_PASSWORD_T*)(passcode->passcodeHandle))->pword,passcodeLen);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1824,7 +1824,7 @@ int32_t ipc_SetMasterPasscode
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -1932,7 +1932,7 @@ int32_t ipc_ReadKey
memcpy(pReq, epPassword->pword, epPassword->pwordLen);
pReq += epPassword->pwordLen;
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -1942,7 +1942,7 @@ int32_t ipc_ReadKey
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if( 0 == retVal )
{
//log debug info here
@@ -1958,7 +1958,7 @@ int32_t ipc_ReadKey
if( 0 == dataLen )
{
// Cleanup the channel by reading the return code.
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
if( retVal < 0 )
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -1971,7 +1971,7 @@ int32_t ipc_ReadKey
if(dataLen <= *valLen)
{
// Read the secret into application buffer.
retVal = IPC_READ(*(int *)ssHandle->platHandle, val, dataLen);
retVal = IPC_READ(ssHandle->platHandle, val, dataLen);
if( retVal < 0 )
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -1991,20 +1991,20 @@ int32_t ipc_ReadKey
n = dataLen;
while(n)
{
int bytes = IPC_READ(*(int *)ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
int bytes = IPC_READ(ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
if( bytes > 0)
n -= MIN_REPLY_BUF_LEN;
else
break;
}
// Read the sscs return code also.
IPC_READ(*(int *)ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = NSSCS_E_ENUM_BUFF_TOO_SHORT;
break;
}
}
// Read the sscs return code also.
IPC_READ(*(int *)ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = mapReturnCode(sockReturn);
} while(0);
@@ -2098,7 +2098,7 @@ int32_t ipc_ReadBinaryKey
memcpy(pReq, epPassword->pword, epPassword->pwordLen);
pReq += epPassword->pwordLen;
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -2108,7 +2108,7 @@ int32_t ipc_ReadBinaryKey
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if( 0 == retVal )
{
//log debug info here
@@ -2124,7 +2124,7 @@ int32_t ipc_ReadBinaryKey
if( 0 == dataLen )
{
// Cleanup the channel by reading the return code.
retVal = IPC_READ(*(int *)ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
retVal = IPC_READ(ssHandle->platHandle,&sockReturn, MSG_DWORD_LEN);
if( retVal < 0 )
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -2137,7 +2137,7 @@ int32_t ipc_ReadBinaryKey
if(dataLen <= *valLen)
{
// Read the secret into application buffer.
retVal = IPC_READ(*(int *)ssHandle->platHandle, val, dataLen);
retVal = IPC_READ(ssHandle->platHandle, val, dataLen);
if( retVal < 0 )
{
retCode = NSSCS_E_SYSTEM_FAILURE;
@@ -2156,20 +2156,20 @@ int32_t ipc_ReadBinaryKey
n = dataLen;
while(n)
{
int bytes = IPC_READ(*(int *)ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
int bytes = IPC_READ(ssHandle->platHandle, gpReplyBuf, MIN_REPLY_BUF_LEN);
if( bytes > 0)
n -= MIN_REPLY_BUF_LEN;
else
break;
}
// Read the sscs return code also.
IPC_READ(*(int *)ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = NSSCS_E_ENUM_BUFF_TOO_SHORT;
break;
}
}
// Read the sscs return code also.
IPC_READ(*(int *)ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
IPC_READ(ssHandle->platHandle, (Byte *) &sockReturn, MSG_DWORD_LEN);
retCode = mapReturnCode(sockReturn);
} while(0);
@@ -2348,11 +2348,11 @@ int ipc_WriteKey
if(tmpBuf != NULL)
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,tmpBuf,msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,tmpBuf,msgLen);
}
else
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,gpReqBuf, msgLen);
}
if(retVal < 0)
{
@@ -2363,7 +2363,7 @@ int ipc_WriteKey
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -2563,11 +2563,11 @@ int ipc_WriteBinaryKey
if(tmpBuf != NULL)
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,tmpBuf,msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,tmpBuf,msgLen);
}
else
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,gpReqBuf, msgLen);
}
if(retVal < 0)
{
@@ -2578,7 +2578,7 @@ int ipc_WriteBinaryKey
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -2660,7 +2660,7 @@ int32_t ipc_SetMasterPassword
memcpy((SS_UTF8_T*)pReq,passwd->pword,passwdLen);
retVal = IPC_WRITE(*(int *)ssHandle->platHandle, gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle, gpReqBuf, msgLen);
if(retVal < 0)
{
//log debug info here
@@ -2670,7 +2670,7 @@ int32_t ipc_SetMasterPassword
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here
@@ -2796,11 +2796,11 @@ int ipc_IsSecretPersistent
}
if(tmpBuf != NULL)
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,tmpBuf,msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,tmpBuf,msgLen);
}
else
{
retVal = IPC_WRITE(*(int *)ssHandle->platHandle,gpReqBuf, msgLen);
retVal = IPC_WRITE(ssHandle->platHandle,gpReqBuf, msgLen);
}
if(retVal < 0)
{
@@ -2811,7 +2811,7 @@ int ipc_IsSecretPersistent
// Read reply
pReply = gpReplyBuf;
retVal = IPC_READ(*(int *)ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
retVal = IPC_READ(ssHandle->platHandle, pReply, MSG_REPLY_GENERAL);
if(retVal < 0)
{
//log debug info here