Check for secretID being NULL before checking length

This commit is contained in:
Jim Norman 2006-04-19 21:52:01 +00:00
parent ac0dbfc4e4
commit 06fdeaedaf

View File

@ -169,10 +169,10 @@ static int32_t sscsshs_GetNextSHSEntry
* Internal function that escapes delimited characters in a string.
*
*/
static void sscsshs_ChkEscapeString
(
SS_UTF8_T **entryBuf,
uint32_t *entryBufLen
static void sscsshs_ChkEscapeString
(
SS_UTF8_T **entryBuf,
uint32_t *entryBufLen
)
{ /* beginning of the call */
/* ########################## DECLARATIONS START HERE ######################### */
@ -224,11 +224,11 @@ static void sscsshs_ChkEscapeString
}
}
if(escaped)
{
if(escaped)
{
memset(*entryBuf, 0, *entryBufLen);
free (*entryBuf);
*entryBuf = tempBuf;
*entryBuf = tempBuf;
*entryBufLen = *entryBufLen + k;
return;
}
@ -259,9 +259,9 @@ static void sscsshs_ChkEscapeString
static int32_t sscsshs_PopulateSecretBuf
(
int32_t type,
uint32_t *kLen,
uint32_t *kLen,
SS_UTF8_T *key,
uint32_t *vLen,
uint32_t *vLen,
SS_UTF8_T *val,
uint32_t *bufLen,
SS_UTF8_T *retBuffer
@ -382,7 +382,7 @@ static int32_t sscsshs_PopulateBinarySecretBuf
*
*/
static int32_t sscsshs_ParseBinarySecretBuf
(
(
uint32_t *kLen,
SS_UTF8_T *key,
uint32_t *valLen,
@ -395,13 +395,13 @@ static int32_t sscsshs_ParseBinarySecretBuf
int32_t len = (SHS_BINARY_LEN + BINARY_DELIMITER_LEN) - 1; // excluding one Null terminator
/* ############################## CODE STARTS HERE ############################ */
memcpy(key, secretBuf->data, (SHS_BINARY_LEN - 1));
if(memcmp(key, SHS_BINARY, (SHS_BINARY_LEN - 1)))
{
return(NSSCS_E_PARSER_FAILURE); // create error stating non-Sh Sec Format key
}
}
*kLen = SHS_BINARY_LEN - 1;
// get the length of the binary data out;
@ -506,9 +506,9 @@ static int32_t sscsshs_UnescapeSecretIDBuf
/* ############################### CODE ENDS HERE ############################# */
} /* end of sscsshs_UnescapeSecretIDBuf */
/*
* NAME - sscs_UnescapeString
@ -517,10 +517,10 @@ static int32_t sscsshs_UnescapeSecretIDBuf
* Parses a string.
*
*/
static int32_t sscs_UnescapeString
(
uint8_t *val,
uint32_t *valueLen
static int32_t sscs_UnescapeString
(
uint8_t *val,
uint32_t *valueLen
)
{ /* beginning of the call */
/* ########################## DECLARATIONS START HERE ######################### */
@ -529,7 +529,7 @@ static int32_t sscs_UnescapeString
uint32_t len = 0;
uint8_t *temp;
uint32_t rc = NSSCS_SUCCESS;
/* ############################## CODE STARTS HERE ############################ */
len = *valueLen;
@ -560,7 +560,7 @@ static int32_t sscs_UnescapeString
{
temp[k++] = val[i];
}
} // end for ...
} // end for ...
temp[k] = '\0';
*valueLen = k+1;
@ -570,11 +570,11 @@ static int32_t sscs_UnescapeString
free(temp);
return rc;
}
else
else
{
return NSSCS_E_PARSER_FAILURE;
return NSSCS_E_PARSER_FAILURE;
}
/* ############################### CODE ENDS HERE ############################# */
} /* end of sscs_UnescapeString */
@ -1053,14 +1053,14 @@ miCASAReadSecret
memset(secretID.id, 0, NSSCS_MAX_SECRET_ID_LEN);
memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN);
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
goto errorLevel1;
}
}
memcpy(escapedSHSName, sharedSecretID->name, sharedSecretID->len);
memcpy(escapedSHSName, sharedSecretID->name, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
@ -1124,9 +1124,9 @@ miCASAReadSecret
}
// did we exhaust the buffer?
if(rc == NSSCS_E_OBJECT_NOT_FOUND)
if(rc == NSSCS_E_OBJECT_NOT_FOUND)
{
rc = NSSCS_SUCCESS;
rc = NSSCS_SUCCESS;
}
}
@ -1232,12 +1232,12 @@ miCASARemoveSecret
memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN);
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
goto errorLevel1;
}
}
memcpy(escapedSHSName, sharedSecretID->name, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
@ -1247,7 +1247,7 @@ miCASARemoveSecret
rc = NSSCS_E_SECRET_ID_TOO_SHORT;
goto errorLevel1;
}
if(SSCS_APPLICATION_TYPE_F & sharedSecretID->type)
{
sscs_Utf8Strncpy((SS_UTF8_T *)secretID.id, SSCS_APP_SECRET_DELIMITED, SSCS_APP_SECRET_CHARS_DELIMITED);
@ -1385,13 +1385,13 @@ miCASAWriteSecret
memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN);
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
goto errorLevel1;
}
memcpy(escapedSHSName, sharedSecretID->name, sharedSecretID->len);
}
memcpy(escapedSHSName, sharedSecretID->name, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
@ -1427,7 +1427,7 @@ miCASAWriteSecret
rc = NSSCS_E_NOT_SUPPORTED;
goto errorLevel1;
}
secBuf.len = 0;
if(sharedSecretID->type & SSCS_BINARY_TYPE_F)
{
@ -1569,8 +1569,8 @@ miCASAWriteKey
return(NSSCS_E_INVALID_PARAM);
}
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return(NSSCS_E_BUFFER_LEN);
}
@ -1605,16 +1605,16 @@ miCASAWriteKey
memset(escapedSHSValue, 0, NSSCS_MAX_SECRET_BUF_LEN);
// escape delimited characters
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
// escape delimited characters
memcpy(escapedSHSKey, key, keyLen);
memcpy(escapedSHSKey, key, keyLen);
sscsshs_ChkEscapeString(&escapedSHSKey, &keyLen);
// escape delimited characters
memcpy(escapedSHSValue, val, valLen);
memcpy(escapedSHSValue, val, valLen);
sscsshs_ChkEscapeString(&escapedSHSValue, &valLen);
if(escNameLen < 1)
@ -1716,8 +1716,8 @@ miCASAWriteBinaryKey
return(NSSCS_E_INVALID_PARAM);
}
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return(NSSCS_E_BUFFER_LEN);
}
@ -1743,14 +1743,14 @@ miCASAWriteBinaryKey
memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN);
memset(escapedSHSKey, 0, NSSCS_MAX_PASSCODE_LEN);
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
goto errorLevel1;
}
}
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
@ -1804,9 +1804,9 @@ errorLevel2:
/* ############################### CODE ENDS HERE ############################# */
} //* end of miCASAWriteBinaryKey
/*
* NAME - miCASAReadKey
@ -1849,8 +1849,8 @@ miCASAReadKey
return(NSSCS_E_INVALID_PARAM);
}
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return(NSSCS_E_BUFFER_LEN);
}
@ -1876,16 +1876,16 @@ miCASAReadKey
memset(escapedSHSKey, 0, NSSCS_MAX_SECRET_ID_LEN);
// escape delimited characters
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
rc = NSSCS_E_BUFFER_LEN;
goto errorLevel1;
}
}
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
memcpy(escapedSHSKey, key, keyLen);
sscsshs_ChkEscapeString(&escapedSHSKey, &keyLen);
@ -1981,8 +1981,8 @@ miCASAReadBinaryKey
return(NSSCS_E_INVALID_PARAM);
}
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
if(sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return(NSSCS_E_BUFFER_LEN);
}
@ -2008,7 +2008,7 @@ miCASAReadBinaryKey
memset(escapedSHSName, 0, NSSCS_MAX_SECRET_ID_LEN);
memset(escapedSHSKey, 0, NSSCS_MAX_SECRET_ID_LEN);
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
memcpy(escapedSHSName, sharedSecretID->id, sharedSecretID->len);
escNameLen = sharedSecretID->len;
sscsshs_ChkEscapeString(&escapedSHSName, &escNameLen);
@ -2255,28 +2255,28 @@ miCASASetMasterPassword
)
{ /* beginning of the call */
/* ########################## DECLARATIONS START HERE ######################### */
int32_t rc = 0;
void *context = NULL;
SSCS_SECRETSTORE_T store = {0};
/* ############################## CODE STARTS HERE ############################ */
// open secretStore
sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN);
store.version = 1;
store.version = 1;
context = miCASAOpenSecretStoreCache(&store, ssFlags, NULL);
if((context == NULL) || (passwd == NULL))
{
return(NSSCS_E_INVALID_PARAM);
}
}
rc = sscs_SetMasterPassword(((SSCS_CONTEXT_T*)context)->ssHandle, passwd, hint, NULL);
// close the secretstore
miCASACloseSecretStoreCache(context, ssFlags, NULL);
miCASACloseSecretStoreCache(context, ssFlags, NULL);
return(rc);
@ -2661,7 +2661,7 @@ miCASA_GetNextSHSEntry
SSCS_GLOBAL_LIBCALL(int32_t)
miCASA_AddSHSEntry
(
void *secretHandle,
void *secretHandle,
uint32_t keyLen,
SS_UTF8_T *key,
uint32_t valueLen,
@ -2732,7 +2732,7 @@ miCASA_RemoveSHSEntry
/* ##################################################################################### */
/* ######################### INTERNAL MANAGED CODE STARTS HERE ######################### */
/* ##################################################################################### */
static int32_t sscsshs_GetUsernamePassword
(
@ -2766,36 +2766,36 @@ static int32_t sscsshs_GetUsernamePassword
}
// determine username key name, ie CN, LDAPDN, etc
if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F)
if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F)
{
usernameKeyname = SHS_DN_NDAP;
usernameKeyname = SHS_DN_NDAP;
unkLen = SHS_DNNDAP_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_NDS_FDN_F)
{
{
usernameKeyname = SHS_FDN_NDAP;
unkLen = SHS_FDNNDAP_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_LDAP_DN_F)
{
{
usernameKeyname = SHS_DN_LDAP;
unkLen = SHS_DNLDAP_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_EMAIL_F)
{
{
usernameKeyname = SHS_EMAIL;
unkLen = SHS_EMAIL_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_OTHER_F)
{
{
usernameKeyname = SHS_OTHER;
unkLen = SHS_OTHER_LEN;
}
}
else
{
{
usernameKeyname = SHS_CN;
unkLen = SHS_CN_LEN;
}
}
// enumerate this list looking for username and password
if(!(rcode = miCASA_GetNextSHSEntry(1, secretHandle, &kLen, key, &vLen, value)))
@ -2821,9 +2821,9 @@ static int32_t sscsshs_GetUsernamePassword
basicCred->pwordLen = vLen;
}
if(userFound && passFound)
if(userFound && passFound)
{
break;
break;
}
// clear the buffers
@ -2841,19 +2841,19 @@ static int32_t sscsshs_GetUsernamePassword
memset(value, 0, NSSCS_MAX_SECRET_BUF_LEN);
free(value);
if(userFound && passFound)
if(userFound && passFound)
{
return NSSCS_SUCCESS;
}
}
else
{
{
return NSSCS_E_INVALID_SECRET_ID;
}
}
/* ############################### CODE ENDS HERE ############################# */
} // end of sscsshs_GetUsernamePassword
/*
@ -2865,7 +2865,7 @@ static int32_t sscsshs_GetUsernamePassword
*/
static int32_t sscsshs_GetCredSetName
(
void *secretHandle,
void *secretHandle,
uint32_t *credSetNameLen,
uint8_t *credSetName
)
@ -2896,7 +2896,7 @@ static int32_t sscsshs_GetCredSetName
{
if(kLen)
{
sscs_Utf8Strncpy((SS_UTF8_T *)credSetName, (SS_UTF8_T *)value, vLen);
sscs_Utf8Strncpy((SS_UTF8_T *)credSetName, (SS_UTF8_T *)value, vLen);
*credSetNameLen = vLen;
}
}
@ -2911,7 +2911,7 @@ static int32_t sscsshs_GetCredSetName
/* ############################### CODE ENDS HERE ############################# */
} // end of sscsshs_GetCredSetName
@ -2970,15 +2970,15 @@ miCASAGetCredential
if((appSecretID == NULL) || (credential == NULL))
{
return(NSSCS_E_INVALID_PARAM);
}
if (appSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
}
if (appSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return NSSCS_E_BUFFER_LEN;
}
if ((sharedSecretID) && (sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4))
{
}
if ((sharedSecretID) && (sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4))
{
return NSSCS_E_BUFFER_LEN;
}
@ -2990,7 +2990,7 @@ miCASAGetCredential
sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN);
store.version = 1;
context = miCASAOpenSecretStoreCache(&store, ssFlags, NULL);
if(context == NULL)
{
return NSSCS_E_SYSTEM_FAILURE;
@ -3035,13 +3035,13 @@ miCASAGetCredential
// create a SHS Handle
secretHandle = miCASA_CreateSHSHandle();
if(secretHandle == NULL)
if(secretHandle == NULL)
{
return NSSCS_E_SYSTEM_FAILURE;
}
// 1&2. look up the SS_App for this secretID, if not found use the sharedSecretID
secID.type = SSCS_APPLICATION_TYPE_F;
secID.type = SSCS_APPLICATION_TYPE_F;
secID.len = appSecretID->len;
sscs_Utf8Strncpy(secID.name, appSecretID->id, appSecretID->len);
@ -3054,11 +3054,11 @@ miCASAGetCredential
if(rcode == NSSCS_SUCCESS)
{
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
}
}
secretHandle = miCASA_CreateSHSHandle();
// read credset for this app
@ -3076,10 +3076,10 @@ miCASAGetCredential
// 3. if we still don't have a secret, try the SS_CredSet for the appSecretID
if(rcode)
{
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
}
miCASA_DestroySHSHandle(secretHandle);
}
secretHandle = miCASA_CreateSHSHandle();
@ -3099,16 +3099,16 @@ miCASAGetCredential
if(rcode && sharedSecretID)
{
// let's look for it.
secID.type = SSCS_CREDENTIAL_TYPE_F;
secID.type = SSCS_CREDENTIAL_TYPE_F;
secID.len = sharedSecretID->len;
sscs_Utf8Strncpy(secID.name, sharedSecretID->id, secID.len);
// get a new handle
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
}
}
secretHandle = miCASA_CreateSHSHandle();
rcode = miCASAReadSecret(context, &kc, ssFlags, secretHandle, &secID, NULL, &readData, NULL);
@ -3126,10 +3126,10 @@ miCASAGetCredential
secID.len = SECRET_ID_DEFAULT_LEN;
sscs_Utf8Strncpy(secID.name, SECRET_ID_DEFAULT, secID.len);
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
}
miCASA_DestroySHSHandle(secretHandle);
}
secretHandle = miCASA_CreateSHSHandle();
@ -3141,9 +3141,9 @@ miCASAGetCredential
}
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
miCASA_DestroySHSHandle(secretHandle);
}
miCASACloseSecretStoreCache(context, ssFlags, NULL);
@ -3192,7 +3192,7 @@ miCASASetCredential
SSCS_READEXT_T readData = {0};
SSCS_KEYCHAIN_ID_T kc = {0};
SS_UTF8_T *usernameKeyname; // = SSCS_USERNAME_OTHER;
SS_UTF8_T *usernameKeyname; // = SSCS_USERNAME_OTHER;
uint32_t kLen = 0;
uint32_t unkLen = 0;
@ -3207,17 +3207,17 @@ miCASASetCredential
if((appSecretID == NULL) || (credential == NULL))
{
return(NSSCS_E_INVALID_PARAM);
}
if (appSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return NSSCS_E_BUFFER_LEN;
}
}
if ((sharedSecretID) && (sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4))
{
if (appSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return NSSCS_E_BUFFER_LEN;
}
}
if ((sharedSecretID) && (sharedSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4))
{
return NSSCS_E_BUFFER_LEN;
}
@ -3264,38 +3264,38 @@ miCASASetCredential
{
basicCred = (SSCS_BASIC_CREDENTIAL *)credential;
}
// determine username key name, ie CN, LDAPDN, etc
if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F)
if(basicCred->unFlags & USERNAME_TYPE_NDS_DN_F)
{
usernameKeyname = SHS_DN_NDAP;
usernameKeyname = SHS_DN_NDAP;
unkLen = SHS_DNNDAP_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_NDS_FDN_F)
{
{
usernameKeyname = SHS_FDN_NDAP;
unkLen = SHS_FDNNDAP_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_LDAP_DN_F)
{
{
usernameKeyname = SHS_DN_LDAP;
unkLen = SHS_DNLDAP_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_EMAIL_F)
{
{
usernameKeyname = SHS_EMAIL;
unkLen = SHS_EMAIL_LEN;
}
}
else if(basicCred->unFlags & USERNAME_TYPE_OTHER_F)
{
{
usernameKeyname = SHS_OTHER;
unkLen = SHS_OTHER_LEN;
}
}
else
{
{
usernameKeyname = SHS_CN;
unkLen = SHS_CN_LEN;
}
}
// create a SHS Handle
secretHandle = miCASA_CreateSHSHandle();
@ -3319,10 +3319,10 @@ miCASASetCredential
if(rcode == NSSCS_SUCCESS)
{
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
}
miCASA_DestroySHSHandle(secretHandle);
}
secretHandle = miCASA_CreateSHSHandle();
@ -3364,10 +3364,10 @@ miCASASetCredential
rcode = miCASAWriteKey(context, ssFlags, &kc, appSecretID, SHS_PASSWORD, 9, basicCred->password, vLen, NULL, ext);
}
if(secretHandle)
if(secretHandle)
{
miCASA_DestroySHSHandle(secretHandle);
}
}
miCASACloseSecretStoreCache(context, ssFlags, NULL);
@ -3405,22 +3405,22 @@ miCASARemoveCredential
SSCS_SH_SECRET_ID_T secID = {0};
/* ############################## CODE STARTS HERE ############################ */
if(appSecretID == NULL)
{
return(NSSCS_E_INVALID_PARAM);
}
if(appSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
}
if(appSecretID->len > NSSCS_MAX_SECRET_ID_LEN/4)
{
return NSSCS_E_BUFFER_LEN;
}
}
// open secretStore
sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN);
store.version = 1;
context = miCASAOpenSecretStoreCache(&store, ssFlags, NULL);
if(context == NULL)
{
return NSSCS_E_SYSTEM_FAILURE;
@ -3461,24 +3461,24 @@ miCASASetMasterPasscode
)
{ /* beginning of the call */
/* ########################## DECLARATIONS START HERE ######################### */
int32_t rc = 0;
void *context = NULL;
SSCS_SECRETSTORE_T store = {0};
SSCS_SECRETSTORE_T store = {0};
/* ############################## CODE STARTS HERE ############################ */
if(passcode == NULL)
{
return(NSSCS_E_INVALID_PARAM);
}
// open secretStore
sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN);
store.version = 1;
context = miCASAOpenSecretStoreCache(&store, ssFlags, NULL);
if(context == NULL)
{
return NSSCS_E_SYSTEM_FAILURE;
@ -3515,18 +3515,18 @@ miCASAIsSecretPersistent
SSCS_SECRETSTORE_T store = {0};
SSCS_KEYCHAIN_ID_T kc = {0};
SSCS_CONTEXT_T *storeContext;
/* ############################## CODE STARTS HERE ############################ */
if((ssFlags == 0) && (secretID == NULL))
if((ssFlags == 0) && (secretID == NULL))
{
return NSSCS_E_INVALID_PARAM;
}
if(secretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
}
if(secretID && secretID->len > NSSCS_MAX_SECRET_ID_LEN)
{
return NSSCS_E_BUFFER_LEN;
}
}
// open secretStore
sscs_Utf8Strncpy(store.ssName, SSCS_DEFAULT_SECRETSTORE_ID, SSCS_DEFAULT_SECRETSTORE_ID_LEN);
@ -3538,7 +3538,7 @@ miCASAIsSecretPersistent
if(context == NULL)
{
return NSSCS_E_SYSTEM_FAILURE;
}
}
kc.len = SSCS_S_KC_ID_CHARS;
sscs_Utf8Strncpy(kc.keychainID, SSCS_SESSION_KEY_CHAIN_ID, kc.len);