Add integration with libosmocore gprs crypto support
This commit is contained in:
parent
6c0803938d
commit
3de78cd69c
|
@ -7,4 +7,5 @@ AM_CFLAGS = -fPIC -Wall
|
|||
|
||||
lib_LTLIBRARIES = libosmo-crypto-a53.la
|
||||
|
||||
libosmo_crypto_a53_la_SOURCES = a53f.c kgcore.c kasumi.c
|
||||
libosmo_crypto_a53_la_SOURCES = a53f.c kgcore.c kasumi.c osmocom.c
|
||||
libosmo_crypto_a53_la_LDFLAGS = -shared
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <osmocom/crypt/gprs_cipher.h>
|
||||
|
||||
#include "kasumi.h"
|
||||
#include "a53f.h"
|
||||
|
||||
static int gea3_run(uint8_t *out, uint16_t len, uint64_t kc, uint32_t iv,
|
||||
enum gprs_cipher_direction direction)
|
||||
{
|
||||
uint8_t dir;
|
||||
|
||||
if (direction == GPRS_CIPH_MS2SGSN)
|
||||
dir = 0;
|
||||
else
|
||||
dir = 1;
|
||||
|
||||
GEA3((uint8_t *)&kc, sizeof(kc), iv, dir, out, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct gprs_cipher_impl gea3_impl = {
|
||||
.algo = GPRS_ALGO_GEA3,
|
||||
.name = "3GPP Reference implementation of GEA3",
|
||||
.priority = 1000,
|
||||
.run = &gea3_run,
|
||||
};
|
||||
|
||||
static void __attribute__((constructor)) osmo_crypt_a5_init(void)
|
||||
{
|
||||
gprs_cipher_register(&gea3_impl);
|
||||
|
||||
/* FIXME: A5/3 registration */
|
||||
}
|
Reference in New Issue