laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/36970?usp=email )
Change subject: esim.bsp: Fix a bug in demac_only_one() ......................................................................
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(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved lynxis lazus: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve
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: