aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2016-05-05Import osmo_{encode,decode}_big_endian() from openbscHarald Welte1-0/+62
2016-05-05tlv: Import osmo_shift_* and osmo_match_shift_* from openbscHarald Welte2-0/+177
These routines have nothing to do with specifically the BSC, so import them to the TLV parser we keep in libosmogsm.
2016-05-05Update doxygen annotations in libosmocoreHarald Welte18-47/+212
This adds and improves doxygen API descriptions all over libosmocore, reducing the 'white spots' that don't have any documentation.
2016-05-05import gsm_04_08_gprs.[ch] from openbsc.gitHarald Welte3-1/+148
The definitions in this header file (and associated strings in the c file) are generic about the GPRS Layer3 signalling protocols, and thus should be part of the library.
2016-05-05Add log_fini() function to release all memory allocated by logging frameworkHarald Welte1-0/+15
This is e.g. quite useful to call at the end of test code, in order to show that all memory allocated actually is released before exit().
2016-05-05auth_core: Add osmo_auth_3g_from_2g() to compute CK+IK from KcHarald Welte2-0/+42
This function performs the C5+C4 conversion to derive UMTS key material from a 2G-only subscriber.
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 code generator for convolutional codesMax Suraev msuraev@sysmocom.de2-0/+20
Add python utility to generate .c code with convolutional encoder/decoder based on polynomial description of the code. If argument given it'll be interpreted as intended output directory, otherwise current working directory is used. Codes for *CCH, CS2/3 and TCH/AFS are generated. Corresponding manual implementations are removed from tests. This introduce build-time dependency on python. The main work for this patch was generously contributed by Sylvain Munaut. Fixes: OS#1629
2016-04-24milenage/aes: Address undefined behavior on bitshiftHolger Hans Peter Freyther1-1/+1
Extend the u8 to u32 before going to shift it. Fixes: milenage/aes-internal.c:799:4: runtime error: left shift of 128 by 24 places cannot be represented in type 'int' #0 0x7f84e9fe86a2 in rijndaelKeySetupEnc (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0xfa6a2) #1 0x7f84e9febad8 in aes_encrypt_init (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0xfdad8) #2 0x7f84e9fe7d14 in aes_128_encrypt_block (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0xf9d14) #3 0x7f84e9febe7d in milenage_f1 (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0xfde7d) #4 0x7f84e9fee2ce in milenage_generate (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0x1002ce) #5 0x7f84e9fe76d7 in milenage_gen_vec (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0xf96d7) #6 0x7f84e9fe6c08 in osmo_auth_gen_vec (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/src/gsm/.libs/libosmogsm.so.5+0xf8c08) #7 0x401441 in main (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/tests/auth/.libs/lt-milenage_test+0x401441) #8 0x7f84e8e33a3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x20a3f) #9 0x400e58 in _start (/home/builder/jenkins/workspace/Osmocom_Sanitizer/source/libosmocore/tests/auth/.libs/lt-milenage_test+0x400e58)
2016-04-24Fix unaligned access found by addr. sanitizerMax2-4/+4
gprs_bssgp.c:461:9: runtime error: load of misaligned address 0x62100001a66b for type 'uint32_t', which requires 4 byte alignment gprs_ns.c:937:16: runtime error: load of misaligned address 0x61d00002a97f for type 'uint16_t', which requires 2 byte alignment
2016-04-23Add function for appending range1024 to bitvecMax2-1/+37
Add convenience function to append range1024 encoded data (see 3GPP TS 44.018 Annex J) to a given bitvec.
2016-04-22Deprecate comp128Max2-2/+7
Mark function as deprecated to discourage its usage: people should use generic API in osmocom/crypt/auth.h
2016-04-22Deprecate osmo_a5_1 and osmo_a5_2Max1-50/+58
Mark the functions as deprecated to discourage their use: people should use unified osmo_a5 which supports all the A5/1-4 ciphers.
2016-04-22Improve code reuseMax1-32/+3
Use generic functions covered by testsuit for SQN calculations.
2016-04-22Update internal GPRS cipher APIMax2-2/+22
Update internal API (for GPRS cipher implementors): make it compliant with ETSI TS 155.22. External API left untouched.
2016-04-16Add function to get osmo_earfcn bit sizeMax2-0/+25
This function returns the number of bits necessary to pack osmo_earfcn into Repeated E-UTRAN Neighbour Cells IE (3GPP TS 44.018 Table 10.5.2.33b.1).
2016-04-16logging.c: assert category_token allocation (CID #57871)Neels Hofmeyr1-0/+1
2016-04-12Add ubit <-> sbit convertorsMax1-0/+24
Move functions for conversion between soft and unpacked bits to main library as they are generally useful.
2016-04-12gb: Add bssgp_pdu_str to libosmogb namespaceMax1-0/+1
[hfreyther: To be used by osmo-pcu]
2016-04-07Add missing docs for bssgp bvc reset vty commandMax1-2/+8
Fixes the build failure with extended tests enabled.
2016-04-05Add vty command to explicitly reset given BVCIMax1-0/+20
It's useful for debugging and is similar to existing reset command for nsvc.
2016-03-31select: Externalize fd_set filling and dispatchHolger Hans Peter Freyther1-32/+51
To integrate with an external event loop (in this case glib) we need to allow an application to get a filled out fd_set and then dispatch it. osmo_fds and maxfds are static and I decided to keep it that way and instead create two routines to fill the fdset and then one to dispatch the result. The public header file does not include sys/select.h and we can compile the library without select, so I didn't want to require having to include this file, and used void * for the parameter. Mark the routines as inline to avoid a call from the select function. I have confirmed that inlining has an effect on x86 using Debian's gcc-4.9.2-10 compiler
2016-03-30Export names for gsm_chan_t and gsm48_chan_modeMax2-1/+27
This can be used with get_value_string() to improve debugging output.
2016-03-19sim: make osim_reader_ops publicHarald Welte1-7/+0
2016-03-19Add new osmo_fd_get_by_fd() functionHarald Welte1-0/+12
This function can be used to obtain the osmo_fd corresponding to a given fd. The latter can be useful when integrating libosmocore main loop with other libraries.
2016-03-17sim: add class_tables / card profilesHarald Welte2-2/+316
The tables permit code to determine the APDU class of an APDU based on it APDU/TPDU header (CLA/INS/P1/P2/P3).
2016-03-17Improve BSSGP debug outputMax2-17/+17
Print string representation of Cause IE and PDU type instead of numerical value.
2016-03-17Rename struct to better match libosmocore conventionsMax1-3/+3
2016-03-17Revert "gsm48: move to hex TMSI representation"Harald Welte1-1/+1
This reverts commit f451ce66eb8206bad1078849723edcb209632834.
2016-03-17gsm48: move to hex TMSI representationVadim Yanitskiy1-1/+1
Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com>
2016-03-17Add basic EARFCN supportMax2-0/+54
Add structure representing group of EARFCNs with common priority, threshold etc. Add functions to populate this structure.
2016-03-17Add function to add bits from array to bitvecMax1-0/+40
Add function which adds specified number of bits from each element of array to the bit vector prefixing each addition with one and finishing entire sequence with adding 0. This is very common patter for various repetitive data structures described with CSN.1 in 3GPP standards. Corresponding test vectors and doxygen headers are added too.
2016-03-15gsm48: factor out MCC+MNC BCD parsing for re-use in UMTSNeels Hofmeyr2-21/+36
For 3G, I need a BCD composer/parser similar to gsm48_generate_lai()/ gsm48_decode_lai(). Those functions also handle a trivial extra member (lac) which I don't need in this way for 3G. So create new functions to take on the MCC+MNC BCD handling and call those from gsm48_generate_lai() and gsm48_decode_lai(). In this way, the 3G code in openbsc can use only the BCD functionality without code duplication.
2016-03-1504.08: add inline funcs for pdisc + msg type bitmasksNeels Hofmeyr1-2/+2
Add inline functions for both release <= 98 and release >= 99 as well as a default define. Use the release 98 by default since the current code base uses the r98 bitmasks. These inline functions relieve callers of the decision on masking bits of the protocol discriminator and message type octets. Also add a define for the protocol discriminator extension to one octet length (GSM48_PDISC_EXTEND). Apply new pdisc function in gsm0480.c. [hfreyther: Make the hdr param const]
2016-03-11Add helper function to convert numerical BSSGP PDU type to stringMax1-0/+46
2016-03-11rename osim_file_find_* to osim_file_desc_find_*Harald Welte1-3/+5
they return an osim_file_desc, and not an osim_file, so fix the naming
2016-03-11sim: Add osim_file_find_{fid,sfid}() functionsHarald Welte1-0/+25
We don't always want to look-up by name, but the latter is the only implemented 'find' function so far. Let's change that.
2016-02-29logging: Remove unused variable after recent changesHolger Hans Peter Freyther1-1/+0
The variable is not used anymore as the decision is done in the newly added check_log_to_target method.
2016-02-29logging: Move the filter check up as wellHolger Hans Peter Freyther1-11/+9
There doesn't seem to be a reason not to check the filter. Update and extend the test. Currently the filter function will be called once for the log check and once for the output of it.
2016-02-29logging: Remove some code duplicationHolger Hans Peter Freyther1-37/+37
Extract the mapping of the subsystem number and the checking for the loglevel to a inline method that is shared between the new and old.
2016-02-29log: Add log_check_level functionJacob Erlbeck1-0/+39
This commit adds this predicate function which can be used to avoid the execution of code if a certain log level is not enabled. The function will only return 0 (false), if it is sure that a logging call for the same facility and level will not produce any output. This safety criterion shall ensure, that no logging output is lost due to the use of this predicate as a guard. On the other hand, even if the predicate returns != 0 (true), no logging output might get generated by a similar logging command. Note that the current implementation is not focussed on performance, which could be improved by using a lookup table instead of iterating through every target. Sponsored-by: On-Waves ehf
2016-02-29comment typoNeels Hofmeyr1-1/+1
2016-02-25vty: add ctrl section for Control interface bind addressNeels Hofmeyr2-0/+92
This may seem like overkill for a mere const char * config item, but it makes the Control interface VTY commands reusable in any main() scope (inspired by libosmo-abis' VTY config). Add API functions ctrl_vty_init() and ctrl_vty_get_bind_addr(), in new files src/ctrl/control_vty.c and include/osmocom/ctrl/control_vty.h, compiled and/or installed dependent on ENABLE_VTY. Using these functions allows configuring a static const char* with the VTY commands ctrl bind A.B.C.D which callers shall subsequently use to bind the Control interface to a specific local interface address, by passing the return value of ctrl_vty_get_bind_addr() to control_interface_setup(). Add CTRL_NODE to enum node_type, "eating" RESERVED4_NODE to heed that comment on avoiding ABI changes.
2016-02-25add ctrl_interface_setup_dynip() for bind addressNeels Hofmeyr1-1/+9
Make the ctrl interface bind address configurable, so that it may be made available on other addresses than 127.0.0.1. The specific aim is to allow running multiple osmo-nitbs alongside each other (commits in openbsc follow).
2016-02-25vty: add bind command for telnet vty lineNeels Hofmeyr1-0/+28
Add VTY command line vty bind A.B.C.D The command merely stores the configured IP-address, which can then be used by the calling main program to set the telnet port of the VTY line. (Commits in openbsc and osmo-iuh will follow up on this.) Add function vty_get_bind_addr() to publish the address in the vty.h API. Add static vty_bind_addr to store. For allocation/freeing reasons, a NULL address defaults to 127.0.0.1. BTW, I decided against allowing keywords 'any' and 'localhost' in place of an actual IP address to make sure a written config is always identical to the parsed config.
2016-02-22gb: Add bssgp_msgb_copy functionJacob Erlbeck2-0/+31
This function originates from openbsc/src/gprs but is just specific to BSSGP/Gb on the same level like bssgp_msgb_alloc. This commit puts the former gprs_msgb_copy function beside bssgp_msgb_alloc. Renamed function: gprs_msgb_copy -> bssgp_msgb_copy Sponsored-by: On-Waves ehf
2016-02-18bitvec: Untested speculative UBAN fix for the new routineHolger Hans Peter Freyther1-1/+1
int << 31 does not seem to be defined, let's try to make it an unsigned variable and see if that is pleasing the system. Fixes: bitvec.c:219:15: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
2016-02-18Add T4 bit map compression routinesMax2-1/+481
Add bit map encoder and decoder functions: decoder is fully functional while encoder is good enough for testing - no backtracking to find the best possible compression is implemented. If somebody is willing to implement MS side of EDGE than this has to be expanded. Add corresponding tests. N. B: the encoding is implemented according to ETSI TS 44.060 which is slightly different from T4 used for fax according to CCITT G31D (RFC 804). Ticket: OW#2407 Sponsored-by: On-Waves ehf Signed-off-by: Max <msuraev@sysmocom.de>
2016-02-18Expand bitvec interfaceMax1-5/+129
Add bit filling, shifting and other functions necessary for bit compression implementation. Add corresponding tests.
2016-01-30bitvec: Test and fix regression for C++->C conversionHolger Hans Peter Freyther1-9/+9
bitvec_read_field/bitvec_write_field in the PCU used a C++ reference and when porting to C it was decided to pass the parameter by value and this lost the "back propagation" of the new index. Change the parameter to be an in/out parameter and this way do not have a silent semantic break in the osmo-pcu (where we copy the reference in csn.1 by value) and have a true compile failure. Add Max's simple test for bitvec_unhex function leaving the checking of bitvec_read_field and the side effect in the datastructure about the number of bits still open.