Merge branch 'master' of github.com:cyassl/cyassl

This commit is contained in:
John Safranek 2013-03-04 17:16:32 -08:00
commit 49e67487e7
4 changed files with 15 additions and 35 deletions

View File

@ -104,16 +104,18 @@ int Base64_Decode(const byte* in, word32 inLen, byte* out, word32* outLen)
break; break;
inLen -= 4; inLen -= 4;
if (in[j] == ' ' || in[j] == '\r' || in[j] == '\n') { if (inLen && (in[j] == ' ' || in[j] == '\r' || in[j] == '\n')) {
byte endLine = in[j++]; byte endLine = in[j++];
inLen--; inLen--;
while (endLine == ' ') { /* allow trailing whitespace */ while (inLen && endLine == ' ') { /* allow trailing whitespace */
endLine = in[j++]; endLine = in[j++];
inLen--; inLen--;
} }
if (endLine == '\r') { if (endLine == '\r') {
endLine = in[j++]; if (inLen) {
inLen--; endLine = in[j++];
inLen--;
}
} }
if (endLine != '\n') { if (endLine != '\n') {
CYASSL_MSG("Bad end of line in Base64 Decode"); CYASSL_MSG("Bad end of line in Base64 Decode");

View File

@ -107,7 +107,7 @@ enum {
}; };
CYASSL_API void CTaoCryptErrorString(int error, char* buffer); CYASSL_API void CTaoCryptErrorString(int err, char* buff);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -130,7 +130,7 @@ enum CyaSSL_ErrorCodes {
CYASSL_LOCAL CYASSL_LOCAL
void SetErrorString(int error, char* buffer); void SetErrorString(int err, char* buff);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -2559,23 +2559,12 @@ static void BuildFinished(CYASSL* ssl, Hashes* hashes, const byte* sender)
#endif #endif
Sha sha = ssl->hashSha; Sha sha = ssl->hashSha;
#ifndef NO_SHA256 #ifndef NO_SHA256
Sha256 sha256; Sha256 sha256 = ssl->hashSha256;
#endif #endif
#ifdef CYASSL_SHA384 #ifdef CYASSL_SHA384
Sha384 sha384; Sha384 sha384 = ssl->hashSha384;
#endif #endif
if (IsAtLeastTLSv1_2(ssl)) {
#ifndef NO_SHA256
InitSha256(&sha256);
sha256 = ssl->hashSha256;
#endif
#ifdef CYASSL_SHA384
InitSha384(&sha384);
sha384 = ssl->hashSha384;
#endif
}
if (ssl->options.tls) if (ssl->options.tls)
BuildTlsFinished(ssl, hashes, sender); BuildTlsFinished(ssl, hashes, sender);
#ifndef NO_MD5 #ifndef NO_MD5
@ -2592,10 +2581,10 @@ static void BuildFinished(CYASSL* ssl, Hashes* hashes, const byte* sender)
ssl->hashSha = sha; ssl->hashSha = sha;
if (IsAtLeastTLSv1_2(ssl)) { if (IsAtLeastTLSv1_2(ssl)) {
#ifndef NO_SHA256 #ifndef NO_SHA256
ssl->hashSha256 = sha256; ssl->hashSha256 = sha256;
#endif #endif
#ifdef CYASSL_SHA384 #ifdef CYASSL_SHA384
ssl->hashSha384 = sha384; ssl->hashSha384 = sha384;
#endif #endif
} }
} }
@ -4591,23 +4580,12 @@ static void BuildCertHashes(CYASSL* ssl, Hashes* hashes)
Md5 md5 = ssl->hashMd5; Md5 md5 = ssl->hashMd5;
Sha sha = ssl->hashSha; Sha sha = ssl->hashSha;
#ifndef NO_SHA256 #ifndef NO_SHA256
Sha256 sha256; Sha256 sha256 = ssl->hashSha256;
#endif #endif
#ifdef CYASSL_SHA384 #ifdef CYASSL_SHA384
Sha384 sha384; Sha384 sha384 = ssl->hashSha384;
#endif #endif
if (IsAtLeastTLSv1_2(ssl)) {
#ifndef NO_SHA256
InitSha256(&sha256);
sha256 = ssl->hashSha256;
#endif
#ifdef CYASSL_SHA384
InitSha384(&sha384);
sha384 = ssl->hashSha384;
#endif
}
if (ssl->options.tls) { if (ssl->options.tls) {
Md5Final(&ssl->hashMd5, hashes->md5); Md5Final(&ssl->hashMd5, hashes->md5);
ShaFinal(&ssl->hashSha, hashes->sha); ShaFinal(&ssl->hashSha, hashes->sha);
@ -6211,7 +6189,7 @@ int SetCipherList(Suites* s, const char* list)
s->hashSigAlgo[idx++] = rsa_sa_algo; s->hashSigAlgo[idx++] = rsa_sa_algo;
} }
s->hashSigAlgoSz = idx; s->hashSigAlgoSz = (word16)idx;
} }
return ret; return ret;