-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement High-Quality Random Number Generation Using AES-CTR Mode with OpenSSL and AES-NI Support. C++ variant #570
Conversation
… in experimental state. Fixed formatting, fixed AES PRNG header.
…8-CTR OpenSSL descriptions.
…256 as default option for 32-Bit due to performance and quality reasons.
…HER_CTX within the AES CTR PRNG C++ implementation. This ensures automatic resource release, preventing memory leaks and enhancing code safety.
…source management using std::unique_ptr
This branch is currently being tested, I'm pretty busy at the moment so it may be a few days before I give you an update. |
An issue i've found, that should be fixed in this branch now, causing buffer overflow. |
Verification still fails, valgrind error still present but points to the new aes_ctr_prng_genrand_uint256_to_buf() function.
|
Now i've compiled and ran on my Ubuntu server, the result there is entirely different heh! As we have pointed out before, Fedora uses some different linker, so it was able to build despite Ubuntu being unable to build a few weeks ago as you remember. Ok now it's the first time i'm encountering those issues as well on Fedora.
|
I've been able to get a clean valgrind output now after fixing the uninitialized array. Old code was: unsigned char temp_buffer[32]; // Temporary buffer for pseudorandom output.
int outlen;
if( !EVP_EncryptUpdate( cppState->ctx.get(), temp_buffer, &outlen, temp_buffer, sizeof( temp_buffer ) ) )
{
nwipe_log( NWIPE_LOG_ERROR, "AES-256 CTR PRNG generation failed." );
return;
} There are two ways to solve it. if( !EVP_EncryptUpdate( cppState->ctx.get(), temp_buffer, &outlen, nullptr, sizeof( temp_buffer ) ) )
{
nwipe_log( NWIPE_LOG_ERROR, "AES-256 CTR PRNG generation failed." );
return;
} I've opted for:
|
Not necessary anymore, due to successful C implementation #559 |
Ahoy. Same as #559 but with major rewrite in C++ using smart pointers to ensure memory safety.