<p style="white-space: pre-wrap; word-wrap: break-word;">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.</p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #d4ffd4;">Code-Review +1</span></p><p><a href="https://gerrit.osmocom.org/c/osmo-msc/+/22766">View Change</a></p><p>2 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/gsm_04_08.c">File src/libmsc/gsm_04_08.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/gsm_04_08.c@415">Patch Set #1, Line 415:</a> <code style="font-family:monospace,monospace">                               is_utran ? net->uea_encryption_mask > 0x01 : net->a5_encryption_mask > 0x01,</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/msc_net_init.c">File src/libmsc/msc_net_init.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-msc/+/22766/1/src/libmsc/msc_net_init.c@71">Patch Set #1, Line 71:</a> <code style="font-family:monospace,monospace">  net->uea_encryption_mask = (1 << 2) | (1 << 1);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">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.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Is uea_encryption_mask a mask of discrete bits or does it contain the algorithm number?</p><p style="white-space: pre-wrap; word-wrap: break-word;">0 = 00 off<br>1 = 01 UEA1<br>2 = 10 UEA2</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-msc/+/22766">change 22766</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-msc/+/22766"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-msc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I91f9e50f9c1439aa19528f887b83ae9de628fcfd </div>
<div style="display:none"> Gerrit-Change-Number: 22766 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 19 Apr 2021 13:42:37 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>