Additional fix for 476979 - Add cert chain tests that will do cert validation for different ku/eku. r=nelson

git-svn-id: svn://10.0.0.236/trunk@256250 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alexei.volkov.bugs%sun.com
2009-02-19 04:24:41 +00:00
parent 6dda5e9ed5
commit 50a4bce1f9
2 changed files with 20 additions and 32 deletions

View File

@@ -44,6 +44,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#if defined(WIN32)
#include "fcntl.h"
@@ -361,17 +362,14 @@ AddKeyUsage (void *extHandle, const char *userSuppliedValue)
buffer, sizeof(buffer)) == SECFailure) {
return SECFailure;
}
errno = 0;
value = PORT_Atoi (buffer);
if (errno) {
/* can not parse user input */
continue;
}
if (value < 0 || value > 6)
break;
if (value == 0) {
/* Checking that zero value of variable 'value'
* corresponds to '0' input made by user */
char *chPtr = strchr(buffer, '0');
if (chPtr == NULL) {
continue;
}
}
keyUsage |= (0x80 >> value);
}
isCriticalExt = GetYesNo("Is this a critical extension [y/N]?");
@@ -548,15 +546,11 @@ AddExtKeyUsage (void *extHandle, const char *userSuppliedValue)
buffer, sizeof(buffer)) == SECFailure) {
GEN_BREAK(SECFailure);
}
errno = 0;
value = PORT_Atoi(buffer);
if (value == 0) {
/* Checking that zero value of variable 'value'
* corresponds to '0' input made by user */
char *chPtr = strchr(buffer, '0');
if (chPtr == NULL) {
continue;
}
if (errno) {
/* can not parse user input */
continue;
}
} else {
if (parseNextCmdInput(extKeyUsageKeyWordArray, &value, &nextPos,
@@ -648,17 +642,14 @@ AddNscpCertType (void *extHandle, const char *userSuppliedValue)
buffer, sizeof(buffer)) == SECFailure) {
return SECFailure;
}
errno = 0;
value = PORT_Atoi (buffer);
if (errno) {
/* can not parse user input */
continue;
}
if (value < 0 || value > 7)
break;
if (value == 0) {
/* Checking that zero value of variable 'value'
* corresponds to '0' input made by user */
char *chPtr = strchr(buffer, '0');
if (chPtr == NULL) {
continue;
}
}
keyUsage |= (0x80 >> value);
}
isCriticalExt = GetYesNo("Is this a critical extension [y/N]?");
@@ -962,14 +953,11 @@ AddCrlDistPoint(void *extHandle)
buffer, sizeof(buffer)) == SECFailure) {
GEN_BREAK(SECFailure);
}
errno = 0;
intValue = PORT_Atoi (buffer);
if (intValue == 0) {
/* Checking that zero value of variable 'value'
* corresponds to '0' input made by user */
char *chPtr = strchr(buffer, '0');
if (chPtr == NULL) {
intValue = -1;
}
if (errno) {
/* can not parse user input. setting to -1 */
intValue = -1;
}
if (intValue >= 0 && intValue <8) {
current->reasons.data = PORT_ArenaAlloc (arena, sizeof(char));

View File

@@ -604,12 +604,12 @@ CERTUTIL_GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size,
pwdata /*wincx*/);
/* free up the params */
switch (keytype) {
case rsaKey: /* nothing to free */ break;
case dsaKey: if (dsaparams) CERTUTIL_DestroyParamsPQG(dsaparams);
break;
#ifdef NSS_ENABLE_ECC
case ecKey: SECITEM_FreeItem((SECItem *)params, PR_TRUE); break;
#endif
default: /* nothing to free */ break;
}
return privKey;
}