[PATCH] Use generic osmocom auth api

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/.

Max.Suraev at fairwaves.ru
Tue Nov 19 12:45:14 UTC 2013


Improved version attached.

19.11.2013 13:32, Peter Stuge пишет:
> Hi,
> 
> ☎ wrote:
>> Attached is a small patch which replaces direct call to comp128
>> from libosmocore to auth api call.
> 
> Thanks!
> 
> 
>> +++ b/openbsc/src/libmsc/auth.c
> ..
>> @@ -60,9 +59,17 @@ _use_comp128_v1(struct gsm_auth_info *ainfo, struct gsm_auth_tuple *atuple)
>>  		return -1;
>>  	}
>>  
>> -	comp128(ainfo->a3a8_ki, atuple->rand, atuple->sres, atuple->kc);
>> -
>> -	return 0;
>> +	static struct osmo_sub_auth_data auth = {
>> +	    .type = OSMO_AUTH_TYPE_GSM,
>> +	    .algo = OSMO_AUTH_ALG_COMP128v1
>> +	};
>> +	memcpy(auth.u.gsm.ki, ainfo->a3a8_ki, sizeof(auth.u.gsm.ki));
>> +	struct osmo_auth_vector _vec;
>> +	struct osmo_auth_vector *vec = &_vec;
>> +	int r = osmo_auth_gen_vec(vec, &auth, atuple->rand);
>> +	memcpy(atuple->sres, vec->sres, 4);
>> +	memcpy(atuple->kc, vec->kc, 8);
>> +	return r;
>>  }
> 
> Maybe add a newline or two, and I think the openbsc style is to
> declare all variables at the start of the function.
> 
> 
> //Peter
> 


-- 
best regards,
Max, http://fairwaves.ru


More information about the OpenBSC mailing list