aboutsummaryrefslogtreecommitdiffstats
path: root/utils
AgeCommit message (Collapse)AuthorFilesLines
2017-06-23doxygen: unify use of \file across the boardNeels Hofmeyr2-4/+6
Considering the various styles and implications found in the sources, edit scores of files to follow the same API doc guidelines around the doxygen grouping and the \file tag. Many files now show a short description in the generated API doc that was so far only available as C comment. The guidelines and reasoning behind it is documented at https://osmocom.org/projects/cellular-infrastructure/wiki/Guidelines_for_API_documentation In some instances, remove file comments and add to the corresponding group instead, to be shared among several files (e.g. bitvec). Change-Id: Ifa70e77e90462b5eb2b0457c70fd25275910c72b
2017-06-23doxygen: enable AUTOBRIEF, drop \briefNeels Hofmeyr1-2/+1
Especially for short descriptions, it is annoying to have to type \brief for every single API doc. Drop all \brief and enable the AUTOBRIEF feature of doxygen, which always takes the first sentence of an API doc as the brief description. Change-Id: I11a8a821b065a128108641a2a63fb5a2b1916e87
2017-06-22osmo-sim-test.c: Remove unused functionsPau Espin Pedrol1-37/+0
Change-Id: I3060cfee8ece86c4c89a65f93c9f5424df0c410b
2017-05-17utils/osmo-sim-test.c: strip unused variablesVadim Yanitskiy1-5/+1
Change-Id: Id577d9df5a814ad5aa00e1d04c4790d75d17ad7e
2017-03-20build: fix distcheck: include gen scripts in EXTRA_DISTNeels Hofmeyr1-0/+2
Change-Id: Id94d2fe83f080a18a2a686206bd21cf5fafe2fa7
2017-03-20build: conv_gen.py: ensure parent dirs of written files existNeels Hofmeyr1-3/+9
Previously, this would fail when generating to $builddir if that subtree did not exist yet in $builddir. Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54
2017-03-20osmo-auc-gen: fix --sqn limit on 32bit systems, fixing buildNeels Hofmeyr1-3/+1
osmo-auc-gen on 32bit systems allowed only --sqn up to 32bits width. However, the recently added regression test for osmo-auc-gen includes an ivocation with a 48bit wide --sqn, which now causes the builds to fail on 32bit systems. Fix the --sqn argument parsing for larger integers by using strtoull(). Do away with the intermediate variable 'ul' and place the value directly in the auth data struct. Change-Id: Ifb73b3b3de06576e36076ca573d52327f90a1f77
2017-03-15osmo_auth_gen_vec: UMTS auth: store last used SQN, not nextNeels Hofmeyr1-5/+7
Prepare for the implementation of splitting SQN increments in SEQ and an IND part; particularly to clearly show where the changes in auth/milenage_test's expectations originate. Rationale: the source of UMTS auth vectors, for us usually OsmoHLR, typically stores the last used SQN, not the next one to be used. Particularly with the upcoming fix of the SQN scheme, this change is important: the next SQN will depend on which entity asks for it, because each auth consumer may have a particular slot in the IND part of SQN. It does not make sense to store the next SQN, because we will not know which consumer that will be for. The milenage_test has always calculated a tuple for SQN == 34. To account for the increment now happening before calculating a tuple, lower the test_aud->sqn by one to 0x21 == 33, so that it is still calculating for SQN == 34. Because we are no longer incrementing SQN after the tuple is generated, milenage_test's expected output after doing an AUTS resync to 31 changes to the next SQN = 32, the SQN used for the generated tuple. (BTW, a subsequent patch will illustrate AUTS in detail.) osmo-auc-gen now needs to pass the user requested SQN less one, because the SQN will be incremented befor generating the auth vector. Also the SQN remains the same after generating, so SQN output needs less decrementing. Note that the expected output for osmo-auc-gen_test remains unchanged, hence the same input arguments (particularly -s <sqn> and -A <auts>) still produce the same results. Note: osmo-hlr regression tests will require adjustments when this patch is merged, because it must now pass desired_sqn - 1 instead of just desired_sqn. See osmo-hlr change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 . Related: OS#1968 Change-Id: Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3
2017-03-15osmo-auc-gen: clarify SQN output, prepare for SQN changesNeels Hofmeyr1-15/+10
Upcoming patches will change the way SQN are incremented. Change the SQN related output by osmo-auc-gen so that it also makes sense after these changes, and so that its output is proven to remain unchanged for the same arguments: Always show the SQN used for vector generation when a UMTS vector was generated. Don't show the next SQN, it will not make sense anymore (see later patches). The adjustments of expected output of osmo-auc-gen_test illustrates how the output changes. Related: OS#1968 Change-Id: I35d9c669002ff3e8570e07b444cca34ce57c3b0c
2017-03-07libosmocoding: migrate transcoding routines from OsmoBTSVadim Yanitskiy1-0/+24
There are some projects, such as GR-GSM and OsmocomBB, which would benefit from using one shared implementation of GSM 05.03 code. So, this commit introduces a new sub-library called libosmocoding, which (for now) provides GSM, GPRS and EDGE transcoding routines, migrated from OsmoBTS. The original GSM 05.03 code from OsmoBTS was relicensed under GPLv2-or-later with permission of copyright holders (Andreas Eversberg, Alexander Chemeris and Tom Tsou). The following data types are currently supported: - xCCH - PDTCH (CS 1-4 and MCS 1-9) - TCH/FR - TCH/HR - TCH/AFS - RCH/AHS - RACH - SCH Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1
2017-03-06utils/conv_gen.py: add header generation featureVadim Yanitskiy1-5/+44
Change-Id: Iae830d716f01810972edbef14fc5383ac647d0ea
2017-03-06utils/conv_gen.py: add test vectors generation featureVadim Yanitskiy1-2/+76
Change-Id: Ie10c47ee952f253b1ba77ecf6e79f2c033545bc1
2017-02-09utils/conv_gen.py: improve application flexibilityVadim Yanitskiy1-8/+38
This change makes the conv_gen application more interactive and flexible, allowing to generate not only code definitions but also the test vectors and header files in the future. Moreover, it becomes possible to select exact code family, such as GSM, GMR etc. Change-Id: I0b476b00234c17f78b41d695cf3bfd13edb64c28
2017-02-08fix various compiler warnings (on FreeBSD-11.0)Harald Welte1-3/+3
FreeBSD 11.0 uses clang version 3.8.0 which spits various warnings during libosmocore compilation. Let's clean this up a bit. Change-Id: Ic14572e6970bd0b8916604fabf807f1608fa07e5
2017-02-06osmo-auc-gen: cmdline help: list algorithms; error messagesNeels Hofmeyr1-1/+10
In the -h help output, list the names of available algorithms. In case of option parsing failure, also print help() (so that e.g. for a typo in the algorithm, the list of algorithms is printed along with the error message). If there are -2/-3 or -a missing, show an error message that explains this. Change-Id: I76732b28d7a553a6293d1707fe398d28b5ef4886
2017-02-04osmo-auc-gen: cosmetic: clarify output upon AUTSNeels Hofmeyr1-1/+14
When calculating a re-sync vector using AUTS, osmo-gen-vec used to print SQN.MS + 2, the new SQN after vector generation, labeled 'SEQ.MS'. Firstly, s/SEQ/SQN. Secondly, print SQN.MS as umts.sqn - 2, which is the actual SQN recovered from the AUTS. As explained in the comment, SQN.MS + 1 is used to generate the vector, and then umts.sqn is increased a second time to indicate the next SQN. With AUTS calculated from SQN.MS == 23, the output was: AUTS success: SEQ.MS = 25 Output now: AUTS success: SQN.MS = 23, generated vector with SQN = 24, next SQN = 25 Change-Id: I881bbe8246a5e7d3a5065b4b5b533255723b1a9e
2017-02-02GSUP, OAP, osmo-gen-vec: fix AUTS length to 14, not 16Neels Hofmeyr1-1/+1
GSUP transmits AUTS for UMTS authentication procedures, and OAP uses the same procedures to authenticate. osmo-gen-vec is a utility program that passes AUTS to our osmo_auth_gen_vec_auts() API. According to 3GPP 33.102 6.3.3, AUTS = SQN^AK || MAC-S, which are 6 || 8 == 14 bytes. This is confirmed by 24.008 9.2.3a where the TLV has 16 bytes, TL = 2 and AUTS being the V = 14. It is not harmful for milenage_gen_vec_auts() to pass two more AUTS bytes. But writing 16 bytes to a GSUP struct is a potential problem when passing in a 14 byte long AUTS buffer to the GSUP API, which then reads past the AUTS buffer. The API implies the length, so far to be 16, so passing in a 14 byte buffer to GSUP would require copying to a larger buffer first. Fix this by using a length of 14 for AUTS everywhere instead. This constitues an ABI breakage, we may handle it as a "fix before an official release", otherwise we need a version bump. The OAP protocol document has also been updated, needs an update in the osmo-gsm-manuals as well. Change-Id: If25b173d9ec57ea4c504d860954912b7d82af455
2016-12-24utils/conv_gen.py: separate code definitionsVadim Yanitskiy2-714/+728
This change separates the convolutional code definitions from the code generator logic, allowing us to make further changes in more specific way. For example, adding some new codes, you change the conv_codes.py only because such change isn't related to the generator. Change-Id: I3428561251b7d7a180d1e9b6fcaad50bdbbc37fa
2016-12-24utils/conv_gen.py: use shared tables if possibleVadim Yanitskiy1-37/+61
This change introduces the memory usage optimization, mentioned in d2d9760c08f35a231d32f0ebeb73b2927e5573b3. The aim is to make code generator able to detect, whether the same tables are used by several convolutional code definitions, and prevent one from writing these tables multiple times. For now, the detection process isn't fully automatic, so all shared polynomials should be placed inside the 'shared_polys' dictionary, for example: shared_polys = { "xcch" : [ ( G0, 1 ), ( G1, 1 ), ], "mcs" : [ ( G4, 1 ), ( G7, 1 ), ( G5, 1 ), ], } Change-Id: I84760f5cdfdaece376b801d2e6cb2954ee875a3b
2016-11-26osmo-sim-test.c: Fix rmsg checkHarald Welte1-1/+1
we wanted to check for !rmsg, but used to check for !msg, missing error returns from read_record_nr(). Change-Id: I79b6a94b1aa947c8329317b0626865c3cd4159c1 Fixes: Coverity CID 57672
2016-11-02utils/conv_gen.py: explicitly import reduce()Vadim Yanitskiy1-0/+1
This change finally makes the script able to be executed in Python 3 environment. Due to new Python 3 restrictions, the reduce() should be imported explicitly. Change-Id: Icbc81c29f1a226aeed2c1245a5d60809fe124005
2016-11-02utils/conv_gen.py: don't mix print and write()Vadim Yanitskiy1-32/+34
This is mostly a code style change, but it also increases the compatibility with Python 3. Change-Id: I5c8271d973f766aeb9cbcab30c4eddfdab54fcbb
2016-10-23utils/conv_gen.py: add EDGE MCS 1-9 definitionsVadim Yanitskiy1-1/+226
Change-Id: Ie1452342f524a8b60f2babc07398a1d9c9e06aa3
2016-10-23utils/conv_gen.py: fix some typosVadim Yanitskiy1-6/+6
Change-Id: I3327b92715744af4ef61496ef0121555d9d24799
2016-10-23utils/conv_gen.py: add RACH, SCH and TCH/AHS definitionsVadim Yanitskiy1-1/+162
Change-Id: I0ea7151f4e8119a8798a9e129b951559e56b0d93
2016-10-23utils/conv_gen.py: improve output formattingVadim Yanitskiy1-6/+32
To keep the generated tables readable, line with should be limited. So, now there are the following limitations: - _print_term(): up to 12 numbers per line, - _print_puncture(): up to 12 numbers per line, - _print_x(): up to 4 blocks per line. Change-Id: I95256c4ad402a3c088bdb6c5a5cda8b17c31881c
2016-10-23utils/conv_gen.py: generate a single fileVadim Yanitskiy1-318/+315
Instead of generating every convolutional code into a separate file (such as conv_xcch_gen.c, conv_cs3_gen.c), it is better to have a single file, containing all definitions, because as many convolutional codes we add, as many entries we will have to add into 'src/gsm/Makefile.am'. This approach increases readability of the Makefile.am, and also makes us able to share some data between some convolutional code definitions. For example: xCCH, RACH, SCH, TCH/F, both CS2 and CS3 may use the same *_state[][2] and *_output[][2] arrays within a single file. This optimization is currently WIP. Change-Id: Ib4e4ee5fdde38429e68e3b2fa50ec03a18f59daa
2016-09-24utils/conv_gen.py: code style changes (line width, tabs, etc.)Vadim Yanitskiy1-181/+233
Change-Id: I8550910b9f5c16efc6f15f23c7ee52122c588752
2016-06-01osmo-auc-gen: Print hex values without intermittent spacesHarald Welte1-7/+7
When generating some authentication vectors using the osmo-auc-gen utility, it used to print values like this: AUTN: f7 55 bc 47 de d0 00 00 f9 ed 4b 3f 6c 2a 97 6f which is quite difficult to copy+paste on the terminal. Now it generates the following format: Change-Id: I2805615e0c2087ca632e0658b37a9e06929620b6 AUTN: f755bc47ded00000f9ed4b3f6c2a976f Reviewed-on: https://gerrit.osmocom.org/164 Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Jenkins Builder
2016-04-29conv_gen: Use python2 to execute the scriptHolger Hans Peter Freyther1-1/+1
The script does not work with python3: $ python3 utils/conv_gen.py File "utils/conv_gen.py", line 124 def _print_term(self, fi, num_states, pack = False): Second there is no 'python' on FreeBSD and one needs to select the major version to use. GEN conv_cs3_gen.c GEN conv_xcch_gen.c GEN conv_cs2_gen.c python: not found python: not found python: not found By using python2 we solve both issues. On Debian python2 is located inside the python-minimal package.
2016-04-29add two missing files (gsm0503.h / conv_gen.py) to previous commitHarald Welte1-0/+494
2016-03-11rename osim_file_find_* to osim_file_desc_find_*Harald Welte1-1/+1
they return an osim_file_desc, and not an osim_file, so fix the naming
2015-12-08utils: add TALLOC_CFLAGS to buildHarald Welte1-1/+1
this is an attempt to fix the FreeBSD build
2015-11-07osmo-sim-test: add missing includeAlexander Huemer1-0/+1
2015-05-26osmo-auc-gen: '-a' is already the algorithm. Fix the helpHolger Hans Peter Freyther1-1/+1
2015-05-17build: Fix out-of-tree buildsAndreas Rottmann1-1/+1
Fixes: In file included from ../../../include/osmocom/core/msgb.h:25:0, from ../../../include/osmocom/sim/sim.h:4, from ../../../src/sim/reader_pcsc.c:30: ../../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory #include <osmocom/core/bit16gen.h> In file included from ../../include/osmocom/core/msgb.h:25:0, from ../../utils/osmo-sim-test.c:26: ../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory #include <osmocom/core/bit16gen.h>
2014-11-14pcsc: Allow to disable the PCSC dependencyHolger Hans Peter Freyther1-3/+5
* PCSC is enabled by default * --enable-pcsc is enabling it * --disable-pcscis disabling it * Fix the makefile of the utilities to not build pcsc and use the right header files/libraries.
2014-10-27osmo-sim-test: Fix read_binary() return checkHarald Welte1-1/+1
if we expect rmsg to be set, we should check for it...
2014-10-26sim: Prepare infrastructure for protocols != T=0 and other driversHarald Welte1-2/+2
2014-10-26sim: Make osmo-sim-test compile againHarald Welte1-1/+1
2014-10-26sim: add decoding of status wordsHarald Welte1-0/+3
2014-10-26sim: strip the SW from the returned data, as SW is passed in msgb->cbHarald Welte1-3/+3
2014-10-26sim: add copyright notices and merge file_codec.c into core.cHarald Welte1-6/+23
2014-10-26sim: osmo-sim-test: Also dump binary filesHarald Welte1-10/+39
2014-10-26initial checkin of 'libosmosim'Harald Welte2-0/+375
2014-10-03build: remove unused all_includes and use AM_CPPFLAGSJan Engelhardt1-1/+2
Preprocessor flags are best placed in AM_CPPFLAGS. Remove use of the unused all_includes variable, which is never set.
2014-10-03utils: resolve compiler warnings on implicit declarationsJan Engelhardt1-0/+1
CC osmo-auc-gen.o osmo-auc-gen.c: In function 'main': osmo-auc-gen.c:216:3: warning: implicit declaration of function 'time' [-Wimplicit-function-declaration]
2014-06-22osmo-auc-gen: Fix compiler warnings about aliasingHolger Hans Peter Freyther1-4/+7
I ran "./utils/osmo-auc-gen -2 -a COMP128v1" and verified that the RAND doen't look empty Fixes: osmo-auc-gen.c: In function ‘main’: osmo-auc-gen.c:219:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] *(uint32_t *)&_rand[0] = rand(); ^ osmo-auc-gen.c:220:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] *(uint32_t *)(&_rand[4]) = rand(); ^ osmo-auc-gen.c:221:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] *(uint32_t *)(&_rand[8]) = rand(); ^ osmo-auc-gen.c:222:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] *(uint32_t *)(&_rand[12]) = rand();
2013-07-14utils: Fix compiler warnings n the osmo-auc-gen utilityHolger Hans Peter Freyther1-1/+3
osmo-auc-gen.c:217:3: warning: implicit declaration of function ‘time’ [-Wimplicit-function-declaration] osmo-auc-gen.c:249:3: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘uint64_t’ [-Wformat] Fixes: Coverity CID 1040668
2013-04-21osmo-arfcn: Return something from the methodHolger Hans Peter Freyther1-0/+1
This is a fatal error when building RPMs for OpenSUSE.