Skip to content

Commit 78bb41e

Browse files
author
Paolo Tranquilli
committed
Merge branch 'main' into redsun82/rust-extract-libs
2 parents dfc03cb + ae4a425 commit 78bb41e

File tree

71 files changed

+9791
-206
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+9791
-206
lines changed

.github/workflows/build-ripunzip.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ on:
66
ripunzip-version:
77
description: "what reference to checktout from google/runzip"
88
required: false
9-
default: v1.2.1
9+
default: v2.0.2
1010
openssl-version:
1111
description: "what reference to checkout from openssl/openssl for Linux"
1212
required: false
13-
default: openssl-3.3.0
13+
default: openssl-3.5.0
1414

1515
jobs:
1616
build:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
os: [ubuntu-22.04, macos-13, windows-2019]
20+
os: [ubuntu-22.04, macos-13, windows-2022]
2121
runs-on: ${{ matrix.os }}
2222
steps:
2323
- uses: actions/checkout@v4

.github/workflows/csharp-qltest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
unit-tests:
3737
strategy:
3838
matrix:
39-
os: [ubuntu-latest, windows-2019]
39+
os: [ubuntu-latest, windows-latest]
4040
runs-on: ${{ matrix.os }}
4141
steps:
4242
- uses: actions/checkout@v4

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/java/ql/test-kotlin2/ @github/codeql-kotlin
1717

1818
# Experimental CodeQL cryptography
19-
**/experimental/quantum/ @github/ps-codeql
19+
**/experimental/**/quantum/ @github/ps-codeql
2020
/shared/quantum/ @github/ps-codeql
2121

2222
# CodeQL tools and associated docs

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ class KnownOpenSSLBlockModeConstantAlgorithmInstance extends OpenSSLAlgorithmIns
7171

7272
// NOTE: I'm not going to attempt to parse out the mode specific part, so returning
7373
// the same as the raw name for now.
74-
override string getRawModeAlgorithmName() { result = this.(Literal).getValue().toString() }
74+
override string getRawModeAlgorithmName() {
75+
result = this.(Literal).getValue().toString()
76+
or
77+
result = this.(Call).getTarget().getName()
78+
}
7579

7680
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
7781
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ class KnownOpenSSLCipherConstantAlgorithmInstance extends OpenSSLAlgorithmInstan
102102
// TODO or trace through getter ctx to set padding
103103
}
104104

105-
override string getRawAlgorithmName() { result = this.(Literal).getValue().toString() }
105+
override string getRawAlgorithmName() {
106+
result = this.(Literal).getValue().toString()
107+
or
108+
result = this.(Call).getTarget().getName()
109+
}
106110

107111
override int getKeySizeFixed() {
108112
this.(KnownOpenSSLCipherAlgorithmConstant).getExplicitKeySize() = result

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ class KnownOpenSSLEllipticCurveConstantAlgorithmInstance extends OpenSSLAlgorith
3232

3333
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
3434

35-
override string getRawEllipticCurveName() { result = this.(Literal).getValue().toString() }
35+
override string getRawEllipticCurveName() {
36+
result = this.(Literal).getValue().toString()
37+
or
38+
result = this.(Call).getTarget().getName()
39+
}
3640

3741
override Crypto::TEllipticCurveType getEllipticCurveType() {
3842
Crypto::ellipticCurveNameToKeySizeAndFamilyMapping(this.getParsedEllipticCurveName(), _, result)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ class KnownOpenSSLHashConstantAlgorithmInstance extends OpenSSLAlgorithmInstance
7676
not knownOpenSSLConstantToHashFamilyType(this, _) and result = Crypto::OtherHashType()
7777
}
7878

79-
override string getRawHashAlgorithmName() { result = this.(Literal).getValue().toString() }
79+
override string getRawHashAlgorithmName() {
80+
result = this.(Literal).getValue().toString()
81+
or
82+
result = this.(Call).getTarget().getName()
83+
}
8084

8185
override int getFixedDigestLength() {
8286
this.(KnownOpenSSLHashAlgorithmConstant).getExplicitDigestLength() = result
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import cpp
2+
private import experimental.quantum.Language
3+
private import KnownAlgorithmConstants
4+
private import experimental.quantum.OpenSSL.AlgorithmValueConsumers.OpenSSLAlgorithmValueConsumers
5+
private import experimental.quantum.OpenSSL.AlgorithmInstances.OpenSSLAlgorithmInstanceBase
6+
private import AlgToAVCFlow
7+
8+
predicate knownOpenSSLConstantToKeyAgreementFamilyType(
9+
KnownOpenSSLKeyAgreementAlgorithmConstant e, Crypto::TKeyAgreementType type
10+
) {
11+
exists(string name |
12+
name = e.getNormalizedName() and
13+
(
14+
name = "ECDH" and type = Crypto::ECDH()
15+
or
16+
name = "DH" and type = Crypto::DH()
17+
or
18+
name = "EDH" and type = Crypto::EDH()
19+
or
20+
name = "ESDH" and type = Crypto::EDH()
21+
)
22+
)
23+
}
24+
25+
class KnownOpenSSLHashConstantAlgorithmInstance extends OpenSSLAlgorithmInstance,
26+
Crypto::KeyAgreementAlgorithmInstance instanceof KnownOpenSSLKeyAgreementAlgorithmConstant
27+
{
28+
OpenSSLAlgorithmValueConsumer getterCall;
29+
30+
KnownOpenSSLHashConstantAlgorithmInstance() {
31+
// Two possibilities:
32+
// 1) The source is a literal and flows to a getter, then we know we have an instance
33+
// 2) The source is a KnownOpenSSLAlgorithm is call, and we know we have an instance immediately from that
34+
// Possibility 1:
35+
this instanceof Literal and
36+
exists(DataFlow::Node src, DataFlow::Node sink |
37+
// Sink is an argument to a CipherGetterCall
38+
sink = getterCall.getInputNode() and
39+
// Source is `this`
40+
src.asExpr() = this and
41+
// This traces to a getter
42+
KnownOpenSSLAlgorithmToAlgorithmValueConsumerFlow::flow(src, sink)
43+
)
44+
or
45+
// Possibility 2:
46+
this instanceof DirectAlgorithmValueConsumer and getterCall = this
47+
}
48+
49+
override OpenSSLAlgorithmValueConsumer getAVC() { result = getterCall }
50+
51+
override Crypto::TKeyAgreementType getKeyAgreementType() {
52+
knownOpenSSLConstantToKeyAgreementFamilyType(this, result)
53+
or
54+
not knownOpenSSLConstantToKeyAgreementFamilyType(this, _) and
55+
result = Crypto::OtherKeyAgreementType()
56+
}
57+
58+
override string getRawKeyAgreementAlgorithmName() {
59+
result = this.(Literal).getValue().toString()
60+
or
61+
result = this.(Call).getTarget().getName()
62+
}
63+
}

0 commit comments

Comments
 (0)