Attention is currently required from: dexter, laforge.
13 comments:
Patchset:
None of my comments are critical, mostly nitpicks.
File pySim/esim/bsp.py:
Patch Set #4, Line 46: blocksize
You can simply do a type declaration here:
```
blocksize: int
```
without assigning it to `None`. This is the usual way to declare a property, which is expected to be assigned either statically or by the `__init__()` function.
Patch Set #4, Line 47: enum_name
unused?
Patch Set #4, Line 60: __init__
can be removed?
Patch Set #4, Line 95: abc.abstractmethod
why commented out?
Patch Set #4, Line 104: _get_padding
Can we re-use the parent's implementation here?
```
return b'\x80' + super()._get_padding(in_len + 1, multiple, padding)
```
Patch Set #4, Line 124: _get_icv
Can we pre-calculate the ICV once (e.g. in `__init__()`) and then just use it in `self._{en,de}crypt()`? Or is it supposed to change during the lifetime of a class instance?
Patch Set #4, 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 function (without having to render the string using `"..." % (args...)`). This allows for lazy evaluation.
Patch Set #4, Line 153: tag <= 255
This still permits negative values, maybe `assert tag in range(256)`?
Patch Set #4, Line 299: return b''.join(plaintext_list)
Maybe use list-comprehension here?
```
return b''.join([self.demac_and_decrypt_one(x) for x in ciphertext_list])
```
Patch Set #4, Line 310: return b''.join(plaintext_list)
Maybe use list-comprehension here?
```
return b''.join([self.demac_only_one(x) for x in ciphertext_list])
```
File tests/test_esim_bsp.py:
Patch Set #4, Line 62: segment0 = h2b('a048800102810101821a53494d616c6c69616e63652053616d706c652050726f66696c65830a89000123456789012341a506810084008b00a610060667810f010201060667810f010204b08201f8a0058000810101810667810f010201a207a105c60301020aa305a1038b010fa40c830a98001032547698103214a527a109820442210026800198831a61184f10a0000000871002ff33ff01890000010050045553494da682019ea10a8204422100258002022b831b8001019000800102a406830101950108800158a40683010a95010882010a8316800101a40683010195010880015aa40683010a95010882010f830b80015ba40683010a95010882011a830a800101900080015a970082011b8316800103a406830101950108800158a40683010a95010882010f8316800111a40683010195010880014aa40683010a95010882010f8321800103a406830101950108800158a40683010a950108840132a4068301019501088201048321800101a406830101950108800102a406830181950108800158a40683010a950108820104831b800101900080011aa406830101950108800140a40683010a95010882010a8310800101900080015aa40683010a95010882011583158001019000800118a40683010a95010880014297008201108310800101a40683010195010880015a97008201158316800113a406830101950108800148a40683010a95010882010f830b80015ea40683010a95010882011a83258001019000800102a010a406830101950108a406830102950108800158a40683010a950108a33fa0058000810102a13630118001018108303030303030303082020099300d800102810831323334353637383012800200818108313233343536373882020088a241a0058000810103a138a0363010800101810831323334ffffffff8201013010800102810830303030ffffffff820102301080010a810835363738ffffffff830101a182029ea0058000810104a18202933082028f62228202782183027ff18410a0000000871002ff33ff0189000001008b010ac60301810a62118202412183026f078b01028001098801388109082943019134876765621482044221002583026f068b010a8801b8c7022f06621a8202412183026f088b0105800121880140a507c00180c10207ff621a8202412183026f098b0105800121880148a507c00180c10207ff62168202412183026f318b0102800101880190a503c1010a62118202412183026f388b010280010e880120810d0a2e178ce73204000000000000621982044221001a83026f3b8b0108800202088800a504c10200ff62198204422100b083026f3c8b0105800206e08800a504c10200ff621282044221002683026f428b0105800126')
not critical, but maybe use multi-line strings (`''' ... '''`) for those large samples?
cosmetic: tabs vs spaces
To view, visit change 35488. To unsubscribe, or for help writing mail filters, visit settings.