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:
@@ -1806,7 +1806,7 @@ int InitSSL(CYASSL* ssl, CYASSL_CTX* ctx)
|
|||||||
|
|
||||||
/* arrays */
|
/* arrays */
|
||||||
ssl->arrays = (Arrays*)XMALLOC(sizeof(Arrays), ssl->heap,
|
ssl->arrays = (Arrays*)XMALLOC(sizeof(Arrays), ssl->heap,
|
||||||
DYNAMIC_TYPE_ARRAYS);
|
DYNAMIC_TYPE_ARRAYS);
|
||||||
if (ssl->arrays == NULL) {
|
if (ssl->arrays == NULL) {
|
||||||
CYASSL_MSG("Arrays Memory error");
|
CYASSL_MSG("Arrays Memory error");
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
@@ -9079,18 +9079,19 @@ 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)
|
||||||
|
Reference in New Issue
Block a user