Change in ...osmo-ttcn3-hacks[master]: remove ogslib dependency from snow

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/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Wed Aug 14 11:07:33 UTC 2019


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15201


Change subject: remove ogslib dependency from snow
......................................................................

remove ogslib dependency from snow

* don't use ogslib specific header files
* don't use ogs_{malloc,free} but simply use the stack

Change-Id: I5604c594934b03d2fd83e1e465fc150fc542a475
---
M mme/snow-3g.c
M mme/snow-3g.h
2 files changed, 2 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/01/15201/1

diff --git a/mme/snow-3g.c b/mme/snow-3g.c
index 992b107..60bdffd 100644
--- a/mme/snow-3g.c
+++ b/mme/snow-3g.c
@@ -381,7 +381,7 @@
 	int n = ( length + 31 ) / 32;
 	int i=0;
 	int lastbits = (8-(length%8)) % 8;
-	u32 *KS;
+	u32 KS[n];
 	
 	/*Initialisation*/
 	/* Load the confidentiality key for SNOW 3G initialization as in section
@@ -399,7 +399,6 @@
 	
 	/* Run SNOW 3G algorithm to generate sequence of key stream bits KS*/
 	snow_3g_initialize(K,IV);
-	KS = (u32 *)ogs_malloc(4*n);
 	snow_3g_generate_key_stream(n,(u32*)KS);
 	
 	/* Exclusive-OR the input data with keystream to generate the output bit
@@ -412,8 +411,6 @@
 		data[4*i+3] ^= (u8) (KS[i] ) & 0xff;
 	}
 	
-	ogs_free(KS);
-	
 	/* zero last bits of data in case its length is not byte-aligned 
 	   this is an addition to the C reference code, which did not handle it */
 	if (lastbits)
diff --git a/mme/snow-3g.h b/mme/snow-3g.h
index a5320bb..0ba6a84 100644
--- a/mme/snow-3g.h
+++ b/mme/snow-3g.h
@@ -1,7 +1,7 @@
 #ifndef __SNOW_3G__
 #define __SNOW_3G__
 
-#include "ogs-core.h"
+#include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15201
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5604c594934b03d2fd83e1e465fc150fc542a475
Gerrit-Change-Number: 15201
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190814/69ceff2a/attachment.htm>


More information about the gerrit-log mailing list