Skip to content

Commit

Permalink
Revert "quic_record_append: return correct code"
Browse files Browse the repository at this point in the history
This reverts commit bc12dad.

This commit broke builds that combine QUIC and PQ -- known failures are pq-all-valgrind-unittest, pq-hybrid-all-rpk, pq-hybrid-all-rpk-valgrind-unittest, quantum-safe-wolfssl-all-gcc-latest, quantum-safe-wolfssl-all-g++-latest, quantum-safe-wolfssl-all-fortify-source-asm, quantum-safe-wolfssl-all-fortify-source-asm-noasm, and quantum-safe-wolfssl-all-intelasm-sp-asm-valgrind.

Note that the unit.test asserts added by this commit fail both before and after reversion.
  • Loading branch information
douzzer committed Jan 10, 2025
1 parent 99a6e82 commit d4c6542
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
18 changes: 10 additions & 8 deletions src/quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,17 @@ static int quic_record_append(WOLFSSL *ssl, QuicRecord *qr, const uint8_t *data,
}
}

if (!quic_record_complete(qr) && len != 0) {
missing = qr->len - qr->end;
if (len > missing) {
len = missing;
}
XMEMCPY(qr->data + qr->end, data, len);
qr->end += (word32)len;
consumed += len;
if (quic_record_complete(qr) || len == 0) {
return 0;
}

missing = qr->len - qr->end;
if (len > missing) {
len = missing;
}
XMEMCPY(qr->data + qr->end, data, len);
qr->end += (word32)len;
consumed += len;

cleanup:
*pconsumed = (ret == WOLFSSL_SUCCESS) ? consumed : 0;
Expand Down
5 changes: 1 addition & 4 deletions tests/quic.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,7 @@ static int test_provide_quic_data(void) {
*/
AssertNotNull(ssl = wolfSSL_new(ctx));
len = fake_record(1, 100, lbuffer);
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer, 1, 0));
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer+1, 3, 0));
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer+4, len, 0)
);
AssertTrue(provide_data(ssl, wolfssl_encryption_initial, lbuffer, len, 0));
len = fake_record(2, 1523, lbuffer);
AssertTrue(provide_data(ssl, wolfssl_encryption_handshake, lbuffer, len, 0));
len = fake_record(2, 1, lbuffer);
Expand Down

0 comments on commit d4c6542

Please sign in to comment.