Fixed issue with no_server/no_client optional compile losing two functions

This commit is contained in:
John Safranek 2013-06-06 21:59:05 +02:00
parent 33a7d7481d
commit b40c2c0b1f
2 changed files with 51 additions and 37 deletions

View File

@ -6619,6 +6619,36 @@ int SetCipherList(Suites* s, const char* list)
}
static void PickHashSigAlgo(CYASSL* ssl,
const byte* hashSigAlgo, word32 hashSigAlgoSz)
{
word32 i;
ssl->suites->sigAlgo = ssl->specs.sig_algo;
ssl->suites->hashAlgo = sha_mac;
for (i = 0; i < hashSigAlgoSz; i += 2) {
if (hashSigAlgo[i+1] == ssl->specs.sig_algo) {
if (hashSigAlgo[i] == sha_mac) {
break;
}
#ifndef NO_SHA256
else if (hashSigAlgo[i] == sha256_mac) {
ssl->suites->hashAlgo = sha256_mac;
break;
}
#endif
#ifdef CYASSL_SHA384
else if (hashSigAlgo[i] == sha384_mac) {
ssl->suites->hashAlgo = sha384_mac;
break;
}
#endif
}
}
}
#ifdef CYASSL_CALLBACKS
/* Initialisze HandShakeInfo */
@ -9082,36 +9112,6 @@ int SetCipherList(Suites* s, const char* list)
}
static void PickHashSigAlgo(CYASSL* ssl,
const byte* hashSigAlgo, word32 hashSigAlgoSz)
{
word32 i;
ssl->suites->sigAlgo = ssl->specs.sig_algo;
ssl->suites->hashAlgo = sha_mac;
for (i = 0; i < hashSigAlgoSz; i += 2) {
if (hashSigAlgo[i+1] == ssl->specs.sig_algo) {
if (hashSigAlgo[i] == sha_mac) {
break;
}
#ifndef NO_SHA256
else if (hashSigAlgo[i] == sha256_mac) {
ssl->suites->hashAlgo = sha256_mac;
break;
}
#endif
#ifdef CYASSL_SHA384
else if (hashSigAlgo[i] == sha384_mac) {
ssl->suites->hashAlgo = sha384_mac;
break;
}
#endif
}
}
}
static int MatchSuite(CYASSL* ssl, Suites* peerSuites)
{
word16 i, j;

View File

@ -2032,6 +2032,26 @@ int CyaSSL_CertManagerVerify(CYASSL_CERT_MANAGER* cm, const char* fname,
}
static INLINE CYASSL_METHOD* cm_pick_method(void)
{
#ifndef NO_CYASSL_CLIENT
#ifdef NO_OLD_TLS
return CyaTLSv1_2_client_method();
#else
return CyaSSLv3_client_method();
#endif
#elif !defined(NO_CYASSL_SERVER)
#ifdef NO_OLD_TLS
return CyaTLSv1_2_server_method();
#else
return CyaSSLv3_server_method();
#endif
#else
return NULL;
#endif
}
/* like load verify locations, 1 for success, < 0 for error */
int CyaSSL_CertManagerLoadCA(CYASSL_CERT_MANAGER* cm, const char* file,
const char* path)
@ -2045,13 +2065,7 @@ int CyaSSL_CertManagerLoadCA(CYASSL_CERT_MANAGER* cm, const char* file,
CYASSL_MSG("No CertManager error");
return ret;
}
tmp = CyaSSL_CTX_new(
#ifdef NO_OLD_TLS
CyaTLSv1_2_client_method()
#else
CyaSSLv3_client_method()
#endif
);
tmp = CyaSSL_CTX_new(cm_pick_method());
if (tmp == NULL) {
CYASSL_MSG("CTX new failed");