From 545982a80fdf06f4c8d3f0967fefdf59500b9e7c Mon Sep 17 00:00:00 2001 From: Hartmnt Date: Sat, 11 Jan 2025 11:51:57 +0000 Subject: [PATCH] Test --- src/crypto/CryptStateOCB2.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/crypto/CryptStateOCB2.cpp b/src/crypto/CryptStateOCB2.cpp index 9b1c5d763d..a6bb3d2d5e 100644 --- a/src/crypto/CryptStateOCB2.cpp +++ b/src/crypto/CryptStateOCB2.cpp @@ -28,6 +28,8 @@ #include #include +#include + 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()) { @@ -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;