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