Crypto: Fix further acronym casing and remove unused field

This commit is contained in:
Nicolas Will
2025-06-25 20:25:33 +02:00
parent b8097501b6
commit 8e6031df14
5 changed files with 22 additions and 24 deletions

View File

@@ -33,9 +33,9 @@ predicate knownOpenSslConstantToCipherFamilyType(
or
name.matches("CAST5%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::CAST5())
or
name.matches("2DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DoubleDES())
name.matches("2DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DOUBLE_DES())
or
name.matches("3DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::TripleDES())
name.matches("3DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::TRIPLE_DES())
or
name.matches("DES%") and type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DES())
or

View File

@@ -15,7 +15,7 @@ predicate knownOpenSslConstantToHashFamilyType(
or
name = "BLAKE2S" and type instanceof Crypto::BLAKE2S
or
name.matches("GOST%") and type instanceof Crypto::GOSTHash
name.matches("GOST%") and type instanceof Crypto::GOST_HASH
or
name = "MD2" and type instanceof Crypto::MD2
or

View File

@@ -40,7 +40,7 @@ predicate knownOpenSslConstantToPaddingFamilyType(
or
name = "PKCS7" and type = KeyOpAlg::PKCS7()
or
name = "PKCS1V15" and type = KeyOpAlg::PKCS1_v1_5()
name = "PKCS1V15" and type = KeyOpAlg::PKCS1_V1_5()
)
)
}
@@ -100,7 +100,7 @@ class KnownOpenSslPaddingConstantAlgorithmInstance extends OpenSslAlgorithmInsta
override OpenSslAlgorithmValueConsumer getAvc() { result = getterCall }
KeyOpAlg::PaddingSchemeType getKnownPaddingType() {
this.(Literal).getValue().toInt() in [1, 7, 8] and result = KeyOpAlg::PKCS1_v1_5()
this.(Literal).getValue().toInt() in [1, 7, 8] and result = KeyOpAlg::PKCS1_V1_5()
or
this.(Literal).getValue().toInt() = 3 and result = KeyOpAlg::NoPadding()
or

View File

@@ -180,7 +180,7 @@ module JCAModel {
type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::DES())
or
upper = "TRIPLEDES" and
type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::TripleDES())
type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::TRIPLE_DES())
or
upper = "IDEA" and
type = KeyOpAlg::TSymmetricCipher(KeyOpAlg::IDEA())
@@ -1522,9 +1522,7 @@ module JCAModel {
}
class MacGetInstanceAlgorithmValueConsumer extends Crypto::AlgorithmValueConsumer {
MacGetInstanceCall call;
MacGetInstanceAlgorithmValueConsumer() { this = call.getAlgorithmArg() }
MacGetInstanceAlgorithmValueConsumer() { this = any(MacGetInstanceCall c).getAlgorithmArg() }
override Crypto::ConsumerInputDataFlowNode getInputNode() { result.asExpr() = this }

View File

@@ -28,8 +28,8 @@ module Types {
IDEA() or
KUZNYECHIK() or
MAGMA() or
TripleDES() or
DoubleDES() or
TRIPLE_DES() or
DOUBLE_DES() or
RC2() or
RC4() or
RC5() or
@@ -48,9 +48,9 @@ module Types {
OtherSignatureAlgorithmType()
newtype TKemAlgorithmType =
Kyber() or
FrodoKEM() or
OtherKEMAlgorithmType()
KYBER() or
FRODO_KEM() or
OtherKemAlgorithmType()
newtype TCipherStructureType =
Block() or
@@ -94,9 +94,9 @@ module Types {
or
type = MAGMA() and name = "Magma" and s = Block()
or
type = TripleDES() and name = "TripleDES" and s = Block()
type = TRIPLE_DES() and name = "TripleDES" and s = Block()
or
type = DoubleDES() and name = "DoubleDES" and s = Block()
type = DOUBLE_DES() and name = "DoubleDES" and s = Block()
or
type = RC2() and name = "RC2" and s = Block()
or
@@ -134,11 +134,11 @@ module Types {
this = TSignature(OtherSignatureAlgorithmType()) and result = "UnknownSignature"
or
// Key Encapsulation Mechanisms
this = TKeyEncapsulation(Kyber()) and result = "Kyber"
this = TKeyEncapsulation(KYBER()) and result = "Kyber"
or
this = TKeyEncapsulation(FrodoKEM()) and result = "FrodoKEM"
this = TKeyEncapsulation(FRODO_KEM()) and result = "FrodoKEM"
or
this = TKeyEncapsulation(OtherKEMAlgorithmType()) and result = "UnknownKEM"
this = TKeyEncapsulation(OtherKemAlgorithmType()) and result = "UnknownKEM"
or
// Unknown
this = TUnknownKeyOperationAlgorithmType() and result = "Unknown"
@@ -149,9 +149,9 @@ module Types {
or
this = TSymmetricCipher(DESX()) and result = 184
or
this = TSymmetricCipher(DoubleDES()) and result = 112
this = TSymmetricCipher(DOUBLE_DES()) and result = 112
or
this = TSymmetricCipher(TripleDES()) and result = 168
this = TSymmetricCipher(TRIPLE_DES()) and result = 168
or
this = TSymmetricCipher(CHACHA20()) and result = 256
or
@@ -225,7 +225,7 @@ module Types {
}
newtype TPaddingSchemeType =
PKCS1_v1_5() or // RSA encryption/signing padding
PKCS1_V1_5() or // RSA encryption/signing padding
PSS() or
PKCS7() or // Standard block cipher padding (PKCS5 for 8-byte blocks)
ANSI_X9_23() or // Zero-padding except last byte = padding length
@@ -241,7 +241,7 @@ module Types {
or
this = OAEP() and result = "OAEP"
or
this = PKCS1_v1_5() and result = "PKCS1_v1_5"
this = PKCS1_V1_5() and result = "PKCS1_v1_5"
or
this = PKCS7() and result = "PKCS7"
or
@@ -255,7 +255,7 @@ module Types {
newtype THashType =
BLAKE2B() or
BLAKE2S() or
GOSTHash() or
GOST_HASH() or
MD2() or
MD4() or
MD5() or