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/.
Sylvain Munaut 246tnt at gmail.comHi, > /* According to GSM 04.08 Chapter 10.5.1.6 */ > -static inline int ms_cm2_a5n_support(uint8_t *cm2, int n) { > +static inline int ms_cm2_a5n_support(uint8_t *cm2, unsigned n) { > switch (n) { > case 0: return 1; > case 1: return (cm2[0] & (1<<3)) ? 0 : 1; > case 2: return (cm2[2] & (1<<0)) ? 1 : 0; > case 3: return (cm2[2] & (1<<1)) ? 1 : 0; > default: > - 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 ... > +/*! \brief Check whether MS supports given cipher > + * \param[in] cm Classmark data transmitted by MS, cannot be NULL > + * \param[in] n Cipher number - A5/n > + * \returns 1 if supported, 0 if unsupported, -1 on failures > + * > + * Implementation based on specifications from GSM 04.08 > + * parts 10.5.1.6 and 10.5.1.7. > + */ > +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. Cheers, Sylvain