Skip to content

Clear OpenSSL error queue if rdrand engine is unavailable#859

Open
olszomal wants to merge 1 commit intosofthsm:mainfrom
olszomal:rdrand-engine
Open

Clear OpenSSL error queue if rdrand engine is unavailable#859
olszomal wants to merge 1 commit intosofthsm:mainfrom
olszomal:rdrand-engine

Conversation

@olszomal
Copy link
Copy Markdown

@olszomal olszomal commented Apr 14, 2026

ENGINE_by_id("rdrand") may leave an error in the OpenSSL error queue when the engine is not present, which is an expected condition.

Clear the error queue in this case to avoid propagating stale errors from the error queue to subsequent OpenSSL operations.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling during cryptographic component initialization when unavailable.

@olszomal olszomal requested a review from a team as a code owner April 14, 2026 13:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2c1e94c5-2ef1-412e-80e0-9d1cfe47b641

📥 Commits

Reviewing files that changed from the base of the PR and between 5a3466f and ca71372.

📒 Files selected for processing (1)
  • src/lib/crypto/OSSLCryptoFactory.cpp

📝 Walkthrough

Walkthrough

Added error queue cleanup via ERR_clear_error() in the OSSLCryptoFactory constructor when RDRAND engine initialization is unavailable. This prevents stale error states from persisting when the engine lookup fails.

Changes

Cohort / File(s) Summary
RDRAND Engine Error Handling
src/lib/crypto/OSSLCryptoFactory.cpp
Added explicit OpenSSL error queue cleanup when RDRAND engine is unavailable in constructor initialization under WITH_ENGINES condition.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 When engines won't appear, don't let errors linger here,
Clear the queue with gentle care, so no stale state will dare!
A rabbit's fix, both small and spry, ensures the code stays spry. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding error queue cleanup when the rdrand engine is unavailable.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant