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/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/22432 ) Change subject: select_best_cipher(): Prefer A5/1 over A5/2 ...................................................................... select_best_cipher(): Prefer A5/1 over A5/2 We cannot simply use the highest 'x' in A5/x codecs. For A5/7 through A5/3, larger 'x' means better. But: A5/1 is better than A5/2, so we need to prefer the former over the latter. Change-Id: I399fff8d07d1bfcbc6b385e90914ff6d9e00eb73 Closes: OS#4975 --- M src/osmo-bsc/osmo_bsc_bssap.c 1 file changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/32/22432/1 diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 63dee9e..9d78153 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -402,12 +402,16 @@ /* select the best cipher permitted by the intersection of both masks */ static int select_best_cipher(uint8_t msc_mask, uint8_t bsc_mask) { + /* A5/7 ... A5/3: We assume higher is better, + * but: A5/1 is better than A5/2, which is better than A5/0 */ + const uint8_t codec_strength[8] = { 7, 6, 5, 4, 3, 1, 2, 0 }; uint8_t intersection = msc_mask & bsc_mask; int i; - for (i = 7; i >= 0; i--) { - if (intersection & (1 << i)) - return i; + for (i = 0; i < ARRAY_SIZE(codec_strength); i++) { + uint8_t codec = codec_strength[i]; + if (intersection & (1 << codec)) + return codec; } return -1; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/22432 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I399fff8d07d1bfcbc6b385e90914ff6d9e00eb73 Gerrit-Change-Number: 22432 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210125/fa1a023b/attachment.htm>