[PATCH] Change GPRS cipher API to comply with ETSI TS 155 226

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/baseband-devel@lists.osmocom.org/.

Max max.suraev at fairwaves.ru
Wed Nov 27 16:22:50 UTC 2013


---
 include/osmocom/crypt/gprs_cipher.h | 5 +++--
 src/gsm/gprs_cipher_core.c          | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/osmocom/crypt/gprs_cipher.h b/include/osmocom/crypt/gprs_cipher.h
index 3051071..d3d3b1e 100644
--- a/include/osmocom/crypt/gprs_cipher.h
+++ b/include/osmocom/crypt/gprs_cipher.h
@@ -10,6 +10,7 @@ enum gprs_ciph_algo {
 	GPRS_ALGO_GEA1,
 	GPRS_ALGO_GEA2,
 	GPRS_ALGO_GEA3,
+	GPRS_ALGO_GEA4,
 	_GPRS_ALGO_NUM
 };
 
@@ -28,7 +29,7 @@ struct gprs_cipher_impl {
 	/* As specified in 04.64 Annex A.  Uses Kc, IV and direction
 	 * to generate the 1523 bytes cipher stream that need to be
 	 * XORed wit the plaintext for encrypt / ciphertext for decrypt */
-	int (*run)(uint8_t *out, uint16_t len, uint64_t kc, uint32_t iv,
+	int (*run)(uint8_t *out, uint16_t len, uint8_t *kc, uint16_t kc_len, uint32_t iv,
 		   enum gprs_cipher_direction direction);
 };
 
@@ -40,7 +41,7 @@ int gprs_cipher_load(const char *path);
 
 /* function to be called by core code */
 int gprs_cipher_run(uint8_t *out, uint16_t len, enum gprs_ciph_algo algo,
-		    uint64_t kc, uint32_t iv, enum gprs_cipher_direction dir);
+		    uint8_t *kc, uint16_t kc_len, uint32_t iv, enum gprs_cipher_direction dir);
 
 /* Do we have an implementation for this cipher? */
 int gprs_cipher_supported(enum gprs_ciph_algo algo);
diff --git a/src/gsm/gprs_cipher_core.c b/src/gsm/gprs_cipher_core.c
index b9a22a1..2e75094 100644
--- a/src/gsm/gprs_cipher_core.c
+++ b/src/gsm/gprs_cipher_core.c
@@ -58,7 +58,7 @@ int gprs_cipher_load(const char *path)
 
 /* function to be called by core code */
 int gprs_cipher_run(uint8_t *out, uint16_t len, enum gprs_ciph_algo algo,
-		    uint64_t kc, uint32_t iv, enum gprs_cipher_direction dir)
+		    uint8_t *kc, uint16_t kc_len, uint32_t iv, enum gprs_cipher_direction dir)
 {
 	if (algo >= ARRAY_SIZE(selected_ciphers))
 		return -ERANGE;
@@ -70,7 +70,7 @@ int gprs_cipher_run(uint8_t *out, uint16_t len, enum gprs_ciph_algo algo,
 		return -ERANGE;
 
 	/* run the actual cipher from the plugin */
-	return selected_ciphers[algo]->run(out, len, kc, iv, dir);
+	return selected_ciphers[algo]->run(out, len, kc, kc_len, iv, dir);
 }
 
 int gprs_cipher_supported(enum gprs_ciph_algo algo)
-- 
1.8.3.2


--------------010109090405030108010709--




More information about the baseband-devel mailing list