Clang-formated liblte_*

master
Pedro Alvarez 5 years ago committed by Andre Puschmann
parent b46a71c2d8
commit 9597cc4c14

@ -40,8 +40,8 @@
INCLUDES INCLUDES
*******************************************************************************/ *******************************************************************************/
#include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -58,7 +58,9 @@
#define LIBLTE_MSG_HEADER_OFFSET 1020 #define LIBLTE_MSG_HEADER_OFFSET 1020
// Macro to make it easier to convert defines into strings // Macro to make it easier to convert defines into strings
#define LIBLTE_CASE_STR(code) case code: return #code #define LIBLTE_CASE_STR(code) \
case code: \
return #code
/******************************************************************************* /*******************************************************************************
TYPEDEFS TYPEDEFS
@ -113,7 +115,6 @@ typedef struct{
uint8 msg[LIBLTE_MAX_MSG_SIZE_BYTES]; uint8 msg[LIBLTE_MAX_MSG_SIZE_BYTES];
} LIBLTE_BYTE_MSG_STRUCT; } LIBLTE_BYTE_MSG_STRUCT;
/******************************************************************************* /*******************************************************************************
DECLARATIONS DECLARATIONS
*******************************************************************************/ *******************************************************************************/
@ -123,33 +124,28 @@ typedef struct{
Description: Converts a value to a bit string Description: Converts a value to a bit string
*********************************************************************/ *********************************************************************/
void liblte_value_2_bits(uint32 value, void liblte_value_2_bits(uint32 value, uint8** bits, uint32 N_bits);
uint8 **bits,
uint32 N_bits);
/********************************************************************* /*********************************************************************
Name: liblte_bits_2_value Name: liblte_bits_2_value
Description: Converts a bit string to a value Description: Converts a bit string to a value
*********************************************************************/ *********************************************************************/
uint32 liblte_bits_2_value(uint8 **bits, uint32 liblte_bits_2_value(uint8** bits, uint32 N_bits);
uint32 N_bits);
/********************************************************************* /*********************************************************************
Name: liblte_pack Name: liblte_pack
Description: Pack a bit array into a byte array Description: Pack a bit array into a byte array
*********************************************************************/ *********************************************************************/
void liblte_pack(LIBLTE_BIT_MSG_STRUCT *bits, void liblte_pack(LIBLTE_BIT_MSG_STRUCT* bits, LIBLTE_BYTE_MSG_STRUCT* bytes);
LIBLTE_BYTE_MSG_STRUCT *bytes);
/********************************************************************* /*********************************************************************
Name: liblte_unpack Name: liblte_unpack
Description: Unpack a byte array into a bit array Description: Unpack a byte array into a bit array
*********************************************************************/ *********************************************************************/
void liblte_unpack(LIBLTE_BYTE_MSG_STRUCT *bytes, void liblte_unpack(LIBLTE_BYTE_MSG_STRUCT* bytes, LIBLTE_BIT_MSG_STRUCT* bits);
LIBLTE_BIT_MSG_STRUCT *bits);
/********************************************************************* /*********************************************************************
Name: liblte_pack Name: liblte_pack

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -42,12 +42,10 @@
DEFINES DEFINES
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
TYPEDEFS TYPEDEFS
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
DECLARATIONS DECLARATIONS
*******************************************************************************/ *******************************************************************************/
@ -59,9 +57,7 @@
Document Reference: 35.206 v10.0.0 Annex 3 Document Reference: 35.206 v10.0.0 Annex 3
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_compute_opc(uint8 *k, LIBLTE_ERROR_ENUM liblte_compute_opc(uint8* k, uint8* op, uint8* op_c);
uint8 *op,
uint8 *op_c);
/********************************************************************* /*********************************************************************
Name: liblte_security_generate_k_asme Name: liblte_security_generate_k_asme
@ -74,13 +70,8 @@ LIBLTE_ERROR_ENUM liblte_compute_opc(uint8 *k,
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_generate_k_asme(uint8 *ck, LIBLTE_ERROR_ENUM
uint8 *ik, liblte_security_generate_k_asme(uint8* ck, uint8* ik, uint8* ak, uint8* sqn, uint16 mcc, uint16 mnc, uint8* k_asme);
uint8 *ak,
uint8 *sqn,
uint16 mcc,
uint16 mnc,
uint8 *k_asme);
/********************************************************************* /*********************************************************************
Name: liblte_security_generate_k_enb Name: liblte_security_generate_k_enb
@ -93,18 +84,11 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_asme(uint8 *ck,
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_generate_k_enb(uint8 *k_asme, LIBLTE_ERROR_ENUM liblte_security_generate_k_enb(uint8* k_asme, uint32 nas_count, uint8* k_enb);
uint32 nas_count,
uint8 *k_enb);
LIBLTE_ERROR_ENUM liblte_security_generate_k_enb_star(uint8 *k_enb, LIBLTE_ERROR_ENUM liblte_security_generate_k_enb_star(uint8* k_enb, uint32 pci, uint32_t earfcn, uint8* k_enb_star);
uint32 pci,
uint32_t earfcn,
uint8 *k_enb_star);
LIBLTE_ERROR_ENUM liblte_security_generate_nh( uint8_t *k_asme, LIBLTE_ERROR_ENUM liblte_security_generate_nh(uint8_t* k_asme, uint8_t* sync, uint8_t* nh);
uint8_t *sync,
uint8_t *nh);
/********************************************************************* /*********************************************************************
Name: liblte_security_generate_k_nas Name: liblte_security_generate_k_nas
@ -121,18 +105,16 @@ typedef enum{
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA2, LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_128_EEA2,
LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS, LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS,
} LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM; } LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_ENUM;
static const char liblte_security_ciphering_algorithm_id_text[LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS][20] = {"EEA0", static const char liblte_security_ciphering_algorithm_id_text[LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_N_ITEMS][20] = {
"128-EEA1", "EEA0", "128-EEA1", "128-EEA2"};
"128-EEA2"};
typedef enum { typedef enum {
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_EIA0 = 0, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_EIA0 = 0,
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA1, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA1,
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA2, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_128_EIA2,
LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS, LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS,
} LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM; } LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_ENUM;
static const char liblte_security_integrity_algorithm_id_text[LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = {"EIA0", static const char liblte_security_integrity_algorithm_id_text[LIBLTE_SECURITY_INTEGRITY_ALGORITHM_ID_N_ITEMS][20] = {
"128-EIA1", "EIA0", "128-EIA1", "128-EIA2"};
"128-EIA2"};
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8* k_asme, LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8* k_asme,
@ -141,8 +123,6 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8
uint8* k_nas_enc, uint8* k_nas_enc,
uint8* k_nas_int); uint8* k_nas_int);
/********************************************************************* /*********************************************************************
Name: liblte_security_generate_k_rrc Name: liblte_security_generate_k_rrc
@ -193,19 +173,10 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_up(uint8
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8 *key, LIBLTE_ERROR_ENUM liblte_security_128_eia2(
uint32 count, uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* mac);
uint8 bearer, LIBLTE_ERROR_ENUM liblte_security_128_eia2(
uint8 direction, uint8* key, uint32 count, uint8 bearer, uint8 direction, LIBLTE_BIT_MSG_STRUCT* msg, uint8* mac);
uint8 *msg,
uint32 msg_len,
uint8 *mac);
LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8 *key,
uint32 count,
uint8 bearer,
uint8 direction,
LIBLTE_BIT_MSG_STRUCT *msg,
uint8 *mac);
/********************************************************************* /*********************************************************************
Name: liblte_security_encryption_eea1 Name: liblte_security_encryption_eea1
@ -217,13 +188,8 @@ LIBLTE_ERROR_ENUM liblte_security_128_eia2(uint8 *key,
Specification of the 3GPP Confidentiality and Specification of the 3GPP Confidentiality and
Integrity Algorithms UEA2 & UIA2 D1 v2.1 Integrity Algorithms UEA2 & UIA2 D1 v2.1
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(uint8 *key, LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(
uint32 count, uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out);
uint8 bearer,
uint8 direction,
uint8 *msg,
uint32 msg_len,
uint8 *out);
/********************************************************************* /*********************************************************************
Name: liblte_security_decryption_eea1 Name: liblte_security_decryption_eea1
@ -235,13 +201,8 @@ LIBLTE_ERROR_ENUM liblte_security_encryption_eea1(uint8 *key,
Specification of the 3GPP Confidentiality and Specification of the 3GPP Confidentiality and
Integrity Algorithms UEA2 & UIA2 D1 v2.1 Integrity Algorithms UEA2 & UIA2 D1 v2.1
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(uint8 *key, LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(
uint32 count, uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* ct, uint32 ct_len, uint8* out);
uint8 bearer,
uint8 direction,
uint8 *ct,
uint32 ct_len,
uint8 *out);
/********************************************************************* /*********************************************************************
Name: liblte_security_encryption_eea2 Name: liblte_security_encryption_eea2
@ -250,13 +211,8 @@ LIBLTE_ERROR_ENUM liblte_security_decryption_eea1(uint8 *key,
Document Reference: 33.401 v13.1.0 Annex B.1.3 Document Reference: 33.401 v13.1.0 Annex B.1.3
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(uint8 *key, LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(
uint32 count, uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* msg, uint32 msg_len, uint8* out);
uint8 bearer,
uint8 direction,
uint8 *msg,
uint32 msg_len,
uint8 *out);
/********************************************************************* /*********************************************************************
Name: liblte_security_decryption_eea2 Name: liblte_security_decryption_eea2
@ -265,14 +221,8 @@ LIBLTE_ERROR_ENUM liblte_security_encryption_eea2(uint8 *key,
Document Reference: 33.401 v13.1.0 Annex B.1.3 Document Reference: 33.401 v13.1.0 Annex B.1.3
*********************************************************************/ *********************************************************************/
LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(uint8 *key, LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(
uint32 count, uint8* key, uint32 count, uint8 bearer, uint8 direction, uint8* ct, uint32 ct_len, uint8* out);
uint8 bearer,
uint8 direction,
uint8 *ct,
uint32 ct_len,
uint8 *out);
/********************************************************************* /*********************************************************************
Name: liblte_security_milenage_f1 Name: liblte_security_milenage_f1
@ -288,12 +238,7 @@ LIBLTE_ERROR_ENUM liblte_security_decryption_eea2(uint8 *key,
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_milenage_f1(uint8 *k, LIBLTE_ERROR_ENUM liblte_security_milenage_f1(uint8* k, uint8* op, uint8* rand, uint8* sqn, uint8* amf, uint8* mac_a);
uint8 *op,
uint8 *rand,
uint8 *sqn,
uint8 *amf,
uint8 *mac_a);
/********************************************************************* /*********************************************************************
Name: liblte_security_milenage_f1_star Name: liblte_security_milenage_f1_star
@ -309,12 +254,8 @@ LIBLTE_ERROR_ENUM liblte_security_milenage_f1(uint8 *k,
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_milenage_f1_star(uint8 *k, LIBLTE_ERROR_ENUM
uint8 *op, liblte_security_milenage_f1_star(uint8* k, uint8* op, uint8* rand, uint8* sqn, uint8* amf, uint8* mac_s);
uint8 *rand,
uint8 *sqn,
uint8 *amf,
uint8 *mac_s);
/********************************************************************* /*********************************************************************
Name: liblte_security_milenage_f2345 Name: liblte_security_milenage_f2345
@ -330,13 +271,8 @@ LIBLTE_ERROR_ENUM liblte_security_milenage_f1_star(uint8 *k,
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_milenage_f2345(uint8 *k, LIBLTE_ERROR_ENUM
uint8 *op, liblte_security_milenage_f2345(uint8* k, uint8* op, uint8* rand, uint8* res, uint8* ck, uint8* ik, uint8* ak);
uint8 *rand,
uint8 *res,
uint8 *ck,
uint8 *ik,
uint8 *ak);
/********************************************************************* /*********************************************************************
Name: liblte_security_milenage_f5_star Name: liblte_security_milenage_f5_star
@ -351,9 +287,6 @@ LIBLTE_ERROR_ENUM liblte_security_milenage_f2345(uint8 *k,
// Enums // Enums
// Structs // Structs
// Functions // Functions
LIBLTE_ERROR_ENUM liblte_security_milenage_f5_star(uint8 *k, LIBLTE_ERROR_ENUM liblte_security_milenage_f5_star(uint8* k, uint8* op, uint8* rand, uint8* ak);
uint8 *op,
uint8 *rand,
uint8 *ak);
#endif // SRSLTE_LIBLTE_SECURITY_H #endif // SRSLTE_LIBLTE_SECURITY_H

@ -24,12 +24,15 @@
#ifdef HAVE_POLARSSL #ifdef HAVE_POLARSSL
#include "polarssl/sha256.h"
#include "polarssl/aes.h" #include "polarssl/aes.h"
#include "polarssl/sha256.h"
void sha256(const unsigned char *key, size_t keylen, void sha256(const unsigned char* key,
const unsigned char *input, size_t ilen, size_t keylen,
unsigned char output[32], int is224 ) const unsigned char* input,
size_t ilen,
unsigned char output[32],
int is224)
{ {
sha256_hmac(key, keylen, input, ilen, output, is224); sha256_hmac(key, keylen, input, ilen, output, is224);
} }
@ -38,8 +41,8 @@ void sha256(const unsigned char *key, size_t keylen,
#ifdef HAVE_MBEDTLS #ifdef HAVE_MBEDTLS
#include "mbedtls/md.h"
#include "mbedtls/aes.h" #include "mbedtls/aes.h"
#include "mbedtls/md.h"
typedef mbedtls_aes_context aes_context; typedef mbedtls_aes_context aes_context;
@ -51,10 +54,7 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key, unsigned int key
return mbedtls_aes_setkey_enc(ctx, key, keysize); return mbedtls_aes_setkey_enc(ctx, key, keysize);
} }
int aes_crypt_ecb( aes_context *ctx, int aes_crypt_ecb(aes_context* ctx, int mode, const unsigned char input[16], unsigned char output[16])
int mode,
const unsigned char input[16],
unsigned char output[16] )
{ {
return mbedtls_aes_crypt_ecb(ctx, mode, input, output); return mbedtls_aes_crypt_ecb(ctx, mode, input, output);
} }
@ -67,18 +67,17 @@ int aes_crypt_ctr(aes_context *ctx,
const unsigned char* input, const unsigned char* input,
unsigned char* output) unsigned char* output)
{ {
return mbedtls_aes_crypt_ctr(ctx, length, nc_off, nonce_counter, return mbedtls_aes_crypt_ctr(ctx, length, nc_off, nonce_counter, stream_block, input, output);
stream_block, input, output);
} }
void sha256(const unsigned char *key, size_t keylen, void sha256(const unsigned char* key,
const unsigned char *input, size_t ilen, size_t keylen,
unsigned char output[32], int is224 ) const unsigned char* input,
size_t ilen,
unsigned char output[32],
int is224)
{ {
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256), key, keylen, input, ilen, output);
key, keylen,
input, ilen,
output );
} }
#endif // HAVE_MBEDTLS #endif // HAVE_MBEDTLS

@ -39,17 +39,14 @@
DEFINES DEFINES
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
TYPEDEFS TYPEDEFS
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
GLOBAL VARIABLES GLOBAL VARIABLES
*******************************************************************************/ *******************************************************************************/
/******************************************************************************* /*******************************************************************************
FUNCTIONS FUNCTIONS
*******************************************************************************/ *******************************************************************************/
@ -59,14 +56,11 @@
Description: Converts a value to a bit string Description: Converts a value to a bit string
*********************************************************************/ *********************************************************************/
void liblte_value_2_bits(uint32 value, void liblte_value_2_bits(uint32 value, uint8** bits, uint32 N_bits)
uint8 **bits,
uint32 N_bits)
{ {
uint32 i; uint32 i;
for(i=0; i<N_bits; i++) for (i = 0; i < N_bits; i++) {
{
(*bits)[i] = (value >> (N_bits - i - 1)) & 0x1; (*bits)[i] = (value >> (N_bits - i - 1)) & 0x1;
} }
*bits += N_bits; *bits += N_bits;
@ -77,14 +71,12 @@ void liblte_value_2_bits(uint32 value,
Description: Converts a bit string to a value Description: Converts a bit string to a value
*********************************************************************/ *********************************************************************/
uint32 liblte_bits_2_value(uint8 **bits, uint32 liblte_bits_2_value(uint8** bits, uint32 N_bits)
uint32 N_bits)
{ {
uint32 value = 0; uint32 value = 0;
uint32 i; uint32 i;
for(i=0; i<N_bits; i++) for (i = 0; i < N_bits; i++) {
{
value |= (*bits)[i] << (N_bits - i - 1); value |= (*bits)[i] << (N_bits - i - 1);
} }
*bits += N_bits; *bits += N_bits;
@ -97,19 +89,16 @@ uint32 liblte_bits_2_value(uint8 **bits,
Description: Pack a bit array into a byte array Description: Pack a bit array into a byte array
*********************************************************************/ *********************************************************************/
void liblte_pack(LIBLTE_BIT_MSG_STRUCT *bits, void liblte_pack(LIBLTE_BIT_MSG_STRUCT* bits, LIBLTE_BYTE_MSG_STRUCT* bytes)
LIBLTE_BYTE_MSG_STRUCT *bytes)
{ {
uint8_t* bit_ptr = bits->msg; uint8_t* bit_ptr = bits->msg;
uint32_t i; uint32_t i;
for(i=0; i<bits->N_bits/8; i++) for (i = 0; i < bits->N_bits / 8; i++) {
{
bytes->msg[i] = liblte_bits_2_value(&bit_ptr, 8); bytes->msg[i] = liblte_bits_2_value(&bit_ptr, 8);
} }
bytes->N_bytes = bits->N_bits / 8; bytes->N_bytes = bits->N_bits / 8;
if(bits->N_bits%8 > 0) if (bits->N_bits % 8 > 0) {
{
bytes->msg[bytes->N_bytes] = liblte_bits_2_value(&bit_ptr, bits->N_bits % 8); bytes->msg[bytes->N_bytes] = liblte_bits_2_value(&bit_ptr, bits->N_bits % 8);
bytes->N_bytes++; bytes->N_bytes++;
} }
@ -120,14 +109,12 @@ void liblte_pack(LIBLTE_BIT_MSG_STRUCT *bits,
Description: Unpack a byte array into a bit array Description: Unpack a byte array into a bit array
*********************************************************************/ *********************************************************************/
void liblte_unpack(LIBLTE_BYTE_MSG_STRUCT *bytes, void liblte_unpack(LIBLTE_BYTE_MSG_STRUCT* bytes, LIBLTE_BIT_MSG_STRUCT* bits)
LIBLTE_BIT_MSG_STRUCT *bits)
{ {
uint8_t* bit_ptr = bits->msg; uint8_t* bit_ptr = bits->msg;
uint32_t i; uint32_t i;
for(i=0; i<bytes->N_bytes; i++) for (i = 0; i < bytes->N_bytes; i++) {
{
liblte_value_2_bits(bytes->msg[i], &bit_ptr, 8); liblte_value_2_bits(bytes->msg[i], &bit_ptr, 8);
} }
bits->N_bits = bytes->N_bytes * 8; bits->N_bits = bytes->N_bytes * 8;
@ -143,12 +130,10 @@ void liblte_pack(uint8_t *bits, uint32_t n_bits, uint8_t *bytes)
uint8_t* bit_ptr = bits; uint8_t* bit_ptr = bits;
uint32_t i; uint32_t i;
for(i=0; i<n_bits/8; i++) for (i = 0; i < n_bits / 8; i++) {
{
bytes[i] = liblte_bits_2_value(&bit_ptr, 8); bytes[i] = liblte_bits_2_value(&bit_ptr, 8);
} }
if(n_bits%8 > 0) if (n_bits % 8 > 0) {
{
bytes[n_bits / 8] = liblte_bits_2_value(&bit_ptr, n_bits % 8); bytes[n_bits / 8] = liblte_bits_2_value(&bit_ptr, n_bits % 8);
} }
} }
@ -163,8 +148,7 @@ void liblte_unpack(uint8_t *bytes, uint32_t n_bytes, uint8_t *bits)
uint8_t* bit_ptr = bits; uint8_t* bit_ptr = bits;
uint32_t i; uint32_t i;
for(i=0; i<n_bytes; i++) for (i = 0; i < n_bytes; i++) {
{
liblte_value_2_bits(bytes[i], &bit_ptr, 8); liblte_value_2_bits(bytes[i], &bit_ptr, 8);
} }
} }
@ -176,8 +160,7 @@ void liblte_unpack(uint8_t *bytes, uint32_t n_bytes, uint8_t *bits)
*********************************************************************/ *********************************************************************/
void liblte_align_up(uint8_t** ptr, uint32_t align) void liblte_align_up(uint8_t** ptr, uint32_t align)
{ {
while( (uint64_t)(*ptr) % align > 0) while ((uint64_t)(*ptr) % align > 0) {
{
(*ptr)++; (*ptr)++;
} }
} }
@ -190,8 +173,7 @@ void liblte_align_up(uint8_t **ptr, uint32_t align)
*********************************************************************/ *********************************************************************/
void liblte_align_up_zero(uint8_t** ptr, uint32_t align) void liblte_align_up_zero(uint8_t** ptr, uint32_t align)
{ {
while( (uint64_t)(*ptr) % align > 0) while ((uint64_t)(*ptr) % align > 0) {
{
**ptr = 0; **ptr = 0;
(*ptr)++; (*ptr)++;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save