laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41690?usp=email )
Change subject: pySim.esim.saip.personalization: Support Milenage customization ......................................................................
pySim.esim.saip.personalization: Support Milenage customization
Milenage offers the capability for operators to modify the r1-r5 rotation constants as well as the c1-c5 xor-ing constants; let's add ConfigurableParameters for that.
Change-Id: I397df6c0c708a8061e4adc0fde03a3f746bcb5b6 Related: SYS#7787 --- M pySim/esim/saip/personalization.py 1 file changed, 25 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/90/41690/1
diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py index 053ea0c..068ddba 100644 --- a/pySim/esim/saip/personalization.py +++ b/pySim/esim/saip/personalization.py @@ -322,3 +322,28 @@ if self.input_value not in [1, 2, 3]: raise ValueError('Invalid algorithmID %s' % (self.input_value)) self.value = self.input_value +class MilenageRotationConstants(AlgoConfig, key='rotationConstants'): + """rotation constants r1,r2,r3,r4,r5 of Milenage, Range 0..127. See 3GPP TS 35.206 Sections 2.3 + 5.3. + Provided as octet-string concatenation of all 5 constants.""" + def validate(self): + super().validate() + if len(self.input_value) != 5: + raise('Length of value must be 5 octets') + for r in self.input_value: + if r > 127: + raise ValueError('r values must be between 0 and 127') +class MilenageXoringConstants(AlgoConfig, key='xoringConstants'): + """XOR-ing constants c1,c2,c3,c4,c5 of Milenage, 128bit each. See 3GPP TS 35.206 Sections 2.3 + 5.3. + Provided as octet-string concatenation of all 5 constants.""" + def validate(self): + if len(self.input_value) != 80: + raise('Length of value must be 80 octets') + super().validate() +class TuakNumberOfKeccak(AlgoConfig, key='numberOfKeccak'): + """Number of iterations of Keccak-f[1600] permuitation as recomended by Section 7.2 of 3GPP TS 35.231""" + def validate(self): + if not isinstance(self.input_value, int): + raise ValueError('Value must be an integer') + if self.input_value < 1 or self.input_value > 255: + raise ValueError('Value must be an integer between 1 and 255') + self.value = self.input_value