[PATCH] Addditional classmark check against A5/X support

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

Max.Suraev at fairwaves.co
Tue Jun 17 08:56:35 UTC 2014


16.06.2014 23:04, Sylvain Munaut пишет:
>
>> -                       return 0;
>> +                       return (n > 7) ? 0 : -1;
>>         }
>>  }
> 
> Why this change ?  I mean, you'd now have to go over __every_ use of
> that function in all projects and make sure it's not used in something
> like :
> 
> if (!ms_cm2_a5n_support(cm2, n)) {
>    error
> }
> 
> Because an invalid n is now going to return something != 0 ...
> 

I thought it's better to expose error case explicitly.


>> +static inline int ms_a5n_support(uint8_t *cm, unsigned n) {
>> +    return ((n < 4) ? ms_cm2_a5n_support(cm, n) : ms_cm3_a5n_support(cm, n));
>> +}
>> +
> 
> Huh ... so the called has to know whether to give CM2 or CM3 ... you
> might as well not have this method at all then and just require it to
> call the right method.
> 

I'm not sure what you mean in here - we call this function with some classmark
(either 2 or 3) and number from a5/n to check if this cipher support is indicated in
the classmark. Anyway - just a little convenience wrapper.


-- 
best regards,
Max, http://fairwaves.co




More information about the baseband-devel mailing list