Skip to content

Commit 28f4824

Browse files
committed
Crypto: Adding signature constant support, and fixing key exchange and signature mapping for ED and X elliptic curve variants.
1 parent ca1d4e2 commit 28f4824

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ class KnownOpenSSLEllipticCurveAlgorithmConstant extends KnownOpenSSLAlgorithmCo
7676
}
7777
}
7878

79+
class KnownOpenSSLSignatureAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
80+
string algType;
81+
82+
KnownOpenSSLSignatureAlgorithmConstant() {
83+
resolveAlgorithmFromExpr(this, _, algType) and
84+
algType.matches("SIGNATURE")
85+
}
86+
}
87+
7988
/**
8089
* Resolves a call to a 'direct algorithm getter', e.g., EVP_MD5()
8190
* This approach to fetching algorithms was used in OpenSSL 1.0.2.
@@ -263,8 +272,12 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
263272
or
264273
name = "ed25519" and nid = 1087 and normalized = "ED25519" and algType = "ELLIPTIC_CURVE"
265274
or
275+
name = "ed25519" and nid = 1087 and normalized = "ED25519" and algType = "SIGNATURE"
276+
or
266277
name = "ed448" and nid = 1088 and normalized = "ED448" and algType = "ELLIPTIC_CURVE"
267278
or
279+
name = "ed448" and nid = 1088 and normalized = "ED448" and algType = "SIGNATURE"
280+
or
268281
name = "md2" and nid = 3 and normalized = "MD2" and algType = "HASH"
269282
or
270283
name = "sha" and nid = 41 and normalized = "SHA" and algType = "HASH"
@@ -1684,8 +1697,12 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
16841697
or
16851698
name = "x448" and nid = 1035 and normalized = "X448" and algType = "ELLIPTIC_CURVE"
16861699
or
1700+
name = "x448" and nid = 1035 and normalized = "X448" and algType = "KEY_EXCHANGE"
1701+
or
16871702
name = "x25519" and nid = 1034 and normalized = "X25519" and algType = "ELLIPTIC_CURVE"
16881703
or
1704+
name = "x25519" and nid = 1034 and normalized = "X25519" and algType = "KEY_EXCHANGE"
1705+
or
16891706
name = "authecdsa" and nid = 1047 and normalized = "ECDSA" and algType = "SIGNATURE"
16901707
or
16911708
name = "authgost01" and nid = 1050 and normalized = "GOST" and algType = "SYMMETRIC_ENCRYPTION"

0 commit comments

Comments
 (0)