certs still use SHA hash for names

This commit is contained in:
John Safranek
2013-04-01 13:49:21 -07:00
parent 30553a43ed
commit 7004b2eafc

View File

@@ -1436,9 +1436,7 @@ static int GetKey(DecodedCert* cert)
/* process NAME, either issuer or subject */ /* process NAME, either issuer or subject */
static int GetName(DecodedCert* cert, int nameType) static int GetName(DecodedCert* cert, int nameType)
{ {
#ifndef NO_SHA Sha sha; /* MUST have SHA-1 hash for cert names */
Sha sha;
#endif
int length; /* length of all distinguished names */ int length; /* length of all distinguished names */
int dummy; int dummy;
char* full = (nameType == ISSUER) ? cert->issuer : cert->subject; char* full = (nameType == ISSUER) ? cert->issuer : cert->subject;
@@ -1463,14 +1461,12 @@ static int GetName(DecodedCert* cert, int nameType)
if (GetSequence(cert->source, &cert->srcIdx, &length, cert->maxIdx) < 0) if (GetSequence(cert->source, &cert->srcIdx, &length, cert->maxIdx) < 0)
return ASN_PARSE_E; return ASN_PARSE_E;
#ifndef NO_SHA
InitSha(&sha); InitSha(&sha);
ShaUpdate(&sha, &cert->source[idx], length + cert->srcIdx - idx); ShaUpdate(&sha, &cert->source[idx], length + cert->srcIdx - idx);
if (nameType == ISSUER) if (nameType == ISSUER)
ShaFinal(&sha, cert->issuerHash); ShaFinal(&sha, cert->issuerHash);
else else
ShaFinal(&sha, cert->subjectHash); ShaFinal(&sha, cert->subjectHash);
#endif
length += cert->srcIdx; length += cert->srcIdx;
idx = 0; idx = 0;