fix ecc key load w/ no rsa, ssn5

This commit is contained in:
toddouska 2013-03-20 09:18:05 -07:00
parent 0f8111fc77
commit f878dbcef2
2 changed files with 15 additions and 7 deletions

View File

@ -1010,14 +1010,14 @@ void InitSuites(Suites* suites, ProtocolVersion pv, byte haveRSA, byte havePSK,
#endif
#ifdef BUILD_TLS_PSK_WITH_NULL_SHA256
if (tls & havePSK) {
if (tls && havePSK) {
suites->suites[idx++] = 0;
suites->suites[idx++] = TLS_PSK_WITH_NULL_SHA256;
}
#endif
#ifdef BUILD_TLS_PSK_WITH_NULL_SHA
if (tls & havePSK) {
if (tls && havePSK) {
suites->suites[idx++] = 0;
suites->suites[idx++] = TLS_PSK_WITH_NULL_SHA;
}
@ -1135,8 +1135,10 @@ void InitSuites(Suites* suites, ProtocolVersion pv, byte haveRSA, byte havePSK,
suites->hashSigAlgo[idx++] = sha256_mac;
suites->hashSigAlgo[idx++] = ecc_dsa_sa_algo;
#endif
suites->hashSigAlgo[idx++] = sha_mac;
suites->hashSigAlgo[idx++] = ecc_dsa_sa_algo;
#ifndef NO_SHA
suites->hashSigAlgo[idx++] = sha_mac;
suites->hashSigAlgo[idx++] = ecc_dsa_sa_algo;
#endif
}
if (haveRSAsig) {
@ -1148,8 +1150,10 @@ void InitSuites(Suites* suites, ProtocolVersion pv, byte haveRSA, byte havePSK,
suites->hashSigAlgo[idx++] = sha256_mac;
suites->hashSigAlgo[idx++] = rsa_sa_algo;
#endif
suites->hashSigAlgo[idx++] = sha_mac;
suites->hashSigAlgo[idx++] = rsa_sa_algo;
#ifndef NO_SHA
suites->hashSigAlgo[idx++] = sha_mac;
suites->hashSigAlgo[idx++] = rsa_sa_algo;
#endif
}
suites->hashSigAlgoSz = idx;

View File

@ -1178,6 +1178,7 @@ int CyaSSL_Init(void)
int ret;
int dynamicType = 0;
int eccKey = 0;
int rsaKey = 0;
void* heap = ctx ? ctx->heap : NULL;
info.set = 0;
@ -1416,12 +1417,14 @@ int CyaSSL_Init(void)
FreeRsaKey(&key);
return SSL_BAD_FILE;
}
} else {
rsaKey = 1;
}
FreeRsaKey(&key);
}
#endif
#ifdef HAVE_ECC
if (eccKey ) {
if (!rsaKey) {
/* make sure ECC key can be used */
word32 idx = 0;
ecc_key key;
@ -1432,6 +1435,7 @@ int CyaSSL_Init(void)
return SSL_BAD_FILE;
}
ecc_free(&key);
eccKey = 1;
ctx->haveStaticECC = 1;
if (ssl)
ssl->options.haveStaticECC = 1;