forked from wolfSSL/wolfssl
Adds support to session IDs of size 1 to 31 bytes.
Only session IDs of size 0 or 32 bytes was allowed before, now the session ID size may be from 0 to 32 bytes. A size of zero bytes means that is no session ID provided by the server.
This commit is contained in:
@@ -9079,19 +9079,20 @@ static void PickHashSigAlgo(CYASSL* ssl,
|
|||||||
/* session id */
|
/* session id */
|
||||||
b = input[i++];
|
b = input[i++];
|
||||||
|
|
||||||
if (b == ID_LEN) {
|
if (b > ID_LEN) {
|
||||||
if ((i - begin) + ID_LEN > helloSz)
|
CYASSL_MSG("Invalid session ID size");
|
||||||
return BUFFER_ERROR;
|
return BUFFER_ERROR;
|
||||||
|
|
||||||
XMEMCPY(ssl->arrays->sessionID, input + i, min(b, ID_LEN));
|
|
||||||
i += ID_LEN;
|
|
||||||
ssl->options.haveSessionId = 1;
|
|
||||||
}
|
}
|
||||||
else if (b) {
|
else if (b) {
|
||||||
CYASSL_MSG("Invalid session ID size");
|
if ((i - begin) + b > helloSz)
|
||||||
return BUFFER_ERROR; /* session ID nor 0 neither 32 bytes long */
|
return BUFFER_ERROR;
|
||||||
|
|
||||||
|
XMEMCPY(ssl->arrays->sessionID, input + i, b);
|
||||||
|
i += b;
|
||||||
|
ssl->options.haveSessionId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* suite and compression */
|
/* suite and compression */
|
||||||
if ((i - begin) + OPAQUE16_LEN + OPAQUE8_LEN > helloSz)
|
if ((i - begin) + OPAQUE16_LEN + OPAQUE8_LEN > helloSz)
|
||||||
return BUFFER_ERROR;
|
return BUFFER_ERROR;
|
||||||
|
Reference in New Issue
Block a user