Add OpenSSL support with compatibility for versions 1.0.x through 3.0+ - #34
Closed
HiGarfield with Copilot wants to merge 6 commits into
Closed
Add OpenSSL support with compatibility for versions 1.0.x through 3.0+#34HiGarfield with Copilot wants to merge 6 commits into
HiGarfield with Copilot wants to merge 6 commits into
Conversation
Copilot created this pull request from a session on behalf of
HiGarfield
July 10, 2026 15:06
View session
HiGarfield
marked this pull request as ready for review
July 10, 2026 15:07
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
This PR adds an optional OpenSSL-based crypto backend (AES-128 CBC/CFB/ECB, HMAC-SHA1, MD5) and wires it into both Makefile and CMake builds via a USE_OPENSSL toggle, along with documentation for building and verification.
Changes:
- Introduces
lib/openssl_wrapper.{h,cpp}to provide an OpenSSL-version-compatible crypto wrapper (1.0.x → 3.x). - Switches AES/MD5/HMAC call sites to OpenSSL-backed inline wrappers when
USE_OPENSSLis enabled. - Updates build scripts (Makefile + CMake) and adds
doc/OPENSSL.mdto document usage.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| makefile | Adds USE_OPENSSL toggle, pkg-config flag discovery, and links OpenSSL when enabled. |
| lib/pbkdf2-sha1.h | Routes sha1_hmac() to OpenSSL when enabled. |
| lib/openssl_wrapper.h | Declares OpenSSL wrapper APIs and 1.0.x compatibility shims. |
| lib/openssl_wrapper.cpp | Implements AES/MD5/HMAC using OpenSSL EVP / legacy APIs by version. |
| lib/md5.h | Routes md5() to OpenSSL when enabled. |
| lib/aes-common.h | Routes AES buffer helpers to OpenSSL when enabled. |
| doc/OPENSSL.md | Documents OpenSSL build options and verification steps. |
| CMakeLists.txt | Adds USE_OPENSSL option, finds/links OpenSSL, adds wrapper source. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+9
to
+14
| #ifdef USE_OPENSSL | ||
|
|
||
| #include <openssl/evp.h> | ||
| #include <openssl/hmac.h> | ||
| #include <openssl/err.h> | ||
| #include <openssl/opensslv.h> |
Comment on lines
+6
to
+10
| #ifdef USE_OPENSSL | ||
| #include "openssl_wrapper.h" | ||
| static inline void md5(const uint8_t *initial_msg, size_t initial_len, uint8_t *digest) { | ||
| openssl_md5(initial_msg, initial_len, digest); | ||
| } |
Comment on lines
+16
to
+20
| # OpenSSL support detection | ||
| USE_OPENSSL ?= 1 | ||
| ifeq ($(USE_OPENSSL), 1) | ||
| OPENSSL_CFLAGS := $(shell pkg-config --cflags openssl 2>/dev/null || echo "-I/usr/include") | ||
| OPENSSL_LIBS := $(shell pkg-config --libs openssl 2>/dev/null || echo "-lssl -lcrypto") |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds optional OpenSSL backend for cryptographic operations (AES, HMAC-SHA1, MD5) while maintaining backward compatibility with existing built-in implementations.
Implementation
Wrapper layer (
lib/openssl_wrapper.{h,cpp}) provides version-agnostic interfaceConditional compilation in
lib/aes-common.h,lib/md5.h,lib/pbkdf2-sha1.hUSE_OPENSSLflag selects OpenSSL or built-in crypto at compile timeBuild System
Makefile:
CMake:
Auto-detection via pkg-config with fallback to
-lssl -lcrypto.Impact