Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
julek-wolfssl committed Sep 19, 2024
1 parent 3f15db3 commit 08af07b
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -22187,37 +22187,17 @@ int ProcessReplyEx(WOLFSSL* ssl, int allowSocketErr)
ssl->options.processReply = runProcessingOneMessage;

if (IsEncryptionOn(ssl, 0)) {
/* XXX TODO Figure out what needs to be done about macsize here */
if (ssl->specs.bulk_cipher_algorithm != wolfssl_cipher_null) {
fprintf(stderr, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
exit(1);
/* With encryption on, we advance the index by the value
* of ssl->keys.padSz. Since padding only appears once, we
* only can do this at the end of record parsing. We have to
* reset the index to the start of the next message here. */
if (ssl->buffers.inputBuffer.idx >= ssl->keys.padSz) {
ssl->buffers.inputBuffer.idx -= ssl->keys.padSz;
}
WOLFSSL_MSG("Bundled encrypted messages, remove middle pad");
#if defined(HAVE_ENCRYPT_THEN_MAC) && !defined(WOLFSSL_AEAD_ONLY)
if (ssl->options.startedETMRead) {
word32 digestSz = MacSize(ssl);
if (ssl->buffers.inputBuffer.idx >=
ssl->keys.padSz + digestSz) {
ssl->buffers.inputBuffer.idx -=
ssl->keys.padSz + digestSz;
}
else {
WOLFSSL_MSG("\tmiddle padding error");
WOLFSSL_ERROR_VERBOSE(FATAL_ERROR);
return FATAL_ERROR;
}
}
else
#endif
{
if (ssl->buffers.inputBuffer.idx >= ssl->keys.padSz) {
ssl->buffers.inputBuffer.idx -= ssl->keys.padSz;
}
else {
WOLFSSL_MSG("\tmiddle padding error");
WOLFSSL_ERROR_VERBOSE(FATAL_ERROR);
return FATAL_ERROR;
}
else {
WOLFSSL_MSG("\tBuffer advanced not enough error");
WOLFSSL_ERROR_VERBOSE(FATAL_ERROR);
return FATAL_ERROR;
}
}
}
Expand Down

0 comments on commit 08af07b

Please sign in to comment.