From c1e9be95c20fb0517efcd5746e38fc95b4d9da14 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Thu, 6 Dec 2012 08:23:02 +0100 Subject: gsm/a5: Return -ENOTSUP if the selected cipher is not supported Extracted from a patch by Max Suraev Max.Suraev@fairwaves.ru> Signed-off-by: Sylvain Munaut --- src/gsm/a5.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gsm/a5.c b/src/gsm/a5.c index 356060ab..de821e89 100644 --- a/src/gsm/a5.c +++ b/src/gsm/a5.c @@ -34,6 +34,7 @@ * \brief Osmocom GSM A5 ciphering algorithm implementation */ +#include #include #include @@ -44,11 +45,12 @@ * \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. */ -void +int osmo_a5(int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) { switch (n) @@ -70,8 +72,10 @@ osmo_a5(int n, const uint8_t *key, uint32_t fn, ubit_t *dl, ubit_t *ul) default: /* a5/[3..7] not supported here/yet */ - break; + return -ENOTSUP; } + + return 0; } -- cgit v1.2.3