Skip to content

Commit f1508c9

Browse files
authored
Merge pull request #9930 from julek-wolfssl/fenrir/260903
Fenrir fixes
2 parents 7af6dec + afed9d4 commit f1508c9

10 files changed

Lines changed: 23 additions & 34 deletions

File tree

.github/workflows/ada.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@master
16+
- uses: actions/checkout@v4
1717

1818
- name: Install alire
1919
uses: alire-project/setup-alire@v5

.github/workflows/win-csharp-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727

2828
steps:
2929
- name: Pull wolfssl
30-
uses: actions/checkout@master
30+
uses: actions/checkout@v4
3131
with:
3232
repository: wolfssl/wolfssl
3333
path: wolfssl
@@ -41,7 +41,7 @@ jobs:
4141
echo $null >> wolfcrypt\src\wolfcrypt_last.c
4242
4343
- name: Add MSBuild to PATH
44-
uses: microsoft/setup-msbuild@v1
44+
uses: microsoft/setup-msbuild@v2
4545

4646
- name: Build
4747
working-directory: ${{env.GITHUB_WORKSPACE}}

Docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RUN mkdir /var/empty
4343
RUN cd /opt/sources && wget -q -O- https://roumenpetrov.info/secsh/src/pkixssh-15.1.tar.gz | tar xzf - && cd pkixssh-15.1 && ./configure --prefix=/opt/pkixssh/ --exec-prefix=/opt/pkixssh/ && make install
4444

4545
# Install udp/tcp-proxy
46-
RUN cd /opt/sources && git clone --depth=1 --single-branch --branch=main http://github.com/wolfssl/udp-proxy && cd udp-proxy && make && cp tcp_proxy udp_proxy /bin/.
46+
RUN cd /opt/sources && git clone --depth=1 --single-branch --branch=main https://github.com/wolfssl/udp-proxy && cd udp-proxy && make && cp tcp_proxy udp_proxy /bin/.
4747
# Install libbacktrace
4848
RUN cd /opt/sources && git clone --depth=1 --single-branch https://github.com/ianlancetaylor/libbacktrace.git && cd libbacktrace && mkdir build && cd build && ../configure && make && make install
4949

