<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/pysim/+/23258">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix TypeError in derive_milenage_opc()<br><br>In 4f6ca43e1f6726f00cfc91ff6d17db6878316c4d we started to use<br>the bytearray type as 'b' type, but PyCrypto insists on getting<br>a bytearray type.<br><br>This fixes the following Exception:<br>TypeError: argument 1 must be read-only bytes-like object, not bytearray<br><br>Change-Id: If2a727ed417ffd56c0f7d7b4e9f633d67fde5ced<br>Closes: OS#5060<br>---<br>M pySim/utils.py<br>1 file changed, 5 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/58/23258/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/pySim/utils.py b/pySim/utils.py</span><br><span>index 5320b59..2d77f0f 100644</span><br><span>--- a/pySim/utils.py</span><br><span>+++ b/pySim/utils.py</span><br><span>@@ -244,9 +244,11 @@</span><br><span>       from pySim.utils import b2h</span><br><span> </span><br><span>      # We pass in hex string and now need to work on bytes</span><br><span style="color: hsl(0, 100%, 40%);">-   aes = AES.new(h2b(ki_hex))</span><br><span style="color: hsl(0, 100%, 40%);">-      opc_bytes = aes.encrypt(h2b(op_hex))</span><br><span style="color: hsl(0, 100%, 40%);">-    return b2h(strxor(opc_bytes, h2b(op_hex)))</span><br><span style="color: hsl(120, 100%, 40%);">+    ki_bytes = bytes(h2b(ki_hex))</span><br><span style="color: hsl(120, 100%, 40%);">+ op_bytes = bytes(h2b(op_hex))</span><br><span style="color: hsl(120, 100%, 40%);">+ aes = AES.new(ki_bytes)</span><br><span style="color: hsl(120, 100%, 40%);">+       opc_bytes = aes.encrypt(op_bytes)</span><br><span style="color: hsl(120, 100%, 40%);">+     return s2h(strxor(opc_bytes, op_bytes))</span><br><span> </span><br><span> def calculate_luhn(cc):</span><br><span>       """</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/pysim/+/23258">change 23258</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/pysim/+/23258"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: pysim </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: If2a727ed417ffd56c0f7d7b4e9f633d67fde5ced </div>
<div style="display:none"> Gerrit-Change-Number: 23258 </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-MessageType: newchange </div>