laforge has uploaded this change for review.
esim.bsp: Fix a bug in demac_only_one()
When de-MAC-ing at the recipient side, we must increment the cipher(!)
block number even if no ciphering is done at all.
We did this correctly for MAC (sender) case, but not on the de-MAC
(receiver) case.
Change-Id: I97993f9e8357b36401d435aaa15558d1c7e411eb
---
M pySim/esim/bsp.py
1 file changed, 17 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/70/36970/1
diff --git a/pySim/esim/bsp.py b/pySim/esim/bsp.py
index 2afbd46..81fe092 100644
--- a/pySim/esim/bsp.py
+++ b/pySim/esim/bsp.py
@@ -287,6 +287,8 @@
def demac_only_one(self, ciphertext: bytes) -> bytes:
payload = self.m_algo.verify(ciphertext)
_tdict, _l, val, _remain = bertlv_parse_one(payload)
+ # The data block counter for ICV caluclation is incremented also for each segment with C-MAC only.
+ self.c_algo.block_nr += 1
return val
def demac_only(self, ciphertext_list: List[bytes]) -> bytes:
To view, visit change 36970. To unsubscribe, or for help writing mail filters, visit settings.