src/crl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ int CheckCertCRL_ex(WOLFSSL_CRL* crl, byte* issuerHash, byte* serial,
591591
if (cbRet == WC_NO_ERR_TRACE(WOLFSSL_CBIO_ERR_WANT_READ)) {
592592
ret = OCSP_WANT_READ;
593593
}
594-
else if (ret >= 0) {
594+
else if (cbRet >= 0) {
595595
/* try again */
596596
ret = CheckCertCRLList(crl, issuerHash, serial, serialSz,
597597
serialHash, &foundEntry);

src/quic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const QuicTransportParam* QuicTransportParam_new(const uint8_t* data,
228228
{
229229
QuicTransportParam* tp;
230230

231-
if (len > 65353) return NULL;
231+
if (len > 65535) return NULL;
232232
tp = (QuicTransportParam*)XMALLOC(sizeof(*tp), heap, DYNAMIC_TYPE_TLSX);
233233
if (!tp) return NULL;
234234
tp->data = (uint8_t*)XMALLOC(len, heap, DYNAMIC_TYPE_TLSX);

src/sniffer.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3478,7 +3478,7 @@ static int ProcessSessionTicket(const byte* input, int* sslBytes,
34783478
/* TLS v1.3 has hint age and nonce */
34793479
if (IsAtLeastTLSv1_3(ssl->version)) {
34803480
/* make sure can read through hint age and nonce len */
3481-
if (TICKET_HINT_AGE_LEN + 1 > *sslBytes) {
3481+
if (TICKET_HINT_AGE_LEN + OPAQUE8_LEN > *sslBytes) {
34823482
SetError(BAD_INPUT_STR, error, session, FATAL_ERROR_STATE);
34833483
return WOLFSSL_FATAL_ERROR;
34843484
}
@@ -3487,7 +3487,7 @@ static int ProcessSessionTicket(const byte* input, int* sslBytes,
34873487

34883488
/* ticket nonce */
34893489
len = input[0];
3490-
if (len > MAX_TICKET_NONCE_STATIC_SZ) {
3490+
if (len > MAX_TICKET_NONCE_STATIC_SZ || len + OPAQUE8_LEN > *sslBytes) {
34913491
SetError(BAD_INPUT_STR, error, session, FATAL_ERROR_STATE);
34923492
return WOLFSSL_FATAL_ERROR;
34933493
}
@@ -3847,6 +3847,11 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
38473847
case EXT_MAX_FRAGMENT_LENGTH:
38483848
{
38493849
word16 max_fragment = MAX_RECORD_SIZE;
3850+
if (extLen != 1) {
3851+
SetError(SERVER_HELLO_INPUT_STR, error, session,
3852+
FATAL_ERROR_STATE);
3853+
return WOLFSSL_FATAL_ERROR;
3854+
}
38503855
switch (input[0]) {
38513856
case WOLFSSL_MFL_2_8 : max_fragment = 256; break;
38523857
case WOLFSSL_MFL_2_9 : max_fragment = 512; break;
@@ -3862,6 +3867,11 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
38623867
}
38633868
#endif
38643869
case EXT_SUPPORTED_VERSIONS:
3870+
if (extLen != 2) {
3871+
SetError(SERVER_HELLO_INPUT_STR, error, session,
3872+
FATAL_ERROR_STATE);
3873+
return WOLFSSL_FATAL_ERROR;
3874+
}
38653875
session->sslServer->version.major = input[0];
38663876
session->sslServer->version.minor = input[1];
38673877
session->sslClient->version.major = input[0];

src/tls.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6173,24 +6173,6 @@ int TLSX_AddEmptyRenegotiationInfo(TLSX** extensions, void* heap)
61736173

61746174
#ifdef HAVE_SESSION_TICKET
61756175

6176-
#if defined(WOLFSSL_TLS13) || !defined(NO_WOLFSSL_CLIENT)
6177-
static void TLSX_SessionTicket_ValidateRequest(WOLFSSL* ssl)
6178-
{
6179-
TLSX* extension = TLSX_Find(ssl->extensions, TLSX_SESSION_TICKET);
6180-
SessionTicket* ticket = extension ?
6181-
(SessionTicket*)extension->data : NULL;
6182-
6183-
if (ticket) {
6184-
/* TODO validate ticket timeout here! */
6185-
if (ticket->lifetime == 0xfffffff) {
6186-
/* send empty ticket on timeout */
6187-
TLSX_UseSessionTicket(&ssl->extensions, NULL, ssl->heap);
6188-
}
6189-
}
6190-
}
6191-
#endif /* WOLFSSL_TLS13 || !NO_WOLFSSL_CLIENT */
6192-
6193-
61946176
static word16 TLSX_SessionTicket_GetSize(SessionTicket* ticket, int isRequest)
61956177
{
61966178
(void)isRequest;
@@ -6369,7 +6351,6 @@ int TLSX_UseSessionTicket(TLSX** extensions, SessionTicket* ticket, void* heap)
63696351
return WOLFSSL_SUCCESS;
63706352
}
63716353

6372-
#define WOLF_STK_VALIDATE_REQUEST TLSX_SessionTicket_ValidateRequest
63736354
#define WOLF_STK_GET_SIZE TLSX_SessionTicket_GetSize
63746355
#define WOLF_STK_WRITE TLSX_SessionTicket_Write
63756356
#define WOLF_STK_PARSE TLSX_SessionTicket_Parse
@@ -15402,7 +15383,6 @@ int TLSX_GetRequestSize(WOLFSSL* ssl, byte msgType, word32* pLength)
1540215383
if (msgType == client_hello) {
1540315384
EC_VALIDATE_REQUEST(ssl, semaphore);
1540415385
PF_VALIDATE_REQUEST(ssl, semaphore);
15405-
WOLF_STK_VALIDATE_REQUEST(ssl);
1540615386
#if !defined(NO_CERTS) && !defined(WOLFSSL_NO_SIGALG)
1540715387
if (WOLFSSL_SUITES(ssl)->hashSigAlgoSz == 0)
1540815388
TURN_ON(semaphore, TLSX_ToSemaphore(TLSX_SIGNATURE_ALGORITHMS));
@@ -15579,7 +15559,6 @@ int TLSX_WriteRequest(WOLFSSL* ssl, byte* output, byte msgType, word32* pOffset)
1557915559
if (msgType == client_hello) {
1558015560
EC_VALIDATE_REQUEST(ssl, semaphore);
1558115561
PF_VALIDATE_REQUEST(ssl, semaphore);
15582-
WOLF_STK_VALIDATE_REQUEST(ssl);
1558315562
#if !defined(NO_CERTS) && !defined(WOLFSSL_NO_SIGALG)
1558415563
if (WOLFSSL_SUITES(ssl)->hashSigAlgoSz == 0)
1558515564
TURN_ON(semaphore, TLSX_ToSemaphore(TLSX_SIGNATURE_ALGORITHMS));

src/tls13.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6869,11 +6869,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
68696869
#endif
68706870

68716871
sessIdSz = input[args->idx++];
6872-
#ifndef WOLFSSL_TLS13_MIDDLEBOX_COMPAT
68736872
if (sessIdSz > ID_LEN)
6874-
#else
6875-
if (sessIdSz != ID_LEN && sessIdSz != 0)
6876-
#endif
68776873
{
68786874
ERROR_OUT(INVALID_PARAMETER, exit_dch);
68796875
}

wolfcrypt/src/asn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9641,7 +9641,7 @@ int wc_GetKeyOID(byte* key, word32 keySz, const byte** curveOID, word32* oidSz,
96419641
WOLFSSL_MSG("Not Dilithium Level 5 DER key");
96429642
}
96439643
}
9644-
else {
9644+
if (*algoID == 0) {
96459645
WOLFSSL_MSG("GetKeyOID dilithium initialization failed");
96469646
}
96479647
wc_dilithium_free(dilithium);

wolfcrypt/src/chacha20_poly1305.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ int wc_ChaCha20Poly1305_Decrypt(
119119
if (ret == 0)
120120
ret = wc_ChaCha20Poly1305_CheckTag(inAuthTag, calculatedAuthTag);
121121

122+
if (ret != 0) {
123+
/* zero plaintext on error */
124+
ForceZero(outPlaintext, inCiphertextLen);
125+
}
122126
WC_FREE_VAR_EX(aead, NULL, DYNAMIC_TYPE_TMP_BUFFER);
123127

124128
return ret;

0 commit comments

Comments
 (0)