merge conflict

This commit is contained in:
toddouska
2012-04-26 15:01:00 -07:00
12 changed files with 160 additions and 22 deletions

View File

@@ -724,10 +724,25 @@ static const word32 Td[5][256] = {
#ifdef CYASSL_AESNI
#define cpuid(func,ax,bx,cx,dx)\
#ifndef _MSC_VER
#define cpuid(func,ax,bx,cx,dx)\
__asm__ __volatile__ ("cpuid":\
"=a" (ax), "=b" (bx), "=c" (cx), "=d" (dx) : "a" (func));
#else
#define cpuid(func,ax,bx,cx,dx)\
__asm mov eax, func \
__asm cpuid \
__asm mov ax, eax \
__asm mov bx, ebx \
__asm mov cx, ecx \
__asm mov dx, edx
#endif /* _MSC_VER */
static int Check_CPU_support_AES()
{
unsigned int a,b,c,d;

View File

@@ -1016,6 +1016,8 @@ void InitDecodedCert(DecodedCert* cert, byte* source, word32 inSz, void* heap)
cert->signature = 0;
cert->subjectCN = 0;
cert->subjectCNLen = 0;
cert->issuer[0] = '\0';
cert->subject[0] = '\0';
cert->source = source; /* don't own */
cert->srcIdx = 0;
cert->maxIdx = inSz; /* can't go over this index */
@@ -2412,6 +2414,10 @@ void CTaoCryptErrorString(int error, char* buffer)
XSTRNCPY(buffer, "No password provided by user", max);
break;
case ALT_NAME_E :
XSTRNCPY(buffer, "Alt Name problem, too big", max);
break;
default:
XSTRNCPY(buffer, "unknown error number", max);
@@ -2601,7 +2607,9 @@ void InitCert(Cert* cert)
cert->selfSigned = 1;
cert->isCA = 0;
cert->bodySz = 0;
#ifdef CYASSL_ALT_NAMES
cert->altNamesSz = 0;
#endif
cert->keyType = RSA_KEY;
XMEMSET(cert->serial, 0, CTC_SERIAL_SIZE);
@@ -3149,12 +3157,14 @@ static int EncodeCert(Cert* cert, DerCert* der, RsaKey* rsaKey, RNG* rng,
else
der->extensionsSz = 0;
#ifdef CYASSL_ALT_NAMES
if (der->extensionsSz == 0 && cert->altNamesSz) {
der->extensionsSz = SetExtensions(der->extensions, cert->altNames,
cert->altNamesSz);
if (der->extensionsSz == 0)
return EXTENSIONS_E;
}
#endif
der->total = der->versionSz + der->serialSz + der->sigAlgoSz +
der->publicKeySz + der->validitySz + der->subjectSz + der->issuerSz +
@@ -3340,6 +3350,8 @@ int MakeSelfCert(Cert* cert, byte* buffer, word32 buffSz, RsaKey* key, RNG* rng)
}
#ifdef CYASSL_ALT_NAMES
/* Set Alt Names from der cert, return 0 on success */
static int SetAltNamesFromCert(Cert* cert, const byte* der, int derSz)
{
@@ -3410,6 +3422,8 @@ static int SetAltNamesFromCert(Cert* cert, const byte* der, int derSz)
else {
cert->altNamesSz = 0;
CYASSL_MSG("AltNames extensions too big");
FreeDecodedCert(&decoded);
return ALT_NAME_E;
}
}
decoded.srcIdx = tmpIdx + length;
@@ -3420,6 +3434,8 @@ static int SetAltNamesFromCert(Cert* cert, const byte* der, int derSz)
return 0;
}
#endif /* CYASSL_ALT_NAMES */
/* Set cn name from der buffer, return 0 on success */
static int SetNameFromCert(CertName* cn, const byte* der, int derSz)
@@ -3518,6 +3534,8 @@ int SetSubject(Cert* cert, const char* subjectFile)
}
#ifdef CYASSL_ALT_NAMES
/* Set atl names from file in PEM */
int SetAltNames(Cert* cert, const char* file)
{
@@ -3527,6 +3545,8 @@ int SetAltNames(Cert* cert, const char* file)
return SetAltNamesFromCert(cert, der, derSz);
}
#endif /* CYASSL_ALT_NAMES */
#endif /* NO_FILESYSTEM */
/* Set cert issuer from DER buffer */
@@ -3544,12 +3564,15 @@ int SetSubjectBuffer(Cert* cert, const byte* der, int derSz)
}
#ifdef CYASSL_ALT_NAMES
/* Set cert alt names from DER buffer */
int SetAltNamesBuffer(Cert* cert, const byte* der, int derSz)
{
return SetAltNamesFromCert(cert, der, derSz);
}
#endif /* CYASSL_ALT_NAMES */
#endif /* CYASSL_CERT_GEN */