Skip to content

Commit

Permalink
applied feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
polybassa committed May 22, 2024
1 parent 65f3ab9 commit 88f144c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ all = [
"matplotlib",
]
doc = [
"cryptography>=2.0",
"sphinx>=7.0.0",
"sphinx_rtd_theme>=1.3.0",
"tox>=3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion scapy/contrib/automotive/autosar/pdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PDU(Packet):
name = 'PDU'
fields_desc = [
XIntField('pdu_id', 0),
LenField('pdu_payload_len', 0, fmt="I")]
LenField('pdu_payload_len', None, fmt="I")]

def extract_padding(self, s):
# type: (bytes) -> Tuple[bytes, Optional[bytes]]
Expand Down
11 changes: 9 additions & 2 deletions scapy/contrib/automotive/autosar/secoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,15 @@
"""
import struct

from cryptography.hazmat.primitives import cmac
from cryptography.hazmat.primitives.ciphers import algorithms
from scapy.config import conf
from scapy.error import log_loading

if conf.crypto_valid:
from cryptography.hazmat.primitives import cmac
from cryptography.hazmat.primitives.ciphers import algorithms
else:
log_loading.info("Can't import python-cryptography v1.7+. "
"Disabled SecOC calculate_cmac.")

from scapy.base_classes import Packet_metaclass
from scapy.config import conf
Expand Down
2 changes: 1 addition & 1 deletion test/contrib/automotive/autosar/pdu.uts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ assert p.pdus == [PDU()]

p = PDU()
assert p.pdu_id == 0
assert p.pdu_payload_len == 0
assert p.pdu_payload_len == None

= Build test pdu_id
p = PDU(bytes(PDU(pdu_id=0x11)))
Expand Down

0 comments on commit 88f144c

Please sign in to comment.