-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
There was a problem hiding this 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 unusedLibraryDetector
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 ofCTXPointerExpr
(which extendsExpr
), 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")
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/AlgToAVCFlow.qll
Show resolved
Hide resolved
* # 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
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/PaddingAlgorithmInstance.qll
Fixed
Show resolved
Hide resolved
cpp/ql/lib/experimental/quantum/OpenSSL/AlgorithmInstances/PaddingAlgorithmInstance.qll
Fixed
Show resolved
Hide resolved
...l/lib/experimental/quantum/OpenSSL/AlgorithmValueConsumers/PaddingAlgorithmValueConsumer.qll
Fixed
Show fixed
Hide fixed
/** | ||
* Flow from any CtxPointerArgument to any other CtxPointerArgument | ||
*/ | ||
module OpenSSLCtxArgumentFlowConfig implements DataFlow::ConfigSig { |
Check warning
Code scanning / CodeQL
Acronyms should be PascalCase/camelCase. Warning
) | ||
} | ||
} | ||
|
||
module OpenSSLCTXArgumentFlow = DataFlow::Global<OpenSSLCTXArgumentFlowConfig>; | ||
module OpenSSLCtxArgumentFlow = DataFlow::Global<OpenSSLCtxArgumentFlowConfig>; |
Check warning
Code scanning / CodeQL
Acronyms should be PascalCase/camelCase. Warning
No description provided.