@@ -67,6 +67,10 @@ class KnownOpenSSLSignatureAlgorithmConstant extends KnownOpenSSLAlgorithmConsta
67
67
KnownOpenSSLSignatureAlgorithmConstant ( ) { resolveAlgorithmFromExpr ( this , _, "SIGNATURE" ) }
68
68
}
69
69
70
+ class KnownOpenSSLKeyAgreementAlgorithmConstant extends KnownOpenSSLAlgorithmConstant {
71
+ KnownOpenSSLKeyAgreementAlgorithmConstant ( ) { resolveAlgorithmFromExpr ( this , _, "KEY_AGREEMENT" ) }
72
+ }
73
+
70
74
/**
71
75
* Resolves a call to a 'direct algorithm getter', e.g., EVP_MD5()
72
76
* This approach to fetching algorithms was used in OpenSSL 1.0.2.
@@ -141,6 +145,14 @@ predicate customAliases(string target, string alias) {
141
145
* The `target` and `alias` are converted to lowercase to be of a standard form.
142
146
*/
143
147
predicate defaultAliases ( string target , string alias ) {
148
+ // "DH" and "DHX" are not aliases in the traditional sense,
149
+ // i.e., they are not registered as aliases explicitly,
150
+ // rather they appear in common usage, and experiments reveal their
151
+ // NID matches those of the `dhKeyAgreement` and `x9.42 dh` algorithms respectively.
152
+ alias = "dh" and target = "dhKeyAgreement"
153
+ or
154
+ alias = "dhx" and target = "x9.42 dh"
155
+ or
144
156
alias = "aes128" and target = "aes-128-cbc"
145
157
or
146
158
alias = "aes192" and target = "aes-192-cbc"
@@ -236,6 +248,10 @@ predicate defaultAliases(string target, string alias) {
236
248
* `algType` is the type of algorithm (e.g., "SYMMETRIC_ENCRYPTION")
237
249
*/
238
250
predicate knownOpenSSLAlgorithmLiteral ( string name , int nid , string normalized , string algType ) {
251
+ name = "dhKeyAgreement" and nid = 28 and normalized = "DH" and algType = "KEY_AGREEMENT"
252
+ or
253
+ name = "x9.42 dh" and nid = 29 and normalized = "DH" and algType = "KEY_AGREEMENT"
254
+ or
239
255
name = "rsa" and nid = 19 and normalized = "RSA" and algType = "ASYMMETRIC_ENCRYPTION"
240
256
or
241
257
name = "prime192v1" and nid = 409 and normalized = "PRIME192V1" and algType = "ELLIPTIC_CURVE"
@@ -868,6 +884,8 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
868
884
or
869
885
name = "id-alg-dh-sig-hmac-sha1" and nid = 325 and normalized = "SHA1" and algType = "HASH"
870
886
or
887
+ name = "id-alg-dh-sig-hmac-sha1" and nid = 325 and normalized = "DH" and algType = "KEY_AGREEMENT"
888
+ or
871
889
name = "aes-128-ofb" and nid = 420 and normalized = "AES-128" and algType = "SYMMETRIC_ENCRYPTION"
872
890
or
873
891
name = "aes-128-ofb" and nid = 420 and normalized = "OFB" and algType = "BLOCK_MODE"
@@ -1369,9 +1387,9 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
1369
1387
or
1370
1388
name = "kx-rsa" and nid = 1037 and normalized = "RSA" and algType = "ASYMMETRIC_ENCRYPTION"
1371
1389
or
1372
- name = "kx-ecdhe" and nid = 1038 and normalized = "ECDH" and algType = "KEY_EXCHANGE "
1390
+ name = "kx-ecdhe" and nid = 1038 and normalized = "ECDH" and algType = "KEY_AGREEMENT "
1373
1391
or
1374
- name = "kx-ecdhe-psk" and nid = 1040 and normalized = "ECDH" and algType = "KEY_EXCHANGE "
1392
+ name = "kx-ecdhe-psk" and nid = 1040 and normalized = "ECDH" and algType = "KEY_AGREEMENT "
1375
1393
or
1376
1394
name = "kx-rsa-psk" and nid = 1042 and normalized = "RSA" and algType = "ASYMMETRIC_ENCRYPTION"
1377
1395
or
@@ -1679,11 +1697,11 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
1679
1697
or
1680
1698
name = "x448" and nid = 1035 and normalized = "X448" and algType = "ELLIPTIC_CURVE"
1681
1699
or
1682
- name = "x448" and nid = 1035 and normalized = "X448" and algType = "KEY_EXCHANGE "
1700
+ name = "x448" and nid = 1035 and normalized = "X448" and algType = "KEY_AGREEMENT "
1683
1701
or
1684
1702
name = "x25519" and nid = 1034 and normalized = "X25519" and algType = "ELLIPTIC_CURVE"
1685
1703
or
1686
- name = "x25519" and nid = 1034 and normalized = "X25519" and algType = "KEY_EXCHANGE "
1704
+ name = "x25519" and nid = 1034 and normalized = "X25519" and algType = "KEY_AGREEMENT "
1687
1705
or
1688
1706
name = "authecdsa" and nid = 1047 and normalized = "ECDSA" and algType = "SIGNATURE"
1689
1707
or
@@ -1783,51 +1801,101 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
1783
1801
normalized = "SHA1" and
1784
1802
algType = "HASH"
1785
1803
or
1804
+ name = "dhsinglepass-cofactordh-sha1kdf-scheme" and
1805
+ nid = 941 and
1806
+ normalized = "DH" and
1807
+ algType = "KEY_AGREEMENT"
1808
+ or
1786
1809
name = "dhsinglepass-cofactordh-sha224kdf-scheme" and
1787
1810
nid = 942 and
1788
1811
normalized = "SHA-224" and
1789
1812
algType = "HASH"
1790
1813
or
1814
+ name = "dhsinglepass-cofactordh-sha224kdf-scheme" and
1815
+ nid = 942 and
1816
+ normalized = "DH" and
1817
+ algType = "KEY_AGREEMENT"
1818
+ or
1791
1819
name = "dhsinglepass-cofactordh-sha256kdf-scheme" and
1792
1820
nid = 943 and
1793
1821
normalized = "SHA-256" and
1794
1822
algType = "HASH"
1795
1823
or
1824
+ name = "dhsinglepass-cofactordh-sha256kdf-scheme" and
1825
+ nid = 943 and
1826
+ normalized = "DH" and
1827
+ algType = "KEY_AGREEMENT"
1828
+ or
1796
1829
name = "dhsinglepass-cofactordh-sha384kdf-scheme" and
1797
1830
nid = 944 and
1798
1831
normalized = "SHA-384" and
1799
1832
algType = "HASH"
1800
1833
or
1834
+ name = "dhsinglepass-cofactordh-sha384kdf-scheme" and
1835
+ nid = 944 and
1836
+ normalized = "DH" and
1837
+ algType = "KEY_AGREEMENT"
1838
+ or
1801
1839
name = "dhsinglepass-cofactordh-sha512kdf-scheme" and
1802
1840
nid = 945 and
1803
1841
normalized = "SHA-512" and
1804
1842
algType = "HASH"
1805
1843
or
1844
+ name = "dhsinglepass-cofactordh-sha512kdf-scheme" and
1845
+ nid = 945 and
1846
+ normalized = "DH" and
1847
+ algType = "KEY_AGREEMENT"
1848
+ or
1806
1849
name = "dhsinglepass-stddh-sha1kdf-scheme" and
1807
1850
nid = 936 and
1808
1851
normalized = "SHA1" and
1809
1852
algType = "HASH"
1810
1853
or
1854
+ name = "dhsinglepass-stddh-sha1kdf-scheme" and
1855
+ nid = 936 and
1856
+ normalized = "DH" and
1857
+ algType = "KEY_AGREEMENT"
1858
+ or
1811
1859
name = "dhsinglepass-stddh-sha224kdf-scheme" and
1812
1860
nid = 937 and
1813
1861
normalized = "SHA-224" and
1814
1862
algType = "HASH"
1815
1863
or
1864
+ name = "dhsinglepass-stddh-sha224kdf-scheme" and
1865
+ nid = 937 and
1866
+ normalized = "DH" and
1867
+ algType = "KEY_AGREEMENT"
1868
+ or
1816
1869
name = "dhsinglepass-stddh-sha256kdf-scheme" and
1817
1870
nid = 938 and
1818
1871
normalized = "SHA-256" and
1819
1872
algType = "HASH"
1820
1873
or
1874
+ name = "dhsinglepass-stddh-sha256kdf-scheme" and
1875
+ nid = 938 and
1876
+ normalized = "DH" and
1877
+ algType = "KEY_AGREEMENT"
1878
+ or
1821
1879
name = "dhsinglepass-stddh-sha384kdf-scheme" and
1822
1880
nid = 939 and
1823
1881
normalized = "SHA-384" and
1824
1882
algType = "HASH"
1825
1883
or
1884
+ name = "dhsinglepass-stddh-sha384kdf-scheme" and
1885
+ nid = 939 and
1886
+ normalized = "DH" and
1887
+ algType = "KEY_AGREEMENT"
1888
+ or
1826
1889
name = "dhsinglepass-stddh-sha512kdf-scheme" and
1827
1890
nid = 940 and
1828
1891
normalized = "SHA-512" and
1829
1892
algType = "HASH"
1830
1893
or
1894
+ name = "dhsinglepass-stddh-sha512kdf-scheme" and
1895
+ nid = 940 and
1896
+ normalized = "DH" and
1897
+ algType = "KEY_AGREEMENT"
1898
+ or
1831
1899
name = "dsa-old" and nid = 67 and normalized = "DSA" and algType = "SIGNATURE"
1832
1900
or
1833
1901
name = "dsa-sha" and nid = 66 and normalized = "DSA" and algType = "SIGNATURE"
@@ -1987,7 +2055,7 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
1987
2055
normalized = "GOST" and
1988
2056
algType = "SYMMETRIC_ENCRYPTION"
1989
2057
or
1990
- name = "gost r 34.10-2001 dh" and
2058
+ name = "gost r 34.10-2001 dh" and // TODO: review this algorithm
1991
2059
nid = 817 and
1992
2060
normalized = "GOST" and
1993
2061
algType = "SYMMETRIC_ENCRYPTION"
@@ -2057,7 +2125,7 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
2057
2125
normalized = "GOST" and
2058
2126
algType = "SYMMETRIC_ENCRYPTION"
2059
2127
or
2060
- name = "gost r 34.10-94 dh" and
2128
+ name = "gost r 34.10-94 dh" and // TODO: review this algorithm
2061
2129
nid = 818 and
2062
2130
normalized = "GOST" and
2063
2131
algType = "SYMMETRIC_ENCRYPTION"
@@ -2272,7 +2340,7 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
2272
2340
normalized = "GOSTR34102001" and
2273
2341
algType = "SYMMETRIC_ENCRYPTION"
2274
2342
or
2275
- name = "id-gostr3410-2001dh" and
2343
+ name = "id-gostr3410-2001dh" and // TODO: review this algorithm
2276
2344
nid = 817 and
2277
2345
normalized = "GOSTR34102001" and
2278
2346
algType = "SYMMETRIC_ENCRYPTION"
@@ -2337,7 +2405,7 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
2337
2405
normalized = "GOSTR341094" and
2338
2406
algType = "SYMMETRIC_ENCRYPTION"
2339
2407
or
2340
- name = "id-gostr3410-94dh" and
2408
+ name = "id-gostr3410-94dh" and // TODO: review this algorithm
2341
2409
nid = 818 and
2342
2410
normalized = "GOSTR341094" and
2343
2411
algType = "SYMMETRIC_ENCRYPTION"
@@ -2421,16 +2489,31 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
2421
2489
normalized = "3DES" and
2422
2490
algType = "SYMMETRIC_ENCRYPTION"
2423
2491
or
2492
+ name = "id-smime-alg-esdhwith3des" and
2493
+ nid = 241 and
2494
+ normalized = "ESDH" and
2495
+ algType = "KEY_AGREEMENT"
2496
+ or
2424
2497
name = "id-smime-alg-esdhwithrc2" and
2425
2498
nid = 242 and
2426
2499
normalized = "RC2" and
2427
2500
algType = "SYMMETRIC_ENCRYPTION"
2428
2501
or
2502
+ name = "id-smime-alg-esdhwithrc2" and
2503
+ nid = 242 and
2504
+ normalized = "ESDH" and
2505
+ algType = "KEY_AGREEMENT"
2506
+ or
2429
2507
name = "id-smime-alg-rc2wrap" and
2430
2508
nid = 244 and
2431
2509
normalized = "RC2" and
2432
2510
algType = "SYMMETRIC_ENCRYPTION"
2433
2511
or
2512
+ name = "id_smime_alg_esdh" and
2513
+ nid = 245 and
2514
+ normalized = "ESDH" and
2515
+ algType = "KEY_AGREEMENT"
2516
+ or
2434
2517
name = "id-tc26-gost-28147-param-z" and
2435
2518
nid = 1003 and
2436
2519
normalized = "GOST28147" and
@@ -2476,9 +2559,9 @@ predicate knownOpenSSLAlgorithmLiteral(string name, int nid, string normalized,
2476
2559
normalized = "GOST34102012" and
2477
2560
algType = "SYMMETRIC_ENCRYPTION"
2478
2561
or
2479
- name = "kxecdhe" and nid = 1038 and normalized = "ECDH" and algType = "KEY_EXCHANGE "
2562
+ name = "kxecdhe" and nid = 1038 and normalized = "ECDH" and algType = "KEY_AGREEMENT "
2480
2563
or
2481
- name = "kxecdhe-psk" and nid = 1040 and normalized = "ECDH" and algType = "KEY_EXCHANGE "
2564
+ name = "kxecdhe-psk" and nid = 1040 and normalized = "ECDH" and algType = "KEY_AGREEMENT "
2482
2565
or
2483
2566
name = "kxgost" and nid = 1045 and normalized = "GOST" and algType = "SYMMETRIC_ENCRYPTION"
2484
2567
or
0 commit comments