Attention is currently required from: dexter, fixeria.
laforge has posted comments on this change. (
https://gerrit.osmocom.org/c/pysim/+/35488?usp=email )
Change subject: Add pySim.esim.bsp module implementing BSP (BPP Protection Protocol)
......................................................................
Patch Set 4:
(11 comments)
File pySim/esim/bsp.py:
https://gerrit.osmocom.org/c/pysim/+/35488/comment/bec36162_9ad70d18
PS4, Line 46: blocksize
You can simply do a type declaration here: […]
My experience in other situations that if you don't assign it None, pylint will
complain if you start using it in parent classes' methods (Even if 'abc.ABC').
But I'll add the type annotation.
Assigning it during init would be wrong for any non-singleton, right? Those are, after
all, class variables and not instance variables?
https://gerrit.osmocom.org/c/pysim/+/35488/comment/144d22a3_99b9f3e9
PS4, Line 47: enum_name
unused?
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/8aee4ba9_35d16cae
PS4, Line 60: __init__
can be removed?
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/c4994dd2_8cb6aa86
PS4, Line 95: abc.abstractmethod
why commented out?
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/d4e4be28_66905bae
PS4, Line 104: _get_padding
Can we re-use the parent's implementation here?
[…]
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/3c390d54_c6d60f21
PS4, Line 124: _get_icv
Can we pre-calculate the ICV once (e.g. in
`__init__()`) and then just use it in `self. […]
_get_icv() depends on self.block_nr
which increments every time you cal it. So yes, the ICV changes for each block of
encrypted/decrypted data and it cannot be pre-computed in __init__.
https://gerrit.osmocom.org/c/pysim/+/35488/comment/c8f95664_bce64647
PS4, Line 132: % (self.block_nr, b2h(data), b2h(icv
JFYI: when using Python's logging, you can pass
format string arguments directly to the logging func […]
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/d07ac98c_ab27ac32
PS4, Line 153: tag <= 255
This still permits negative values, maybe `assert tag
in range(256)`?
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/7d074536_e71ce899
PS4, Line 299: return b''.join(plaintext_list)
Maybe use list-comprehension here? […]
Done
https://gerrit.osmocom.org/c/pysim/+/35488/comment/87c5a559_7bffc6cf
PS4, Line 310: return b''.join(plaintext_list)
Maybe use list-comprehension here? […]
I decided
to make it two lines (but use list comprhension) to reduce complexity in one line.
File tests/test_esim_bsp.py:
https://gerrit.osmocom.org/c/pysim/+/35488/comment/0c6f30c1_21564414
PS4, Line 62: segment0 =
h2b('a048800102810101821a53494d616c6c69616e63652053616d706c652050726f66696c65830a89000123456789012341a506810084008b00a610060667810f010201060667810f010204b08201f8a0058000810101810667810f010201a207a105c60301020aa305a1038b010fa40c830a98001032547698103214a527a109820442210026800198831a61184f10a0000000871002ff33ff01890000010050045553494da682019ea10a8204422100258002022b831b8001019000800102a406830101950108800158a40683010a95010882010a8316800101a40683010195010880015aa40683010a95010882010f830b80015ba40683010a95010882011a830a800101900080015a970082011b8316800103a406830101950108800158a40683010a95010882010f8316800111a40683010195010880014aa40683010a95010882010f8321800103a406830101950108800158a40683010a950108840132a4068301019501088201048321800101a406830101950108800102a406830181950108800158a40683010a950108820104831b800101900080011aa406830101950108800140a40683010a95010882010a8310800101900080015aa40683010a95010882011583158001019000800118a40683010a95010880014297008201108310800101a40683010195010880015a97008201158316800113a406830101950108800148a40683010a95010882010f830b80015ea40683010a95010882011a83258001019000800102a010a406830101950108a406830102950108800158a40683010a950108a33fa0058000810102a13630118001018108303030303030303082020099300d800102810831323334353637383012800200818108313233343536373882020088a241a0058000810103a138a0363010800101810831323334ffffffff8201013010800102810830303030ffffffff820102301080010a810835363738ffffffff830101a182029ea0058000810104a18202933082028f62228202782183027ff18410a0000000871002ff33ff0189000001008b010ac60301810a62118202412183026f078b01028001098801388109082943019134876765621482044221002583026f068b010a8801b8c7022f06621a8202412183026f088b0105800121880140a507c00180c10207ff621a8202412183026f098b0105800121880148a507c00180c10207ff62168202412183026f318b0102800101880190a503c1010a62118202412183026f388b010280010e880120810d0a2e178ce73204000000000000621982044221001a83026f3b8b0108800202088800a504c10200ff62198204422100b083026f3c8b0105800206e08800a504c10200ff621282044221002683026f428b0105800126')
not critical, but maybe use multi-line strings
(`''' ... […]
I think it's too much effort (and potentially error
prone) for test data that is copy+pasted from some logs.
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/35488?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ic461936f2e68e1e6f7faab33d06acf3063e261e7
Gerrit-Change-Number: 35488
Gerrit-PatchSet: 4
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Sun, 07 Jan 2024 09:22:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: comment