Skip to content

Commit d14731c

Browse files
committed
Update IKEv2 tests with new X509_AlgorithmIdentifier
1 parent 1719971 commit d14731c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

scapy/asn1fields.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
BER_tagging_enc,
3232
)
3333
from scapy.base_classes import BasePacket
34-
from scapy.compat import raw
3534
from scapy.volatile import (
3635
GeneralizedTime,
3736
RandChoice,
@@ -489,6 +488,7 @@ def m2i(self, pkt, s):
489488
obj.set_val(pkt, None)
490489
else:
491490
for obj in self.seq:
491+
# DEBUG: print(repr(obj), repr)
492492
try:
493493
s = obj.dissect(pkt, s)
494494
except ASN1F_badsequence:
@@ -599,7 +599,7 @@ def build(self, pkt):
599599
elif val is None:
600600
s = b""
601601
else:
602-
s = b"".join(raw(i) for i in val)
602+
s = b"".join(bytes(i) for i in val)
603603
return self.i2m(pkt, s)
604604

605605
def i2repr(self, pkt, x):
@@ -769,7 +769,7 @@ def i2m(self, pkt, x):
769769
if x is None:
770770
s = b""
771771
else:
772-
s = raw(x)
772+
s = bytes(x)
773773
if hash(type(x)) in self.pktchoices:
774774
imp, exp = self.pktchoices[hash(type(x))]
775775
s = BER_tagging_enc(s,
@@ -852,11 +852,11 @@ def i2m(self,
852852
s = x
853853
elif isinstance(x, ASN1_Object):
854854
if x.val:
855-
s = raw(x.val)
855+
s = bytes(x.val)
856856
else:
857857
s = b""
858858
else:
859-
s = raw(x)
859+
s = bytes(x)
860860
if not hasattr(x, "ASN1_root"):
861861
# A normal Packet (!= ASN1)
862862
return s
@@ -897,7 +897,7 @@ def __init__(self,
897897
self.cls = cls
898898
super(ASN1F_BIT_STRING_ENCAPS, self).__init__( # type: ignore
899899
name,
900-
default and raw(default),
900+
default and bytes(default),
901901
context=context,
902902
implicit_tag=implicit_tag,
903903
explicit_tag=explicit_tag

scapy/layers/smb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,9 @@ class NETLOGON_SAM_LOGON_RESPONSE_NT40(NETLOGON):
10031003
0x00002000: "WS",
10041004
0x00004000: "DS_8", # >=2008R2
10051005
0x00008000: "DS_9", # >=2012
1006-
0x00010000: "DS_10", # >=2016
1007-
0x00020000: "DS_11", # >=2019
1008-
0x00040000: "DS_12", # >=2025
1006+
0x00010000: "DS_10", # >=2016
1007+
0x00020000: "DS_11", # >=2019
1008+
0x00040000: "DS_12", # >=2025
10091009
0x20000000: "DNS_CONTROLLER",
10101010
0x40000000: "DNS_DOMAIN",
10111011
0x80000000: "DNS_FOREST",

scapy/layers/spnego.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
ASN1F_optional,
4040
)
4141
from scapy.asn1packet import ASN1_Packet
42-
from scapy.base_classes import Net
4342
from scapy.fields import (
4443
FieldListField,
4544
LEIntEnumField,
@@ -63,7 +62,6 @@
6362
valid_ip6,
6463
)
6564

66-
from scapy.layers.inet6 import Net6
6765
from scapy.layers.gssapi import (
6866
GSSAPI_BLOB,
6967
GSSAPI_BLOB_SIGNATURE,

scapy/layers/x509.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,10 @@ class X509_AlgorithmIdentifier(ASN1_Packet):
893893
),
894894
lambda pkt: pkt.algorithm.val == "1.2.840.113549.1.3.1",
895895
),
896+
896897
],
897-
ASN1F_optional(ASN1F_NULL("parameters", None)),
898+
# RFC4055 (=1.2.840.113549.1.1.11) / Default
899+
ASN1F_optional(ASN1F_NULL("parameters", 0)),
898900
)
899901
)
900902

test/contrib/ikev2.uts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ frames = [
781781
subjectPublicKeyInfo=X509_SubjectPublicKeyInfo(
782782
signatureAlgorithm=X509_AlgorithmIdentifier(
783783
algorithm=ASN1_OID('ecPublicKey'),
784-
parameters=ASN1_OID('prime256v1')),
784+
parameters=ECParameters(curve=ASN1_OID('prime256v1'))),
785785
subjectPublicKey=ECDSAPublicKey(
786786
ecPoint=ASN1_BIT_STRING(
787787
'000001001011011101000101011100101010000110110101110111010001110'
@@ -1125,7 +1125,7 @@ frames = [
11251125
subjectPublicKeyInfo=X509_SubjectPublicKeyInfo(
11261126
signatureAlgorithm=X509_AlgorithmIdentifier(
11271127
algorithm=ASN1_OID('ecPublicKey'),
1128-
parameters=ASN1_OID('prime256v1')
1128+
parameters=ECParameters(curve=ASN1_OID('prime256v1')),
11291129
),
11301130
subjectPublicKey=ECDSAPublicKey(
11311131
ecPoint=ASN1_BIT_STRING(

0 commit comments

Comments
 (0)