Skip to content

Commit 631e482

Browse files
committed
Crytpo: when key encapsulation or cipher operations have multiple modes at a node, the node name must reflect that it may be any mode.
1 parent c7be23e commit 631e482

File tree

1 file changed

+28
-6
lines changed
  • shared/quantum/codeql/quantum/experimental

1 file changed

+28
-6
lines changed

shared/quantum/codeql/quantum/experimental/Model.qll

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,9 +1993,20 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
19931993
string nodeName;
19941994

19951995
CipherOperationNode() {
1996-
this.getKeyOperationSubtype() = TEncryptMode() and nodeName = "EncryptOperation"
1997-
or
1998-
this.getKeyOperationSubtype() = TDecryptMode() and nodeName = "DecryptOperation"
1996+
(
1997+
if
1998+
this.getKeyOperationSubtype() = TEncryptMode() and
1999+
this.getKeyOperationSubtype() = TDecryptMode()
2000+
then nodeName = "CipherOperation"
2001+
else (
2002+
if this.getKeyOperationSubtype() = TEncryptMode()
2003+
then nodeName = "EncryptOperation"
2004+
else (
2005+
this.getKeyOperationSubtype() = TDecryptMode() and
2006+
nodeName = "DecryptOperation"
2007+
)
2008+
)
2009+
)
19992010
}
20002011

20012012
override string getInternalType() { result = nodeName }
@@ -2005,9 +2016,20 @@ module CryptographyBase<LocationSig Location, InputSig<Location> Input> {
20052016
string nodeName;
20062017

20072018
KeyEncapsulationOperationNode() {
2008-
this.getKeyOperationSubtype() = TWrapMode() and nodeName = "WrapOperation"
2009-
or
2010-
this.getKeyOperationSubtype() = TUnwrapMode() and nodeName = "UnwrapOperation"
2019+
(
2020+
if
2021+
this.getKeyOperationSubtype() = TWrapMode() and
2022+
this.getKeyOperationSubtype() = TUnwrapMode()
2023+
then nodeName = "KeyEncapsulationOperation"
2024+
else (
2025+
if this.getKeyOperationSubtype() = TWrapMode()
2026+
then nodeName = "WrapOperation"
2027+
else (
2028+
this.getKeyOperationSubtype() = TUnwrapMode() and
2029+
nodeName = "UnwrapOperation"
2030+
)
2031+
)
2032+
)
20112033
}
20122034

20132035
override string getInternalType() { result = nodeName }

0 commit comments

Comments
 (0)