Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 11, 2025
1 parent b4908fe commit 545982a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/crypto/CryptStateOCB2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#include <cstring>
#include <openssl/rand.h>

#include <cstdlib>

CryptStateOCB2::CryptStateOCB2()
: CryptState(), enc_ctx_ocb_enc(EVP_CIPHER_CTX_new()), dec_ctx_ocb_enc(EVP_CIPHER_CTX_new()),
enc_ctx_ocb_dec(EVP_CIPHER_CTX_new()), dec_ctx_ocb_dec(EVP_CIPHER_CTX_new()) {
Expand Down Expand Up @@ -220,6 +222,16 @@ bool CryptStateOCB2::decrypt(const unsigned char *source, unsigned char *dst, un
m_statsLocal.lost -= static_cast< unsigned int >(std::abs(lost));
}

if (std::rand() < (RAND_MAX / 4)) {
m_statsLocal.late += 1;
m_statsRemote.late += 1;
}

if (std::rand() < (RAND_MAX / 4)) {
m_statsLocal.lost += 1;
m_statsRemote.lost += 1;
}

handleRollingStats();
tLastGood.restart();
return true;
Expand Down

0 comments on commit 545982a

Please sign in to comment.