Skip to content

Commit 5dbaf1b

Browse files
committed
merge main
2 parents 9b87f1f + f48012a commit 5dbaf1b

File tree

82 files changed

+10261
-692
lines changed

Some content is hidden

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

82 files changed

+10261
-692
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

MODULE.bazel

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,24 +239,24 @@ go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
239239
go_deps.from_file(go_mod = "//go/extractor:go.mod")
240240
use_repo(go_deps, "org_golang_x_mod", "org_golang_x_tools")
241241

242-
lfs_files = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_files")
242+
lfs_archive = use_repo_rule("//misc/bazel:lfs.bzl", "lfs_archive")
243243

244-
lfs_files(
244+
lfs_archive(
245245
name = "ripunzip-linux",
246-
srcs = ["//misc/ripunzip:ripunzip-linux"],
247-
executable = True,
246+
src = "//misc/ripunzip:ripunzip-Linux.zip",
247+
build_file = "//misc/ripunzip:BUILD.ripunzip.bazel",
248248
)
249249

250-
lfs_files(
250+
lfs_archive(
251251
name = "ripunzip-windows",
252-
srcs = ["//misc/ripunzip:ripunzip-windows.exe"],
253-
executable = True,
252+
src = "//misc/ripunzip:ripunzip-Windows.zip",
253+
build_file = "//misc/ripunzip:BUILD.ripunzip.bazel",
254254
)
255255

256-
lfs_files(
256+
lfs_archive(
257257
name = "ripunzip-macos",
258-
srcs = ["//misc/ripunzip:ripunzip-macos"],
259-
executable = True,
258+
src = "//misc/ripunzip:ripunzip-macOS.zip",
259+
build_file = "//misc/ripunzip:BUILD.ripunzip.bazel",
260260
)
261261

262262
register_toolchains(

cpp/downgrades/59cb96ca699929b63941e81905f9b8de7eed59a6/preprocdirects.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ int getKind(int kind) {
1111
if kind = 14
1212
then result = 6 // Represent MSFT #import as #include
1313
else
14-
if kind = 15 or kind = 6
14+
if kind = 15 or kind = 16
1515
then result = 3 // Represent #elifdef and #elifndef as #elif
1616
else result = kind
1717
}

cpp/misc/bulk_generation_targets.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"strategy": "dca",
3+
"language": "cpp",
4+
"targets": [
5+
{ "name": "openssl", "with-sources": false, "with-sinks": false },
6+
{ "name": "sqlite", "with-sources": false, "with-sinks": false }
7+
],
8+
"destination": "cpp/ql/lib/ext/generated"
9+
}

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)