forked from wolfSSL/wolfssl
tls sanity check
This commit is contained in:
12
src/tls.c
12
src/tls.c
@@ -33,6 +33,16 @@
|
|||||||
#ifndef NO_TLS
|
#ifndef NO_TLS
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef min
|
||||||
|
|
||||||
|
static INLINE word32 min(word32 a, word32 b)
|
||||||
|
{
|
||||||
|
return a > b ? b : a;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* min */
|
||||||
|
|
||||||
|
|
||||||
/* calculate XOR for TLSv1 PRF */
|
/* calculate XOR for TLSv1 PRF */
|
||||||
static INLINE void get_xor(byte *digest, word32 digLen, byte* md5, byte* sha)
|
static INLINE void get_xor(byte *digest, word32 digLen, byte* md5, byte* sha)
|
||||||
{
|
{
|
||||||
@@ -74,7 +84,7 @@ static void p_hash(byte* result, word32 resLen, const byte* secret,
|
|||||||
HmacFinal(&hmac, current);
|
HmacFinal(&hmac, current);
|
||||||
|
|
||||||
if ( (i == lastTime) && lastLen)
|
if ( (i == lastTime) && lastLen)
|
||||||
XMEMCPY(&result[idx], current, lastLen);
|
XMEMCPY(&result[idx], current, min(lastLen, sizeof(current)));
|
||||||
else {
|
else {
|
||||||
XMEMCPY(&result[idx], current, len);
|
XMEMCPY(&result[idx], current, len);
|
||||||
idx += len;
|
idx += len;
|
||||||
|
Reference in New Issue
Block a user