mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
[PR #272] [MERGED] Core/SSL: Add SecureBuffer and SecureZero for Secure Cryptographic Data Handling #280
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ultimatepp#280
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ultimatepp/ultimatepp/pull/272
Author: @ismail-yilmaz
Created: 5/31/2025
Status: ✅ Merged
Merged: 6/10/2025
Merged by: @mirek-fidler
Base:
master← Head:securebuffer📝 Commits (1)
9551e0bCore/SSL: Added SecureBuffer and SecureZero📊 Changes
6 files changed (+459 additions, -0 deletions)
View changed files
➕
autotest/SecureBuffer/SecureBuffer.cpp(+148 -0)➕
autotest/SecureBuffer/SecureBuffer.upp(+12 -0)➕
uppsrc/Core/SSL/Buffer.hpp(+163 -0)📝
uppsrc/Core/SSL/SSL.h(+3 -0)📝
uppsrc/Core/SSL/SSL.upp(+1 -0)➕
uppsrc/Core/SSL/src.tpp/Upp_SSL_SecureBuffer_en-us.tpp(+132 -0)📄 Description
Rationale
This PR introduces
SecureBuffer<T>class andSecureZero()function(s) for handling sensitive cryptographic data in memory, which U++ currently lacks. These utilities provide memory locking and cryptographic erasure to reduce the risk of sensitive data being swapped to disk or left in memory after use.Features
SecureZero<T>():Safely and securely zeroes memory, using
OPENSSL_cleanse().Safely zeroes static arrays.
Enforces that
Tis trivially copyable and destructible viastatic_assert.SecureBuffer<T>:RAII-managed dynamic buffer for sensitive data.
Automatically zeroes memory on destruction using
SecureZeroon destruction.Prevents paging sensitive memory using
mlockorVirtualLockwhen possible ("best-effort" locking).Pick-only semantics to prevent accidental copies.
Enforces that
Tis trivially copyable and destructible viastatic_assert.Format
SecureBuffer<T>behaves like a dynamic container (T*,begin(),end(),operator[]), very similar toUpp::Buffer<T>, but is not intended for general-purpose use. It is specialized for securely storing sensitive data.Public API
Notes:
std::initializer_listis intentionally left out of the design, as it can be dangerous in cryptographic contexts.Unit Tests
SecureZero:
SecureBuffer:
API Docs
Changes
Core/SSLpackage.Related Discussions
#269
#270
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.