From patchwork Thu Apr 21 15:12:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 613148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3qrMhD65Rmz9t3q for ; Fri, 22 Apr 2016 01:13:16 +1000 (AEST) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id E2BAF13296; Thu, 21 Apr 2016 15:13:13 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.sysmocom.de (mail.sysmocom.de [IPv6:2a01:4f8:191:444c::2:4]) by lists.osmocom.org (Postfix) with ESMTP id B590A13288 for ; Thu, 21 Apr 2016 15:13:12 +0000 (UTC) Received: from mail.sysmocom.de (mail.sysmocom.de [144.76.43.93]) by mail.sysmocom.de (Postfix) with ESMTP id 347511B21DB; Thu, 21 Apr 2016 15:12:42 +0000 (UTC) Received: from pbell.local (shnet2-91.in-berlin.de [217.197.83.91]) by mail.sysmocom.de (Postfix) with ESMTPSA id B36DC1B21D8; Thu, 21 Apr 2016 15:12:41 +0000 (UTC) From: msuraev@sysmocom.de To: openbsc@lists.osmocom.org Subject: [PATCH] Deprecate comp128 Date: Thu, 21 Apr 2016 17:12:40 +0200 Message-Id: <1461251560-23628-1-git-send-email-msuraev@sysmocom.de> X-Mailer: git-send-email 2.8.1 X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max Mark function as deprecated to discourage its usage: people should use generic API in osmocom/crypt/auth.h --- 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 +#include + /* - * Performs the COMP128 algorithm (used as A3/A8) + * Performs the COMP128v1 algorithm (used as A3/A8) * 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); + +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); 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); +}