390527 - libpkix does not return a numeric error code. r=nelson
git-svn-id: svn://10.0.0.236/trunk@234079 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
76c9a9f4d2
commit
4883545f57
@ -259,7 +259,6 @@ custom_CertSelector_MatchCallback(
|
|||||||
PKIX_List *certPolicies = NULL;
|
PKIX_List *certPolicies = NULL;
|
||||||
PKIX_List *quals = NULL;
|
PKIX_List *quals = NULL;
|
||||||
PKIX_PL_CertPolicyInfo *policy = NULL;
|
PKIX_PL_CertPolicyInfo *policy = NULL;
|
||||||
PKIX_PL_String *errorDesc = NULL;
|
|
||||||
PKIX_Error *error = NULL;
|
PKIX_Error *error = NULL;
|
||||||
|
|
||||||
PKIX_TEST_STD_VARS();
|
PKIX_TEST_STD_VARS();
|
||||||
@ -290,18 +289,11 @@ custom_CertSelector_MatchCallback(
|
|||||||
PKIX_TEST_DECREF_BC(certPolicies);
|
PKIX_TEST_DECREF_BC(certPolicies);
|
||||||
*pResult = PKIX_FALSE;
|
*pResult = PKIX_FALSE;
|
||||||
|
|
||||||
/* Policies extension but no Policy Qualifiers */
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create
|
|
||||||
(PKIX_ESCASCII,
|
|
||||||
"Policies extension but no Policy Qualifiers",
|
|
||||||
0,
|
|
||||||
&errorDesc,
|
|
||||||
plContext));
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
||||||
(PKIX_CERTSELECTOR_ERROR,
|
(PKIX_CERTSELECTOR_ERROR,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
errorDesc,
|
PKIX_TESTPOLICYEXTWITHNOPOLICYQUALIFIERS,
|
||||||
&error,
|
&error,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
@ -312,7 +304,6 @@ cleanup:
|
|||||||
PKIX_TEST_DECREF_AC(certPolicies);
|
PKIX_TEST_DECREF_AC(certPolicies);
|
||||||
PKIX_TEST_DECREF_AC(policy);
|
PKIX_TEST_DECREF_AC(policy);
|
||||||
PKIX_TEST_DECREF_AC(quals);
|
PKIX_TEST_DECREF_AC(quals);
|
||||||
PKIX_TEST_DECREF_AC(errorDesc);
|
|
||||||
|
|
||||||
return(error);
|
return(error);
|
||||||
}
|
}
|
||||||
@ -387,18 +378,11 @@ custom_CertSelector_MatchOIDCallback(
|
|||||||
PKIX_TEST_DECREF_BC(certSelectorContext);
|
PKIX_TEST_DECREF_BC(certSelectorContext);
|
||||||
PKIX_TEST_DECREF_BC(certPolicies);
|
PKIX_TEST_DECREF_BC(certPolicies);
|
||||||
|
|
||||||
/* No matching Policy */
|
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create
|
|
||||||
(PKIX_ESCASCII,
|
|
||||||
"No matching Policy",
|
|
||||||
0,
|
|
||||||
&errorDesc,
|
|
||||||
plContext));
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
|
||||||
(PKIX_CERTSELECTOR_ERROR,
|
(PKIX_CERTSELECTOR_ERROR,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
errorDesc,
|
PKIX_TESTNOMATCHINGPOLICY,
|
||||||
&error,
|
&error,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
|
|||||||
@ -154,7 +154,6 @@ testCRLSelectorMatchCallback(
|
|||||||
PKIX_UInt32 i = 0;
|
PKIX_UInt32 i = 0;
|
||||||
PKIX_Boolean result = PKIX_FALSE;
|
PKIX_Boolean result = PKIX_FALSE;
|
||||||
PKIX_Error *error = NULL;
|
PKIX_Error *error = NULL;
|
||||||
PKIX_PL_String *textString = NULL;
|
|
||||||
char *errorText = "Not an error, CRL Select mismatch";
|
char *errorText = "Not an error, CRL Select mismatch";
|
||||||
|
|
||||||
PKIX_TEST_STD_VARS();
|
PKIX_TEST_STD_VARS();
|
||||||
@ -202,20 +201,12 @@ testCRLSelectorMatchCallback(
|
|||||||
|
|
||||||
if (i == numIssuers-1) {
|
if (i == numIssuers-1) {
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR
|
|
||||||
(PKIX_PL_String_Create
|
|
||||||
(PKIX_ESCASCII,
|
|
||||||
(void *) errorText,
|
|
||||||
0,
|
|
||||||
&textString,
|
|
||||||
plContext));
|
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR
|
PKIX_TEST_EXPECT_NO_ERROR
|
||||||
(PKIX_Error_Create
|
(PKIX_Error_Create
|
||||||
(0,
|
(0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
textString,
|
PKIX_TESTNOTANERRORCRLSELECTMISMATCH,
|
||||||
&error,
|
&error,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
@ -235,7 +226,6 @@ cleanup:
|
|||||||
PKIX_TEST_DECREF_AC(crlIssuer);
|
PKIX_TEST_DECREF_AC(crlIssuer);
|
||||||
PKIX_TEST_DECREF_AC(issuer);
|
PKIX_TEST_DECREF_AC(issuer);
|
||||||
PKIX_TEST_DECREF_AC(issuerList);
|
PKIX_TEST_DECREF_AC(issuerList);
|
||||||
PKIX_TEST_DECREF_AC(textString);
|
|
||||||
|
|
||||||
PKIX_TEST_RETURN();
|
PKIX_TEST_RETURN();
|
||||||
|
|
||||||
|
|||||||
@ -54,31 +54,13 @@ void createErrors(
|
|||||||
PKIX_Error **error5,
|
PKIX_Error **error5,
|
||||||
PKIX_Error **error6,
|
PKIX_Error **error6,
|
||||||
PKIX_Error **error7,
|
PKIX_Error **error7,
|
||||||
char *descChar,
|
|
||||||
char *descChar2,
|
|
||||||
char *infoChar)
|
char *infoChar)
|
||||||
|
|
||||||
{
|
{
|
||||||
PKIX_PL_String *descString = NULL;
|
|
||||||
PKIX_PL_String *desc2String = NULL;
|
|
||||||
PKIX_PL_String *infoString = NULL;
|
PKIX_PL_String *infoString = NULL;
|
||||||
|
|
||||||
PKIX_TEST_STD_VARS();
|
PKIX_TEST_STD_VARS();
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create(
|
|
||||||
PKIX_ESCASCII,
|
|
||||||
descChar,
|
|
||||||
PL_strlen(descChar),
|
|
||||||
&descString,
|
|
||||||
plContext));
|
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create(
|
|
||||||
PKIX_ESCASCII,
|
|
||||||
descChar2,
|
|
||||||
PL_strlen(descChar2),
|
|
||||||
&desc2String,
|
|
||||||
plContext));
|
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create(
|
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_String_Create(
|
||||||
PKIX_ESCASCII,
|
PKIX_ESCASCII,
|
||||||
infoChar,
|
infoChar,
|
||||||
@ -86,15 +68,19 @@ void createErrors(
|
|||||||
&infoString,
|
&infoString,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR
|
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
||||||
(PKIX_Error_Create
|
(PKIX_MEM_ERROR,
|
||||||
(PKIX_MEM_ERROR, NULL, NULL, desc2String, error2, plContext));
|
NULL,
|
||||||
|
NULL,
|
||||||
|
PKIX_TESTANOTHERERRORMESSAGE,
|
||||||
|
error2,
|
||||||
|
plContext));
|
||||||
|
|
||||||
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
PKIX_TEST_EXPECT_NO_ERROR(PKIX_Error_Create
|
||||||
(PKIX_OBJECT_ERROR,
|
(PKIX_OBJECT_ERROR,
|
||||||
*error2,
|
*error2,
|
||||||
(PKIX_PL_Object*)infoString,
|
(PKIX_PL_Object*)infoString,
|
||||||
descString,
|
PKIX_TESTERRORMESSAGE,
|
||||||
error,
|
error,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
@ -102,7 +88,7 @@ void createErrors(
|
|||||||
(PKIX_OBJECT_ERROR,
|
(PKIX_OBJECT_ERROR,
|
||||||
*error2,
|
*error2,
|
||||||
(PKIX_PL_Object*)infoString,
|
(PKIX_PL_Object*)infoString,
|
||||||
descString,
|
PKIX_TESTERRORMESSAGE,
|
||||||
error3,
|
error3,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
@ -110,7 +96,7 @@ void createErrors(
|
|||||||
(PKIX_OBJECT_ERROR,
|
(PKIX_OBJECT_ERROR,
|
||||||
NULL,
|
NULL,
|
||||||
(PKIX_PL_Object*)infoString,
|
(PKIX_PL_Object*)infoString,
|
||||||
NULL,
|
0,
|
||||||
error5,
|
error5,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
@ -118,7 +104,7 @@ void createErrors(
|
|||||||
(PKIX_MEM_ERROR,
|
(PKIX_MEM_ERROR,
|
||||||
*error5,
|
*error5,
|
||||||
(PKIX_PL_Object*)infoString,
|
(PKIX_PL_Object*)infoString,
|
||||||
NULL,
|
0,
|
||||||
error6,
|
error6,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
@ -126,14 +112,12 @@ void createErrors(
|
|||||||
(PKIX_OBJECT_ERROR,
|
(PKIX_OBJECT_ERROR,
|
||||||
*error6,
|
*error6,
|
||||||
(PKIX_PL_Object*)infoString,
|
(PKIX_PL_Object*)infoString,
|
||||||
NULL,
|
0,
|
||||||
error7,
|
error7,
|
||||||
plContext));
|
plContext));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
PKIX_TEST_DECREF_AC(descString);
|
|
||||||
PKIX_TEST_DECREF_AC(desc2String);
|
|
||||||
PKIX_TEST_DECREF_AC(infoString);
|
PKIX_TEST_DECREF_AC(infoString);
|
||||||
|
|
||||||
PKIX_TEST_RETURN();
|
PKIX_TEST_RETURN();
|
||||||
@ -425,8 +409,6 @@ int test_error(int argc, char *argv[]) {
|
|||||||
&error5,
|
&error5,
|
||||||
&error6,
|
&error6,
|
||||||
&error7,
|
&error7,
|
||||||
descChar,
|
|
||||||
descChar2,
|
|
||||||
infoChar);
|
infoChar);
|
||||||
|
|
||||||
PKIX_TEST_EQ_HASH_TOSTR_DUP
|
PKIX_TEST_EQ_HASH_TOSTR_DUP
|
||||||
|
|||||||
@ -43,6 +43,8 @@
|
|||||||
* by defining PKIX_ERRORENTRY(x,y) #y and then listing thim within an array
|
* by defining PKIX_ERRORENTRY(x,y) #y and then listing thim within an array
|
||||||
* const char * const PKIX_ErrorText[]
|
* const char * const PKIX_ErrorText[]
|
||||||
*/
|
*/
|
||||||
|
/* ALLOCERROR should always be the first */
|
||||||
|
PKIX_ERRORENTRY(ALLOCERROR,Allocation Error),
|
||||||
PKIX_ERRORENTRY(PKIXUNKNOWNERROR,PKIX uninitialized error code),
|
PKIX_ERRORENTRY(PKIXUNKNOWNERROR,PKIX uninitialized error code),
|
||||||
PKIX_ERRORENTRY(GETPKIXERRORCODEFAILED,Get PKIX error code failed),
|
PKIX_ERRORENTRY(GETPKIXERRORCODEFAILED,Get PKIX error code failed),
|
||||||
PKIX_ERRORENTRY(ADDHEADERFUNCTIONNOTSUPPORTED,AddHeader function not supported),
|
PKIX_ERRORENTRY(ADDHEADERFUNCTIONNOTSUPPORTED,AddHeader function not supported),
|
||||||
@ -997,6 +999,11 @@ PKIX_ERRORENTRY(STRINGHASHCODEFAILED,pkix_pl_String_Hashcode failed),
|
|||||||
PKIX_ERRORENTRY(SUBJALTNAMECHECKFAILED,Validation failed: SubjAltNamecheck failed),
|
PKIX_ERRORENTRY(SUBJALTNAMECHECKFAILED,Validation failed: SubjAltNamecheck failed),
|
||||||
PKIX_ERRORENTRY(TARGETCERTCHECKERINITIALIZEFAILED,pkix_TargetCertChecker_Initialize failed),
|
PKIX_ERRORENTRY(TARGETCERTCHECKERINITIALIZEFAILED,pkix_TargetCertChecker_Initialize failed),
|
||||||
PKIX_ERRORENTRY(TARGETCERTCHECKERSTATECREATEFAILED,pkix_TargetCertCheckerState_Create failed),
|
PKIX_ERRORENTRY(TARGETCERTCHECKERSTATECREATEFAILED,pkix_TargetCertCheckerState_Create failed),
|
||||||
|
PKIX_ERRORENTRY(TESTPOLICYEXTWITHNOPOLICYQUALIFIERS, Policies extension but no Policy Qualifiers),
|
||||||
|
PKIX_ERRORENTRY(TESTNOMATCHINGPOLICY, No Matching Policy),
|
||||||
|
PKIX_ERRORENTRY(TESTNOTANERRORCRLSELECTMISMATCH, Not an error CRL Select mismatch),
|
||||||
|
PKIX_ERRORENTRY(TESTERRORMESSAGE, Error Message),
|
||||||
|
PKIX_ERRORENTRY(TESTANOTHERERRORMESSAGE, Another Error Message),
|
||||||
PKIX_ERRORENTRY(TIMECONSUMEDEXCEEDSRESOURCELIMITS,Time consumed exceeds Resource Limits),
|
PKIX_ERRORENTRY(TIMECONSUMEDEXCEEDSRESOURCELIMITS,Time consumed exceeds Resource Limits),
|
||||||
PKIX_ERRORENTRY(TOOLITTLEDATAINDERSEQUENCE,Too little data in DER Sequence),
|
PKIX_ERRORENTRY(TOOLITTLEDATAINDERSEQUENCE,Too little data in DER Sequence),
|
||||||
PKIX_ERRORENTRY(TOOMUCHDATAINDERSEQUENCE,Too much data in DER Sequence),
|
PKIX_ERRORENTRY(TOOMUCHDATAINDERSEQUENCE,Too much data in DER Sequence),
|
||||||
|
|||||||
@ -497,10 +497,10 @@ PKIX_AddLogger(
|
|||||||
*/
|
*/
|
||||||
PKIX_Error *
|
PKIX_Error *
|
||||||
PKIX_Error_Create(
|
PKIX_Error_Create(
|
||||||
PKIX_UInt32 errorCode,
|
PKIX_ERRORNUM errorCode,
|
||||||
PKIX_Error *cause,
|
PKIX_Error *cause,
|
||||||
PKIX_PL_Object *info,
|
PKIX_PL_Object *info,
|
||||||
PKIX_PL_String *desc,
|
PKIX_ERRSTRINGNUM descCode,
|
||||||
PKIX_Error **pError,
|
PKIX_Error **pError,
|
||||||
void *plContext);
|
void *plContext);
|
||||||
|
|
||||||
|
|||||||
@ -2634,8 +2634,7 @@ subrErrorCleanup:
|
|||||||
(subroutineErr, &pkixErrorCode, plContext);
|
(subroutineErr, &pkixErrorCode, plContext);
|
||||||
if (pkixTempResult) return pkixTempResult;
|
if (pkixTempResult) return pkixTempResult;
|
||||||
if (pkixErrorCode == PKIX_FATAL_ERROR) {
|
if (pkixErrorCode == PKIX_FATAL_ERROR) {
|
||||||
PKIX_THROW
|
PKIX_THROW(FATAL, PKIX_POLICYCHECKERERROR);
|
||||||
(FATAL, PKIX_ErrorText[PKIX_POLICYCHECKERERROR]);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Abort policy processing, and then determine whether
|
* Abort policy processing, and then determine whether
|
||||||
|
|||||||
@ -69,8 +69,6 @@ pkix_Error_Equals(
|
|||||||
PKIX_Error *secondError = NULL;
|
PKIX_Error *secondError = NULL;
|
||||||
PKIX_Error *firstCause = NULL;
|
PKIX_Error *firstCause = NULL;
|
||||||
PKIX_Error *secondCause = NULL;
|
PKIX_Error *secondCause = NULL;
|
||||||
PKIX_PL_String *firstDesc = NULL;
|
|
||||||
PKIX_PL_String *secondDesc = NULL;
|
|
||||||
PKIX_PL_Object *firstInfo = NULL;
|
PKIX_PL_Object *firstInfo = NULL;
|
||||||
PKIX_PL_Object *secondInfo = NULL;
|
PKIX_PL_Object *secondInfo = NULL;
|
||||||
PKIX_UInt32 firstCode, secondCode, secondType;
|
PKIX_UInt32 firstCode, secondCode, secondType;
|
||||||
@ -164,22 +162,8 @@ pkix_Error_Equals(
|
|||||||
|
|
||||||
|
|
||||||
/* Compare descs */
|
/* Compare descs */
|
||||||
firstDesc = firstError->desc;
|
if (firstError->descCode != secondError->descCode) {
|
||||||
secondDesc = secondError->desc;
|
|
||||||
|
|
||||||
if (((firstDesc != NULL) && (secondDesc == NULL))||
|
|
||||||
((firstDesc == NULL) && (secondDesc != NULL))) {
|
|
||||||
unequalFlag = PKIX_TRUE;
|
unequalFlag = PKIX_TRUE;
|
||||||
} else if ((firstDesc != NULL) && (secondDesc != NULL)) {
|
|
||||||
PKIX_CHECK(PKIX_PL_Object_Equals
|
|
||||||
((PKIX_PL_Object*) firstDesc,
|
|
||||||
(PKIX_PL_Object*) secondDesc,
|
|
||||||
&boolResult,
|
|
||||||
plContext),
|
|
||||||
PKIX_ERRORINRECURSIVEEQUALSCALL);
|
|
||||||
|
|
||||||
/* If the desc errors are not equal, return null */
|
|
||||||
if (boolResult == 0) unequalFlag = PKIX_TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the unequalFlag was set, return false */
|
/* If the unequalFlag was set, return false */
|
||||||
@ -214,8 +198,6 @@ pkix_Error_Destroy(
|
|||||||
|
|
||||||
PKIX_DECREF(error->cause);
|
PKIX_DECREF(error->cause);
|
||||||
|
|
||||||
PKIX_DECREF(error->desc);
|
|
||||||
|
|
||||||
PKIX_DECREF(error->info);
|
PKIX_DECREF(error->info);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -259,8 +241,8 @@ pkix_Error_ToString(
|
|||||||
code = error->code;
|
code = error->code;
|
||||||
|
|
||||||
/* Get the description string */
|
/* Get the description string */
|
||||||
desc = error->desc;
|
PKIX_Error_GetDescription(error, &desc, plContext);
|
||||||
|
|
||||||
/* Get the cause */
|
/* Get the cause */
|
||||||
cause = error->cause;
|
cause = error->cause;
|
||||||
|
|
||||||
@ -325,7 +307,6 @@ pkix_Error_ToString(
|
|||||||
plContext),
|
plContext),
|
||||||
PKIX_STRINGCREATEFAILED);
|
PKIX_STRINGCREATEFAILED);
|
||||||
|
|
||||||
|
|
||||||
/* Create the output String */
|
/* Create the output String */
|
||||||
PKIX_CHECK(PKIX_PL_Sprintf
|
PKIX_CHECK(PKIX_PL_Sprintf
|
||||||
(pString,
|
(pString,
|
||||||
@ -428,10 +409,10 @@ pkix_Error_RegisterSelf(void *plContext)
|
|||||||
*/
|
*/
|
||||||
PKIX_Error *
|
PKIX_Error *
|
||||||
PKIX_Error_Create(
|
PKIX_Error_Create(
|
||||||
PKIX_UInt32 errorCode,
|
PKIX_ERRORNUM errorCode,
|
||||||
PKIX_Error *cause,
|
PKIX_Error *cause,
|
||||||
PKIX_PL_Object *info,
|
PKIX_PL_Object *info,
|
||||||
PKIX_PL_String *desc,
|
PKIX_ERRSTRINGNUM descCode,
|
||||||
PKIX_Error **pError,
|
PKIX_Error **pError,
|
||||||
void *plContext)
|
void *plContext)
|
||||||
{
|
{
|
||||||
@ -462,7 +443,7 @@ PKIX_Error_Create(
|
|||||||
tempCause = tempCause->cause) {
|
tempCause = tempCause->cause) {
|
||||||
/* If we detect a loop, throw a new error */
|
/* If we detect a loop, throw a new error */
|
||||||
if (tempCause == error) {
|
if (tempCause == error) {
|
||||||
PKIX_THROW(ERROR, "Loop of error causes detected");
|
PKIX_THROW(ERROR, PKIX_LOOPOFERRORCAUSEDETECTED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,8 +453,7 @@ PKIX_Error_Create(
|
|||||||
PKIX_INCREF(info);
|
PKIX_INCREF(info);
|
||||||
error->info = info;
|
error->info = info;
|
||||||
|
|
||||||
PKIX_INCREF(desc);
|
error->descCode = descCode;
|
||||||
error->desc = desc;
|
|
||||||
|
|
||||||
*pError = error;
|
*pError = error;
|
||||||
|
|
||||||
@ -497,6 +477,23 @@ PKIX_Error_GetErrorCode(
|
|||||||
PKIX_RETURN(ERROR);
|
PKIX_RETURN(ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FUNCTION: PKIX_Error_GetErrorCode (see comments in pkix_util.h)
|
||||||
|
*/
|
||||||
|
PKIX_Error *
|
||||||
|
PKIX_Error_GetErrorMsgCode(
|
||||||
|
PKIX_Error *error,
|
||||||
|
PKIX_UInt32 *pCode,
|
||||||
|
void *plContext)
|
||||||
|
{
|
||||||
|
PKIX_ENTER(ERROR, "PKIX_Error_GetDescErrorCode");
|
||||||
|
PKIX_NULLCHECK_TWO(error, pCode);
|
||||||
|
|
||||||
|
*pCode = error->descCode;
|
||||||
|
|
||||||
|
PKIX_RETURN(ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: PKIX_Error_GetCause (see comments in pkix_util.h)
|
* FUNCTION: PKIX_Error_GetCause (see comments in pkix_util.h)
|
||||||
*/
|
*/
|
||||||
@ -546,14 +543,18 @@ PKIX_Error_GetDescription(
|
|||||||
PKIX_PL_String **pDesc,
|
PKIX_PL_String **pDesc,
|
||||||
void *plContext)
|
void *plContext)
|
||||||
{
|
{
|
||||||
|
PKIX_PL_String *descString = NULL;
|
||||||
|
|
||||||
PKIX_ENTER(ERROR, "PKIX_Error_GetDescription");
|
PKIX_ENTER(ERROR, "PKIX_Error_GetDescription");
|
||||||
PKIX_NULLCHECK_TWO(error, pDesc);
|
PKIX_NULLCHECK_TWO(error, pDesc);
|
||||||
|
|
||||||
if (error != PKIX_ALLOC_ERROR()){
|
PKIX_PL_String_Create(PKIX_ESCASCII,
|
||||||
PKIX_INCREF(error->desc);
|
(void *)PKIX_ErrorText[error->descCode],
|
||||||
}
|
0,
|
||||||
|
&descString,
|
||||||
|
plContext);
|
||||||
|
|
||||||
*pDesc = error->desc;
|
*pDesc = descString;
|
||||||
|
|
||||||
PKIX_RETURN(ERROR);
|
PKIX_RETURN(ERROR);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,10 +51,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct PKIX_ErrorStruct {
|
struct PKIX_ErrorStruct {
|
||||||
PKIX_UInt32 code;
|
PKIX_ERRORNUM code;
|
||||||
PKIX_Error *cause;
|
PKIX_Error *cause;
|
||||||
PKIX_PL_Object *info;
|
PKIX_PL_Object *info;
|
||||||
PKIX_PL_String *desc;
|
PKIX_ERRSTRINGNUM descCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* see source file for function documentation */
|
/* see source file for function documentation */
|
||||||
|
|||||||
@ -48,9 +48,9 @@ const PKIX_StdVars zeroStdVars;
|
|||||||
|
|
||||||
PKIX_Error *
|
PKIX_Error *
|
||||||
PKIX_DoThrow(PKIX_StdVars * stdVars, PKIX_ERRORNUM errorCode,
|
PKIX_DoThrow(PKIX_StdVars * stdVars, PKIX_ERRORNUM errorCode,
|
||||||
const char * desc, void *plContext)
|
PKIX_ERRSTRINGNUM descNum, void *plContext)
|
||||||
{
|
{
|
||||||
pkixTempResult = (PKIX_Error*)pkix_Throw(errorCode, myFuncName, desc,
|
pkixTempResult = (PKIX_Error*)pkix_Throw(errorCode, myFuncName, descNum,
|
||||||
pkixErrorResult, &pkixReturnResult, plContext);
|
pkixErrorResult, &pkixReturnResult, plContext);
|
||||||
if (pkixErrorResult != PKIX_ALLOC_ERROR())
|
if (pkixErrorResult != PKIX_ALLOC_ERROR())
|
||||||
PKIX_DECREF(pkixErrorResult);
|
PKIX_DECREF(pkixErrorResult);
|
||||||
@ -66,7 +66,7 @@ PKIX_DoReturn(PKIX_StdVars * stdVars, PKIX_ERRORNUM errorCode,
|
|||||||
PKIX_OBJECT_UNLOCK(lockedObject);
|
PKIX_OBJECT_UNLOCK(lockedObject);
|
||||||
PKIX_MUTEX_UNLOCK(lockedMutex);
|
PKIX_MUTEX_UNLOCK(lockedMutex);
|
||||||
if ((pkixErrorReceived) || (pkixErrorResult))
|
if ((pkixErrorReceived) || (pkixErrorResult))
|
||||||
return PKIX_DoThrow(stdVars, errorCode, pkixErrorMsg, plContext);
|
return PKIX_DoThrow(stdVars, errorCode, pkixErrMsgNum, plContext);
|
||||||
/* PKIX_DEBUG_EXIT(type); */
|
/* PKIX_DEBUG_EXIT(type); */
|
||||||
if (doLogger)
|
if (doLogger)
|
||||||
_PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, "<<<", PKIX_LOGGER_LEVEL_TRACE);
|
_PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, "<<<", PKIX_LOGGER_LEVEL_TRACE);
|
||||||
@ -74,7 +74,7 @@ PKIX_DoReturn(PKIX_StdVars * stdVars, PKIX_ERRORNUM errorCode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PKIX_Error *
|
PKIX_Error *
|
||||||
PKIX_DoCheck(PKIX_StdVars * stdVars, int descNum, void *plContext)
|
PKIX_DoCheck(PKIX_StdVars * stdVars, PKIX_ERRSTRINGNUM descNum, void *plContext)
|
||||||
{
|
{
|
||||||
pkixTempResult =
|
pkixTempResult =
|
||||||
PKIX_Error_GetErrorCode(pkixErrorResult, &pkixErrorCode, plContext);
|
PKIX_Error_GetErrorCode(pkixErrorResult, &pkixErrorCode, plContext);
|
||||||
|
|||||||
@ -161,17 +161,12 @@ PKIX_Error *
|
|||||||
pkix_Throw(
|
pkix_Throw(
|
||||||
PKIX_UInt32 errorCode,
|
PKIX_UInt32 errorCode,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
const char *errorText,
|
PKIX_ERRSTRINGNUM errorTextCode,
|
||||||
PKIX_Error *cause,
|
PKIX_Error *cause,
|
||||||
PKIX_Error **pError,
|
PKIX_Error **pError,
|
||||||
void *plContext)
|
void *plContext)
|
||||||
{
|
{
|
||||||
PKIX_PL_String *formatString = NULL;
|
|
||||||
PKIX_PL_String *funcNameString = NULL;
|
|
||||||
PKIX_PL_String *textString = NULL;
|
|
||||||
PKIX_PL_String *errorString = NULL;
|
|
||||||
PKIX_UInt32 causeCode;
|
PKIX_UInt32 causeCode;
|
||||||
char *format = NULL;
|
|
||||||
|
|
||||||
PKIX_ENTER(ERROR, "pkix_Throw");
|
PKIX_ENTER(ERROR, "pkix_Throw");
|
||||||
PKIX_NULLCHECK_TWO(funcName, pError);
|
PKIX_NULLCHECK_TWO(funcName, pError);
|
||||||
@ -190,44 +185,11 @@ pkix_Throw(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
format = "%s: %s";
|
pkixTempResult = PKIX_Error_Create(errorCode, cause, NULL,
|
||||||
|
errorTextCode, pError, plContext);
|
||||||
pkixTempResult = PKIX_PL_String_Create
|
|
||||||
(PKIX_ESCASCII, (void *)format, 0, &formatString, plContext);
|
|
||||||
if (pkixTempResult) goto cleanup;
|
|
||||||
|
|
||||||
pkixTempResult = PKIX_PL_String_Create
|
|
||||||
(PKIX_ESCASCII,
|
|
||||||
(void *)funcName,
|
|
||||||
0,
|
|
||||||
&funcNameString,
|
|
||||||
plContext);
|
|
||||||
if (pkixTempResult) goto cleanup;
|
|
||||||
|
|
||||||
pkixTempResult = PKIX_PL_String_Create
|
|
||||||
(PKIX_ESCASCII,
|
|
||||||
(void *)errorText,
|
|
||||||
0,
|
|
||||||
&textString,
|
|
||||||
plContext);
|
|
||||||
if (pkixTempResult) goto cleanup;
|
|
||||||
|
|
||||||
pkixTempResult = PKIX_PL_Sprintf
|
|
||||||
(&errorString,
|
|
||||||
plContext,
|
|
||||||
formatString,
|
|
||||||
funcNameString,
|
|
||||||
textString);
|
|
||||||
|
|
||||||
pkixTempResult = PKIX_Error_Create
|
|
||||||
(errorCode, cause, NULL, errorString, pError, plContext);
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
PKIX_DECREF(errorString);
|
|
||||||
PKIX_DECREF(formatString);
|
|
||||||
PKIX_DECREF(funcNameString);
|
|
||||||
PKIX_DECREF(textString);
|
|
||||||
PKIX_DEBUG_EXIT(ERROR);
|
PKIX_DEBUG_EXIT(ERROR);
|
||||||
pkixErrorCode = 0;
|
pkixErrorCode = 0;
|
||||||
return (pkixTempResult);
|
return (pkixTempResult);
|
||||||
|
|||||||
@ -132,10 +132,12 @@ extern PKIX_Error * PKIX_DoReturn(PKIX_StdVars * stdVars,
|
|||||||
|
|
||||||
extern PKIX_Error * PKIX_DoThrow(PKIX_StdVars * stdVars,
|
extern PKIX_Error * PKIX_DoThrow(PKIX_StdVars * stdVars,
|
||||||
PKIX_ERRORNUM errorCode,
|
PKIX_ERRORNUM errorCode,
|
||||||
const char * desc, void * plContext);
|
PKIX_ERRSTRINGNUM descNum,
|
||||||
|
void * plContext);
|
||||||
|
|
||||||
extern PKIX_Error * PKIX_DoCheck(PKIX_StdVars * stdVars,
|
extern PKIX_Error * PKIX_DoCheck(PKIX_StdVars * stdVars,
|
||||||
int descNum, void * plContext);
|
PKIX_ERRSTRINGNUM descNum,
|
||||||
|
void * plContext);
|
||||||
|
|
||||||
extern const PKIX_StdVars zeroStdVars;
|
extern const PKIX_StdVars zeroStdVars;
|
||||||
|
|
||||||
@ -233,10 +235,10 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#if defined(DEBUG) && !defined(DEBUG_nb95248)
|
#if defined(DEBUG) && !defined(DEBUG_nb95248)
|
||||||
#define PKIX_THROW(type, desc) \
|
#define PKIX_THROW(type, descNum) \
|
||||||
{ \
|
{ \
|
||||||
pkixTempResult = (PKIX_Error*)pkix_Throw \
|
pkixTempResult = (PKIX_Error*)pkix_Throw \
|
||||||
(PKIX_ ## type ## _ERROR, myFuncName, desc, \
|
(PKIX_ ## type ## _ERROR, myFuncName, descNum, \
|
||||||
pkixErrorResult, &pkixReturnResult, plContext); \
|
pkixErrorResult, &pkixReturnResult, plContext); \
|
||||||
if (pkixErrorResult != PKIX_ALLOC_ERROR()) \
|
if (pkixErrorResult != PKIX_ALLOC_ERROR()) \
|
||||||
PKIX_DECREF(pkixErrorResult); \
|
PKIX_DECREF(pkixErrorResult); \
|
||||||
@ -245,8 +247,8 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
return pkixReturnResult; \
|
return pkixReturnResult; \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define PKIX_THROW(type, desc) \
|
#define PKIX_THROW(type, descNum) \
|
||||||
return PKIX_DoThrow(&stdVars, (PKIX_ ## type ## _ERROR), desc, plContext);
|
return PKIX_DoThrow(&stdVars, (PKIX_ ## type ## _ERROR), descNum, plContext);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
PKIX_OBJECT_UNLOCK(lockedObject); \
|
PKIX_OBJECT_UNLOCK(lockedObject); \
|
||||||
PKIX_MUTEX_UNLOCK(lockedMutex); \
|
PKIX_MUTEX_UNLOCK(lockedMutex); \
|
||||||
if ((pkixErrorReceived) || (pkixErrorResult)) \
|
if ((pkixErrorReceived) || (pkixErrorResult)) \
|
||||||
PKIX_THROW(type, pkixErrorMsg); \
|
PKIX_THROW(type, pkixErrMsgNum); \
|
||||||
PKIX_DEBUG_EXIT(type); \
|
PKIX_DEBUG_EXIT(type); \
|
||||||
_PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, "<<<", PKIX_LOGGER_LEVEL_TRACE); \
|
_PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, "<<<", PKIX_LOGGER_LEVEL_TRACE); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
@ -272,7 +274,7 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
PKIX_OBJECT_UNLOCK(lockedObject); \
|
PKIX_OBJECT_UNLOCK(lockedObject); \
|
||||||
PKIX_MUTEX_UNLOCK(lockedMutex); \
|
PKIX_MUTEX_UNLOCK(lockedMutex); \
|
||||||
if ((pkixErrorReceived) || (pkixErrorResult)) \
|
if ((pkixErrorReceived) || (pkixErrorResult)) \
|
||||||
PKIX_THROW(type, pkixErrorMsg); \
|
PKIX_THROW(type, pkixErrMsgNum); \
|
||||||
PKIX_DEBUG_EXIT(type); \
|
PKIX_DEBUG_EXIT(type); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
}
|
}
|
||||||
@ -292,6 +294,7 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
(pkixErrorResult, &pkixErrorCode, plContext); \
|
(pkixErrorResult, &pkixErrorCode, plContext); \
|
||||||
if (pkixTempResult) \
|
if (pkixTempResult) \
|
||||||
return pkixTempResult; \
|
return pkixTempResult; \
|
||||||
|
pkixErrMsgNum = descNum; \
|
||||||
pkixErrorMsg = PKIX_ErrorText[descNum]; \
|
pkixErrorMsg = PKIX_ErrorText[descNum]; \
|
||||||
if (pkixErrorCode == PKIX_FATAL_ERROR) \
|
if (pkixErrorCode == PKIX_FATAL_ERROR) \
|
||||||
PKIX_RETURN(FATAL); \
|
PKIX_RETURN(FATAL); \
|
||||||
@ -322,6 +325,7 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
if (pkixTempResult) \
|
if (pkixTempResult) \
|
||||||
return pkixTempResult; \
|
return pkixTempResult; \
|
||||||
if (pkixErrorCode == PKIX_FATAL_ERROR){ \
|
if (pkixErrorCode == PKIX_FATAL_ERROR){ \
|
||||||
|
pkixErrMsgNum = descNum; \
|
||||||
pkixErrorMsg = PKIX_ErrorText[descNum]; \
|
pkixErrorMsg = PKIX_ErrorText[descNum]; \
|
||||||
PKIX_RETURN(FATAL); \
|
PKIX_RETURN(FATAL); \
|
||||||
} \
|
} \
|
||||||
@ -336,6 +340,7 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
{ \
|
{ \
|
||||||
PKIX_LOG_ERROR(descNum) \
|
PKIX_LOG_ERROR(descNum) \
|
||||||
pkixErrorReceived = PKIX_TRUE; \
|
pkixErrorReceived = PKIX_TRUE; \
|
||||||
|
pkixErrMsgNum = descNum; \
|
||||||
pkixErrorMsg = PKIX_ErrorText[descNum]; \
|
pkixErrorMsg = PKIX_ErrorText[descNum]; \
|
||||||
goto cleanup; \
|
goto cleanup; \
|
||||||
}
|
}
|
||||||
@ -408,7 +413,7 @@ extern const PKIX_StdVars zeroStdVars;
|
|||||||
{ \
|
{ \
|
||||||
pkixTempResult = (PKIX_Error*)pkix_Throw \
|
pkixTempResult = (PKIX_Error*)pkix_Throw \
|
||||||
(PKIX_ ## type ## _ERROR, myFuncName, \
|
(PKIX_ ## type ## _ERROR, myFuncName, \
|
||||||
PKIX_ErrorText[descNum], NULL, &error, plContext); \
|
descNum, NULL, &error, plContext); \
|
||||||
if (pkixTempResult) \
|
if (pkixTempResult) \
|
||||||
error = pkixTempResult; \
|
error = pkixTempResult; \
|
||||||
}
|
}
|
||||||
@ -1385,7 +1390,7 @@ PKIX_Error *
|
|||||||
pkix_Throw(
|
pkix_Throw(
|
||||||
PKIX_UInt32 code,
|
PKIX_UInt32 code,
|
||||||
const char *funcName,
|
const char *funcName,
|
||||||
const char *errorText,
|
PKIX_ERRSTRINGNUM errorTextCode,
|
||||||
PKIX_Error *cause,
|
PKIX_Error *cause,
|
||||||
PKIX_Error **pError,
|
PKIX_Error **pError,
|
||||||
void *plContext);
|
void *plContext);
|
||||||
|
|||||||
@ -55,30 +55,6 @@ PRLock *classTableLock;
|
|||||||
* IncRef, DecRef, and Settor functions cannot be called.
|
* IncRef, DecRef, and Settor functions cannot be called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This data looks like a UTF-16 string of "PKIX_ALLOC_ERROR".
|
|
||||||
* It is used to create a static PKIX_PL_String object, pkix_Alloc_Error_desc.
|
|
||||||
*/
|
|
||||||
static const char pkix_Alloc_Error_Msg[32] =
|
|
||||||
{
|
|
||||||
0, 'P', 0, 'K', 0, 'I', 0, 'X',
|
|
||||||
0, ' ',
|
|
||||||
0, 'A', 0, 'L', 0, 'L', 0, 'O', 0, 'C',
|
|
||||||
0, ' ',
|
|
||||||
0, 'E', 0, 'R', 0, 'R', 0, 'O', 0, 'R'
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is raw data laid out to look like a PKIX_PL_String in memory
|
|
||||||
* XXX If PKIX_PL_StringStruct is changed, this will break.
|
|
||||||
*/
|
|
||||||
static PKIX_PL_String pkix_Alloc_Error_Desc = {
|
|
||||||
(void *)&pkix_Alloc_Error_Msg, /* void *utf16String */
|
|
||||||
(PKIX_UInt32)32, /* PKIX_UInt32 utf16Length */
|
|
||||||
(char *)NULL, /* char *escAsciiString */
|
|
||||||
(PKIX_UInt32)0 /* PKIX_UInt32 escAsciiLength */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Keep this structure definition here for its is used only once here */
|
/* Keep this structure definition here for its is used only once here */
|
||||||
struct PKIX_Alloc_Error_ObjectStruct {
|
struct PKIX_Alloc_Error_ObjectStruct {
|
||||||
PKIX_PL_Object header;
|
PKIX_PL_Object header;
|
||||||
@ -97,10 +73,10 @@ static PKIX_Alloc_Error_Object pkix_Alloc_Error_Data = {
|
|||||||
(PKIX_UInt32)0, /* PKIX_UInt32 hashcode */
|
(PKIX_UInt32)0, /* PKIX_UInt32 hashcode */
|
||||||
(PKIX_Boolean)PKIX_FALSE, /* PKIX_Boolean hashcodeCached */
|
(PKIX_Boolean)PKIX_FALSE, /* PKIX_Boolean hashcodeCached */
|
||||||
}, {
|
}, {
|
||||||
PKIX_FATAL_ERROR, /* PKIX_UInt32 code */
|
(PKIX_ERRORNUM)PKIX_FATAL_ERROR,/* PKIX_UInt32 code */
|
||||||
(PKIX_Error *)0, /* PKIX_Error *cause */
|
(PKIX_Error *)0, /* PKIX_Error *cause */
|
||||||
(PKIX_PL_Object *)0, /* PKIX_PL_Object *info */
|
(PKIX_PL_Object *)0, /* PKIX_PL_Object *info */
|
||||||
&pkix_Alloc_Error_Desc /* PKIX_PL_String *desc */
|
(PKIX_ERRSTRINGNUM)0, /* PKIX_ERRSTRINGNUM descCode; */
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
static PKIX_UInt32 refCountTotal = 0;
|
static PKIX_UInt32 refCountTotal = 0;
|
||||||
|
|
||||||
|
|
||||||
/* --Class-Table-Initializers------------------------------------ */
|
/* --Class-Table-Initializers------------------------------------ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -765,9 +766,7 @@ PKIX_PL_Object_IncRef(
|
|||||||
PKIX_ERRORUNLOCKINGOBJECT);
|
PKIX_ERRORUNLOCKINGOBJECT);
|
||||||
|
|
||||||
if (refCountError) {
|
if (refCountError) {
|
||||||
PKIX_THROW
|
PKIX_THROW(FATAL, PKIX_OBJECTWITHNONPOSITIVEREFERENCES);
|
||||||
(FATAL,
|
|
||||||
PKIX_ErrorText[PKIX_OBJECTWITHNONPOSITIVEREFERENCES]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user