<p>Vadim Yanitskiy <strong>uploaded patch set #9</strong> to this change.</p><p><a href="https://gerrit.osmocom.org/12441">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">layer23/sap_interface.c: reimplement (BT)SAP interface<br><br>The (BT)SAP (Bluetooth SIM Access Profile) is a part of Bluetooth<br>specifications, that defines the protocol and procedures that<br>shall be used to access a smart card (usually GSM SIM) via<br>a Bluetooth link.<br><br>The profile defines two roles:<br><br>  - Server - the side that has direct access to a smart card.<br>    It acts as a SIM card reader, which assists the Client<br>    in accessing and controlling the smart card.<br><br>  - Client - the side that accesses and controls the smart card<br>    inside the Server through the connection with Server.<br><br>Typical examples of a Server are a simple SIM card holder or<br>a portable phone in the car environment. A typical example of<br>a Client is a car phone, which uses a subscription module in<br>the Server for a connection to the cellular network.<br><br>OsmocomBB implements the Client role providing abstract SAP<br>interface API to the higher layers. Instead of Bluetooth,<br>a UNIX socket is used to communicate with a Server.<br><br>The previous implementation of (BT)SAP interface was incomplete<br>and hard to maintain. This change (re)implements it almost from<br>scratch on top of the Osmocom FSM framework.<br><br>Besides that, the most significant changes are:<br><br>  - The implementation is separated into three parts:<br>    - sap_interface.{c|h} - public SAP interface API,<br>    - sap_proto.{c|h} - SAP protocol definition,<br>    - sap_fsm.{c|h} - SAP FSM implementation.<br><br>  - Both 'sap_message' and 'sap_param' structures follow the<br>    SAP message format definition according to 5.1 and 5.2.<br><br>  - The message parsing is done more carefully in order to<br>    prevent buffer overflow and NULL-pointer dereference.<br><br>  - Introduced public API for getting / adding message<br>    parameters, and checking the ResultCode.<br><br>  - Introduced public API for opening / closing a connection<br>    with the server, powering on / off and resetting the SIM<br>    card, sending ATR and APDU.<br><br>  - Introduced a call-back for handling the response message.<br><br>  - Card reader state is also a part of the public API.<br><br>The new implementation was tested against softsim [1]. The<br>only limitation is Server-initiated Release, that allows the<br>Server to 'ask' a Client to release connection as soon as<br>communication with the smart card is finished. This is not<br>implemented (yet), and leads to immediate release.<br><br>[1] https://git.osmocom.org/softsim/<br><br>Change-Id: I77bb108615bb2c94c441568f195b04e0a5421643<br>---<br>M src/host/layer23/include/osmocom/bb/common/Makefile.am<br>M src/host/layer23/include/osmocom/bb/common/osmocom_data.h<br>A src/host/layer23/include/osmocom/bb/common/sap_fsm.h<br>M src/host/layer23/include/osmocom/bb/common/sap_interface.h<br>M src/host/layer23/include/osmocom/bb/common/sap_proto.h<br>M src/host/layer23/include/osmocom/bb/mobile/subscriber.h<br>M src/host/layer23/src/common/Makefile.am<br>A src/host/layer23/src/common/sap_fsm.c<br>M src/host/layer23/src/common/sap_interface.c<br>M src/host/layer23/src/common/sap_proto.c<br>M src/host/layer23/src/mobile/app_mobile.c<br>M src/host/layer23/src/mobile/subscriber.c<br>12 files changed, 1,312 insertions(+), 439 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/41/12441/9</pre><p>To view, visit <a href="https://gerrit.osmocom.org/12441">change 12441</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/12441"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newpatchset </div>
<div style="display:none"> Gerrit-Change-Id: I77bb108615bb2c94c441568f195b04e0a5421643 </div>
<div style="display:none"> Gerrit-Change-Number: 12441 </div>
<div style="display:none"> Gerrit-PatchSet: 9 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Kévin Redon <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-CC: Max <msuraev@sysmocom.de> </div>