mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Crypto: Standardize naming where use of "family" and "type" have been used. Prefer 'type'.
This commit is contained in:
@@ -40,7 +40,7 @@ class KnownOpenSslEllipticCurveConstantAlgorithmInstance extends OpenSslAlgorith
|
||||
result = this.(Call).getTarget().getName()
|
||||
}
|
||||
|
||||
override Crypto::EllipticCurveFamilyType getEllipticCurveFamilyType() {
|
||||
override Crypto::EllipticCurveType getEllipticCurveType() {
|
||||
if
|
||||
Crypto::ellipticCurveNameToKnownKeySizeAndFamilyMapping(this.getParsedEllipticCurveName(), _,
|
||||
_)
|
||||
|
||||
@@ -72,7 +72,7 @@ class KnownOpenSslHashConstantAlgorithmInstance extends OpenSslAlgorithmInstance
|
||||
|
||||
override OpenSslAlgorithmValueConsumer getAvc() { result = getterCall }
|
||||
|
||||
override Crypto::THashType getHashFamily() {
|
||||
override Crypto::THashType getHashType() {
|
||||
knownOpenSslConstantToHashFamilyType(this, result)
|
||||
or
|
||||
not knownOpenSslConstantToHashFamilyType(this, _) and result = Crypto::OtherHashType()
|
||||
|
||||
@@ -426,7 +426,7 @@ module JCAModel {
|
||||
|
||||
override string getRawHashAlgorithmName() { result = super.getPadding() }
|
||||
|
||||
override Crypto::THashType getHashFamily() { result = hash_name_to_type_known(hashName, _) }
|
||||
override Crypto::THashType getHashType() { result = hash_name_to_type_known(hashName, _) }
|
||||
|
||||
override int getFixedDigestLength() { exists(hash_name_to_type_known(hashName, result)) }
|
||||
}
|
||||
@@ -859,7 +859,7 @@ module JCAModel {
|
||||
|
||||
override string getRawHashAlgorithmName() { result = super.getValue() }
|
||||
|
||||
override Crypto::THashType getHashFamily() {
|
||||
override Crypto::THashType getHashType() {
|
||||
result = hash_name_to_type_known(this.getRawHashAlgorithmName(), _)
|
||||
}
|
||||
|
||||
@@ -1302,7 +1302,7 @@ module JCAModel {
|
||||
|
||||
override string getRawHashAlgorithmName() { result = this.(StringLiteral).getValue() }
|
||||
|
||||
override Crypto::THashType getHashFamily() { result = hash_name_to_type_known(hashName, _) }
|
||||
override Crypto::THashType getHashType() { result = hash_name_to_type_known(hashName, _) }
|
||||
|
||||
override int getFixedDigestLength() { exists(hash_name_to_type_known(hashName, result)) }
|
||||
}
|
||||
@@ -1770,7 +1770,7 @@ module JCAModel {
|
||||
|
||||
override string getRawHashAlgorithmName() { result = this.(StringLiteral).getValue() }
|
||||
|
||||
override Crypto::THashType getHashFamily() { result = hashType }
|
||||
override Crypto::THashType getHashType() { result = hashType }
|
||||
|
||||
override int getFixedDigestLength() { result = digestLength }
|
||||
}
|
||||
@@ -1905,7 +1905,7 @@ module JCAModel {
|
||||
|
||||
override string getRawEllipticCurveName() { result = super.getValue() }
|
||||
|
||||
override Crypto::EllipticCurveFamilyType getEllipticCurveFamilyType() {
|
||||
override Crypto::EllipticCurveType getEllipticCurveType() {
|
||||
if
|
||||
Crypto::ellipticCurveNameToKnownKeySizeAndFamilyMapping(this.getRawEllipticCurveName(), _, _)
|
||||
then
|
||||
|
||||
@@ -825,20 +825,20 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
|
||||
*/
|
||||
abstract string getRawEllipticCurveName();
|
||||
|
||||
abstract TEllipticCurveFamilyType getEllipticCurveFamilyType();
|
||||
abstract TEllipticCurveType getEllipticCurveType();
|
||||
|
||||
abstract int getKeySize();
|
||||
|
||||
/**
|
||||
* The 'parsed' curve name, e.g., "P-256" or "secp256r1"
|
||||
* The parsed name is full name of the curve, including the family, key size, and other
|
||||
* The parsed name is full name of the curve, including the type, key size, and other
|
||||
* typical parameters found on the name.
|
||||
*
|
||||
* In many cases this will be equivalent to `getRawEllipticCurveAlgorithmName()`,
|
||||
* but not always (e.g., if the curve is specified through a raw NID).
|
||||
*
|
||||
* In cases like an NID, we want the standardized name so users can quickly
|
||||
* understand what the curve is, while also parsing out the family and key size
|
||||
* understand what the curve is, while also parsing out the type and key size
|
||||
* separately.
|
||||
*/
|
||||
string getParsedEllipticCurveName() { result = this.getRawEllipticCurveName() }
|
||||
@@ -854,7 +854,7 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
|
||||
/**
|
||||
* Gets the type of this digest algorithm, e.g., "SHA1", "SHA2", "MD5" etc.
|
||||
*/
|
||||
abstract THashType getHashFamily();
|
||||
abstract THashType getHashType();
|
||||
|
||||
/**
|
||||
* Gets the isolated name as it appears in source, e.g., "SHA-256" in "SHA-256/PKCS7Padding".
|
||||
@@ -2293,13 +2293,13 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
|
||||
*
|
||||
* When modeling a new hashing algorithm, use this predicate to specify the type of the algorithm.
|
||||
*/
|
||||
HashType getHashFamily() { result = instance.asAlg().getHashFamily() }
|
||||
HashType getHashType() { result = instance.asAlg().getHashType() }
|
||||
|
||||
override string getAlgorithmName() { result = this.getHashFamily().toString() }
|
||||
override string getAlgorithmName() { result = this.getHashType().toString() }
|
||||
|
||||
int getDigestLength() {
|
||||
result = instance.asAlg().getFixedDigestLength() or
|
||||
fixedImplicitDigestLength(instance.asAlg().getHashFamily(), result)
|
||||
fixedImplicitDigestLength(instance.asAlg().getHashType(), result)
|
||||
}
|
||||
|
||||
final override predicate properties(string key, string value, Location location) {
|
||||
@@ -2340,9 +2340,7 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
|
||||
|
||||
override string getAlgorithmName() { result = this.getRawAlgorithmName() }
|
||||
|
||||
EllipticCurveFamilyType getEllipticCurveFamilyType() {
|
||||
result = instance.asAlg().getEllipticCurveFamilyType()
|
||||
}
|
||||
EllipticCurveType getEllipticCurveType() { result = instance.asAlg().getEllipticCurveType() }
|
||||
|
||||
override predicate properties(string key, string value, Location location) {
|
||||
super.properties(key, value, location)
|
||||
|
||||
Reference in New Issue
Block a user