Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Crypto: Misc. refactoring and code clean up. #19552

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

Merged
merged 3 commits into from
May 21, 2025

Conversation

bdrodes
Copy link
Contributor

@bdrodes bdrodes commented May 21, 2025

No description provided.

@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 19:07
@bdrodes bdrodes requested a review from a team as a code owner May 21, 2025 19:07
@github-actions github-actions bot added the C++ label May 21, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors and cleans up the OpenSSL QL library by removing redundant filters and imports, simplifying operation constructors, improving module import paths, and adding documentation for context flow and padding constants.

  • Simplified constructors by removing isPossibleOpenSSLFunction guards and eliminated unused LibraryDetector imports.
  • Switched to relative module imports and added docstrings for CTX flow classes.
  • Introduced OpenSSLPaddingLiteral for padding constants and cleaned up algorithm instance mappings.

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cpp/ql/lib/experimental/quantum/OpenSSL/Operations/EVPHashOperation.qll Removed LibraryDetector import, simplified hash operation constructors
cpp/ql/lib/experimental/quantum/OpenSSL/Operations/ECKeyGenOperation.qll Removed LibraryDetector import, simplified keygen constructor
cpp/ql/lib/experimental/quantum/OpenSSL/OpenSSL.qll Collapsed imports to relative module paths
cpp/ql/lib/experimental/quantum/OpenSSL/CtxFlow.qll Added documentation comments for CTX types and flow
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers/PaddingAlgorithmValueConsumer.qll Removed LibraryDetector import, simplified predicate
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers/PKeyAlgorithmValueConsumer.qll Removed LibraryDetector import
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers/OpenSSLAlgorithmValueConsumerBase.qll Removed unused DataFlow import
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers/EllipticCurveAlgorithmValueConsumer.qll Removed LibraryDetector import
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers/CipherAlgorithmValueConsumer.qll Removed LibraryDetector import
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/PaddingAlgorithmInstance.qll Introduced OpenSSLPaddingLiteral, cleaned up comment and mapping
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/KnownAlgorithmConstants.qll Removed LibraryDetector import, changed match patterns to uppercase
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/CipherAlgorithmInstance.qll Fixed typo in comment
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/BlockAlgorithmInstance.qll Fixed typo in comment
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/AlgToAVCFlow.qll Added import for PaddingAlgorithmInstance, adjusted flow config
cpp/ql/lib/experimental/quantum/Language.qll Excluded zero values from algorithm constants
Comments suppressed due to low confidence (3)

cpp/ql/lib/experimental/quantum/OpenSSL/CtxFlow.qll:83

  • A Call node can never be an instance of CTXPointerExpr (which extends Expr), so this predicate will always fail. Remove or adjust this condition to target the correct class.
this instanceof CTXPointerExpr

cpp/ql/lib/experimental/quantum/OpenSSL/Operations/EVPHashOperation.qll:44

  • The constructor no longer checks isPossibleOpenSSLFunction, which may lead to false positives for non-OpenSSL calls. Consider reintroducing a guard to verify the target belongs to the OpenSSL library.
EVP_Q_Digest_Operation() { this.(Call).getTarget().getName() = "EVP_Q_digest" }

cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/KnownAlgorithmConstants.qll:22

  • Changing to uppercase pattern matching may break case-sensitive matches, since algType is derived from .toLowerCase(). Use a case-insensitive pattern or match against lowercase.
algType.matches("%ENCRYPTION")

nicolaswill
nicolaswill previously approved these changes May 21, 2025
* # define RSA_PKCS1_WITH_TLS_PADDING 7
* # define RSA_PKCS1_NO_IMPLICIT_REJECT_PADDING 8
*/
class OpenSSLPaddingLiteral extends Literal {

Check warning

Code scanning / CodeQL

Acronyms should be PascalCase/camelCase. Warning

Acronyms in OpenSSLPaddingLiteral should be PascalCase/camelCase.
cpp/ql/lib/experimental/quantum/OpenSSL/CtxFlow.qll Fixed Show resolved Hide resolved
@bdrodes bdrodes force-pushed the ben_refactoring branch from 629369b to d75fc2e Compare May 21, 2025 19:25
/**
* Flow from any CtxPointerArgument to any other CtxPointerArgument
*/
module OpenSSLCtxArgumentFlowConfig implements DataFlow::ConfigSig {

Check warning

Code scanning / CodeQL

Acronyms should be PascalCase/camelCase. Warning

Acronyms in OpenSSLCtxArgumentFlowConfig should be PascalCase/camelCase.
)
}
}

module OpenSSLCTXArgumentFlow = DataFlow::Global<OpenSSLCTXArgumentFlowConfig>;
module OpenSSLCtxArgumentFlow = DataFlow::Global<OpenSSLCtxArgumentFlowConfig>;

Check warning

Code scanning / CodeQL

Acronyms should be PascalCase/camelCase. Warning

Acronyms in OpenSSLCtxArgumentFlow should be PascalCase/camelCase.
@nicolaswill nicolaswill self-requested a review May 21, 2025 19:30
@nicolaswill nicolaswill merged commit bb4c6a3 into github:main May 21, 2025
13 checks passed
@nicolaswill nicolaswill deleted the ben_refactoring branch May 21, 2025 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.