Skip to content

Navigation Menu

Sign in
Appearance settings

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: Improve literal filtering for OpenSSL for algorithms and generic sources #19553

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 8 commits into from
May 22, 2025
Prev Previous commit
Crypto: Simplifying constant comparisons.
  • Loading branch information
bdrodes committed May 22, 2025
commit 007683f06ae0175eec7114d56f8b3eb6c09899ab
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,20 @@
}

class KnownOpenSSLPaddingAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
string algType;

KnownOpenSSLPaddingAlgorithmConstant() {
resolveAlgorithmFromExpr(this, _, algType) and
algType.matches("%PADDING")
exists(string algType |
resolveAlgorithmFromExpr(this, _, algType) and
algType.matches("%PADDING")
)
}
}

class KnownOpenSSLBlockModeAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
string algType;

KnownOpenSSLBlockModeAlgorithmConstant() {
resolveAlgorithmFromExpr(this, _, algType) and
algType.matches("%BLOCK_MODE")
}
KnownOpenSSLBlockModeAlgorithmConstant() { resolveAlgorithmFromExpr(this, _, "BLOCK_MODE") }
}

class KnownOpenSSLHashAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
string algType;

KnownOpenSSLHashAlgorithmConstant() {
resolveAlgorithmFromExpr(this, _, algType) and
algType.matches("%HASH")
}
KnownOpenSSLHashAlgorithmConstant() { resolveAlgorithmFromExpr(this, _, "HASH") }

int getExplicitDigestLength() {
exists(string name |
Expand All @@ -69,20 +59,12 @@

class KnownOpenSSLEllipticCurveAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
KnownOpenSSLEllipticCurveAlgorithmConstant() {
exists(string algType |
resolveAlgorithmFromExpr(this, _, algType) and
algType.matches("ELLIPTIC_CURVE")
)
resolveAlgorithmFromExpr(this, _, "ELLIPTIC_CURVE")
}
}

class KnownOpenSSLSignatureAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
Fixed Show fixed Hide fixed

Check warning

Code scanning / CodeQL

Acronyms should be PascalCase/camelCase. Warning

Acronyms in KnownOpenSSLSignatureAlgorithmConstant should be PascalCase/camelCase.
string algType;

KnownOpenSSLSignatureAlgorithmConstant() {
resolveAlgorithmFromExpr(this, _, algType) and
algType.matches("SIGNATURE")
}
KnownOpenSSLSignatureAlgorithmConstant() { resolveAlgorithmFromExpr(this, _, "SIGNATURE") }
}

/**
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.