@@ -1 +1,2 @@
#library what description / commit summary line
+libosmogsm api-change remove osmo_a5_1 and osmo_a5_2 - generic osmo_a5 should suffice for all use cases
\ No newline at end of file
@@ -54,7 +54,5 @@ osmo_a5_fn_count(uint32_t fn)
* (converted internally to fn_count)
*/
int osmo_a5(int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
-void osmo_a5_1(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
-void osmo_a5_2(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul);
/*! @} */
@@ -39,46 +39,6 @@
#include <osmocom/gsm/a5.h>
-/*! \brief Main method to generate a A5/x cipher stream
- * \param[in] n Which A5/x method to use
- * \param[in] key 8 byte array for the key (as received from the SIM)
- * \param[in] fn Frame number
- * \param[out] dl Pointer to array of ubits to return Downlink cipher stream
- * \param[out] ul Pointer to array of ubits to return Uplink cipher stream
- * \returns 0 for success, -ENOTSUP for invalid cipher selection.
- *
- * Currently A5/[0-2] are supported.
- * Either (or both) of dl/ul can be NULL if not needed.
- */
-int
-osmo_a5(int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
-{
- switch (n)
- {
- case 0:
- if (dl)
- memset(dl, 0x00, 114);
- if (ul)
- memset(ul, 0x00, 114);
- break;
-
- case 1:
- osmo_a5_1(key, fn, dl, ul);
- break;
-
- case 2:
- osmo_a5_2(key, fn, dl, ul);
- break;
-
- default:
- /* a5/[3..7] not supported here/yet */
- return -ENOTSUP;
- }
-
- return 0;
-}
-
-
/* ------------------------------------------------------------------------ */
/* A5/1&2 common stuff */
/* ------------------------------------------------------------------------ */
@@ -190,8 +150,8 @@ _a5_1_get_output(uint32_t r[])
*
* Either (or both) of dl/ul can be NULL if not needed.
*/
-void
-osmo_a5_1(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
+static void
+_a5_1(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
{
uint32_t r[3] = {0, 0, 0};
uint32_t fn_count;
@@ -307,8 +267,8 @@ _a5_2_get_output(uint32_t r[])
*
* Either (or both) of dl/ul can be NULL if not needed.
*/
-void
-osmo_a5_2(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
+static void
+_a5_2(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
{
uint32_t r[4] = {0, 0, 0, 0};
uint32_t fn_count;
@@ -368,4 +328,43 @@ osmo_a5_2(const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
}
}
+/*! \brief Main method to generate a A5/x cipher stream
+ * \param[in] n Which A5/x method to use
+ * \param[in] key 8 byte array for the key (as received from the SIM)
+ * \param[in] fn Frame number
+ * \param[out] dl Pointer to array of ubits to return Downlink cipher stream
+ * \param[out] ul Pointer to array of ubits to return Uplink cipher stream
+ * \returns 0 for success, -ENOTSUP for invalid cipher selection.
+ *
+ * Currently A5/[0-2] are supported.
+ * Either (or both) of dl/ul can be NULL if not needed.
+ */
+int
+osmo_a5(int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul)
+{
+ switch (n)
+ {
+ case 0:
+ if (dl)
+ memset(dl, 0x00, 114);
+ if (ul)
+ memset(ul, 0x00, 114);
+ break;
+
+ case 1:
+ _a5_1(key, fn, dl, ul);
+ break;
+
+ case 2:
+ _a5_2(key, fn, dl, ul);
+ break;
+
+ default:
+ /* a5/[3..7] not supported here/yet */
+ return -ENOTSUP;
+ }
+
+ return 0;
+}
+
/*! @} */
@@ -195,8 +195,6 @@ ms_pwr_ctl_lvl;
ms_pwr_dbm;
osmo_a5;
-osmo_a5_1;
-osmo_a5_2;
osmo_auth_alg_name;
osmo_auth_alg_parse;
Signed-off-by: Max Suraev <Max.Suraev@fairwaves.co> --- TODO-RELEASE | 1 + include/osmocom/gsm/a5.h | 2 -- src/gsm/a5.c | 87 ++++++++++++++++++++++++------------------------ src/gsm/libosmogsm.map | 2 -- 4 files changed, 44 insertions(+), 48 deletions(-)