dexter has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/22766 )

Change subject: Make UTRAN encryption algorithms configurable
......................................................................


Patch Set 1: Code-Review+1

(2 comments)

This looks good to me, however I find it a bit difficult to read. On the one 
hand the code is handling the encryption parameter as a bitbask on the other 
hand it handles the same encryption parameter as an integer variable with a 
value from 0-2.

https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/gsm_04_08.c
File src/libmsc/gsm_04_08.c:

https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/gsm_04_08.c@415
PS1, Line 415:                          is_utran ? net->uea_encryption_mask > 
0x01 : net->a5_encryption_mask > 0x01,
This logic > 0x01 is a bit confusion to read. Apparently you are comparing the 
algorithm number (1-2) here. So if a number from 1-2 is set, then the 
encryption is present, if the number is 0 then no encryption is active at all. 
The 0x gives the impression that some bitmask is compared in a wired way. Maybe 
just writing ... > 1 makes the code more readable. Also a comment might be 
helpful.


https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/msc_net_init.c
File src/libmsc/msc_net_init.c:

https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/msc_net_init.c@71
PS1, Line 71:   net->uea_encryption_mask = (1 << 2) | (1 << 1);
Maybe it is better to add some define constants, also together with the 
greater-then logic in gsm_04_08.c its a bit difficult to understand what is 
going on.

Is uea_encryption_mask a mask of discrete bits or does it contain the algorithm 
number?

0 = 00 off
1 = 01 UEA1
2 = 10 UEA2



--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/22766
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I91f9e50f9c1439aa19528f887b83ae9de628fcfd
Gerrit-Change-Number: 22766
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: neels <[email protected]>
Gerrit-Comment-Date: Mon, 19 Apr 2021 13:42:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Reply via email to