[PATCH] Deprecate comp128

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Tue Apr 26 11:14:37 UTC 2016


On Thu, Apr 21, 2016 at 05:12:40PM +0200, msuraev at sysmocom.de wrote:
> From: Max <msuraev at sysmocom.de>
> 
> Mark function as deprecated to discourage its usage: people should use
> generic API in osmocom/crypt/auth.h

There is much more going on in this patch than your log message
suggests...

> ---
>  include/osmocom/gsm/comp128.h | 8 ++++++--
>  src/gsm/auth_comp128v1.c      | 2 +-
>  src/gsm/comp128.c             | 7 ++++++-
>  3 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/include/osmocom/gsm/comp128.h b/include/osmocom/gsm/comp128.h
> index 33b997a..8ff76b1 100644
> --- a/include/osmocom/gsm/comp128.h
> +++ b/include/osmocom/gsm/comp128.h
> @@ -8,11 +8,15 @@
>  
>  #include <stdint.h>
>  
> +#include <osmocom/core/defs.h>
> +
>  /*
> - * Performs the COMP128 algorithm (used as A3/A8)
> + * Performs the COMP128v1 algorithm (used as A3/A8)

...comments...

>   * ki    : uint8_t [16]
>   * srand : uint8_t [16]
>   * sres  : uint8_t [4]
>   * kc    : uint8_t [8]
>   */
> -void comp128(const uint8_t *ki, const uint8_t *srand, uint8_t *sres, uint8_t *kc);
> +void comp128v1(const uint8_t *ki, const uint8_t *srand, uint8_t *sres, uint8_t *kc);

...new function...

> +
> +void comp128(const uint8_t *ki, const uint8_t *srand, uint8_t *sres, uint8_t *kc) OSMO_DEPRECATED("Use generic API from osmocom/crypt/auth.h instead");
> diff --git a/src/gsm/auth_comp128v1.c b/src/gsm/auth_comp128v1.c
> index 41aef71..c40027e 100644
> --- a/src/gsm/auth_comp128v1.c
> +++ b/src/gsm/auth_comp128v1.c
> @@ -28,7 +28,7 @@ static int c128v1_gen_vec(struct osmo_auth_vector *vec,
>  			  struct osmo_sub_auth_data *aud,
>  			  const uint8_t *_rand)
>  {
> -	comp128(aud->u.gsm.ki, _rand, vec->sres, vec->kc);
> +	comp128v1(aud->u.gsm.ki, _rand, vec->sres, vec->kc);

...or is it a rename after all...

>  	vec->auth_types = OSMO_AUTH_TYPE_GSM;
>  
>  	return 0;
> diff --git a/src/gsm/comp128.c b/src/gsm/comp128.c
> index b7a2382..abb4917 100644
> --- a/src/gsm/comp128.c
> +++ b/src/gsm/comp128.c
> @@ -185,7 +185,7 @@ _comp128_permutation(uint8_t *x, uint8_t *bits)
>  }
>  
>  void
> -comp128(const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
> +comp128v1(const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
>  {
>  	int i;
>  	uint8_t x[32], bits[128];
> @@ -228,3 +228,8 @@ comp128(const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
>  	kc[7] = 0;
>  }
>  
> +void
> +comp128(const uint8_t *ki, const uint8_t *rand, uint8_t *sres, uint8_t *kc)
> +{
> +    comp128v1(ki, rand, sres, kc);
> +}

...why add a deprecation but also add a shim to avoid it?

These things should definitely be in the commit log message.

Also the first log line looks like you were deprecating the algorithm
comp128 itself, maybe say "comp128()" to illustrate it's just a function?

~Neels

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20160426/6f7e2f5e/attachment.bin>


More information about the OpenBSC mailing list