Ofono has too tight limits for SIM lock code lengths
Hi,
I've been testing SIM locks with Ofono and it looks to me that method is_valid_pin in src/common.c has somewhat too tight rules for PIN lenghts. SIM or subsidy lock codes can be longer than 8 digits (as dictated in 22.022 chapter 14)
There are several ways to fix this. My current favourite is changing the is_valid_pin so that it takes the actual return value of sim_string_to_passwd instead of pin_type enumaration as parameter and checks with 16-digit limit the SIM locks.
Other option that comes to my mind would be separate a valid check method for SIM locks.
As third option I suggest adding fifth value to pin_type enumeration and give that as a parameter for is_valid_pin to make it use different limits. It would require more specific code type recognition in calling function though.
Opinions? Other ideas?
Br,
-Jussi
Hi Jussi,
Quoted 7 lines · Jussi Kangas
Hi,
I've been testing SIM locks with Ofono and it looks to me that method
is_valid_pininsrc/common.chas somewhat too tight rules for PIN lenghts. SIM or subsidy lock codes can be longer than 8 digits (as dictated in 22.022 chapter 14)
You might very well be correct. The current assumptions are based on 11.11, but I'm not sure if USIMs or newer have relaxed these restrictions. Maybe others can chime in here.
Quoted 5 lines
There are several ways to fix this. My current favourite is changing the
is_valid_pinso that it takes the actual return value ofsim_string_to_passwdinstead ofpin_typeenumaration as parameter and checks with 16-digit limit the SIM locks.
Quoted 7 lines
Other option that comes to my mind would be separate a valid check method for SIM locks.
As third option I suggest adding fifth value to
pin_typeenumeration and give that as a parameter foris_valid_pinto make it use different limits. It would require more specific code type recognition in calling function though.
The first option sounds reasonable to me as a first attempt. Care to submit a proposal?
Regards,
-Denis