Make read-only globals const, additional fixes

- Global variables that are never written to are marked const
- Remove some EXTERN declaration
- Remove unused `log_mem_multi` from logging module
This commit is contained in:
Laurent THOMAS
2023-08-18 14:20:37 +02:00
committed by Robert Schmidt
parent 5b943f598d
commit 206aa36a47
62 changed files with 1516 additions and 1337 deletions
+7 -7
View File
@@ -27,13 +27,13 @@
int errorCodeEncoder = 0;
const char *errorCodeStringEncoder[] = {
"No error",
"Buffer NULL",
"Buffer too short",
"Octet string too long for IEI",
"Wrong message type",
"Protocol not supported",
const char *const errorCodeStringEncoder[] = {
"No error",
"Buffer NULL",
"Buffer too short",
"Octet string too long for IEI",
"Wrong message type",
"Protocol not supported",
};
void tlv_encode_perror(void)
+87 -89
View File
@@ -68,129 +68,127 @@ typedef struct sttyset_s {
} sttyset_t;
/* Table of terminal I/O parameters */
static sttyset_t stty_params[] = {
{ "0", BFLG, 0, B0 },
{ "50", BFLG, 0, B50 },
{ "75", BFLG, 0, B75 },
{ "110", BFLG, 0, B110 },
{ "134", BFLG, 0, B134 },
{ "150", BFLG, 0, B150 },
{ "200", BFLG, 0, B200 },
{ "300", BFLG, 0, B300 },
{ "600", BFLG, 0, B600 },
{ "1200", BFLG, 0, B1200 },
{ "1800", BFLG, 0, B1800 },
{ "2400", BFLG, 0, B2400 },
{ "4800", BFLG, 0, B4800 },
{ "9600", BFLG, 0, B9600 },
{ "19200", BFLG, 0, B19200 },
{ "38400", BFLG, 0, B38400 },
static const sttyset_t stty_params[] = {{"0", BFLG, 0, B0},
{"50", BFLG, 0, B50},
{"75", BFLG, 0, B75},
{"110", BFLG, 0, B110},
{"134", BFLG, 0, B134},
{"150", BFLG, 0, B150},
{"200", BFLG, 0, B200},
{"300", BFLG, 0, B300},
{"600", BFLG, 0, B600},
{"1200", BFLG, 0, B1200},
{"1800", BFLG, 0, B1800},
{"2400", BFLG, 0, B2400},
{"4800", BFLG, 0, B4800},
{"9600", BFLG, 0, B9600},
{"19200", BFLG, 0, B19200},
{"38400", BFLG, 0, B38400},
#ifdef B57600
{ "57600", BFLG, 0, B57600 },
{"57600", BFLG, 0, B57600},
#endif
#ifdef B115200
{ "115200", BFLG, 0, B115200 },
{"115200", BFLG, 0, B115200},
#endif
#ifdef B230400
{ "230400", BFLG, 0, B230400 },
{"230400", BFLG, 0, B230400},
#endif
{ "cs7", CFLG, CSIZE, CS7 },
{ "cs8", CFLG, CSIZE, CS8 },
{ "cstopb", CFLG, CSTOPB, CSTOPB },
{ "cread", CFLG, CREAD, CREAD },
{ "parenb", CFLG, PARENB, PARENB },
{ "parodd", CFLG, PARODD, PARODD },
{ "hubcl", CFLG, HUPCL, HUPCL },
{ "clocal", CFLG, CLOCAL, CLOCAL },
{"cs7", CFLG, CSIZE, CS7},
{"cs8", CFLG, CSIZE, CS8},
{"cstopb", CFLG, CSTOPB, CSTOPB},
{"cread", CFLG, CREAD, CREAD},
{"parenb", CFLG, PARENB, PARENB},
{"parodd", CFLG, PARODD, PARODD},
{"hubcl", CFLG, HUPCL, HUPCL},
{"clocal", CFLG, CLOCAL, CLOCAL},
#ifdef CRTSCTS
{ "crtscts",CFLG, CRTSCTS, CRTSCTS },
{"crtscts", CFLG, CRTSCTS, CRTSCTS},
#endif
#ifdef ORTSFL
{ "ortsfl", CFLG, ORTSFL, ORTSFL },
{"ortsfl", CFLG, ORTSFL, ORTSFL},
#endif
#ifdef CTSFLOW
{ "ctsflow",CFLG, CTSFLOW, CTSFLOW },
{"ctsflow", CFLG, CTSFLOW, CTSFLOW},
#endif
#ifdef RTSFLOW
{ "rtsflow",CFLG, RTSFLOW, RTSFLOW },
{"rtsflow", CFLG, RTSFLOW, RTSFLOW},
#endif
{ "ignbrk", IFLG, IGNBRK, IGNBRK },
{ "brkint", IFLG, BRKINT, BRKINT },
{ "ignpar", IFLG, IGNPAR, IGNPAR },
{ "parmrk", IFLG, PARMRK, PARMRK },
{ "inpck", IFLG, INPCK, INPCK },
{ "istrip", IFLG, ISTRIP, ISTRIP },
{ "inlcr", IFLG, INLCR, INLCR },
{ "igncr", IFLG, IGNCR, IGNCR },
{ "icrnl", IFLG, ICRNL, ICRNL },
{"ignbrk", IFLG, IGNBRK, IGNBRK},
{"brkint", IFLG, BRKINT, BRKINT},
{"ignpar", IFLG, IGNPAR, IGNPAR},
{"parmrk", IFLG, PARMRK, PARMRK},
{"inpck", IFLG, INPCK, INPCK},
{"istrip", IFLG, ISTRIP, ISTRIP},
{"inlcr", IFLG, INLCR, INLCR},
{"igncr", IFLG, IGNCR, IGNCR},
{"icrnl", IFLG, ICRNL, ICRNL},
#ifdef IUCLC // Missing on OSX, FreeBSD
{ "iuclc", IFLG, IUCLC, IUCLC },
{"iuclc", IFLG, IUCLC, IUCLC},
#endif
{ "ixon", IFLG, IXON, IXON },
{ "ixany", IFLG, IXANY, IXANY },
{ "ixoff", IFLG, IXOFF, IXOFF },
{"ixon", IFLG, IXON, IXON},
{"ixany", IFLG, IXANY, IXANY},
{"ixoff", IFLG, IXOFF, IXOFF},
#ifdef IMAXBEL
{ "imaxbel",IFLG, IMAXBEL, IMAXBEL },
{"imaxbel", IFLG, IMAXBEL, IMAXBEL},
#endif
{ "opost", OFLG, OPOST, OPOST },
{"opost", OFLG, OPOST, OPOST},
#ifdef ILCUC // Missing on OSX, FreeBSD
{ "olcuc", OFLG, OLCUC, OLCUC },
{"olcuc", OFLG, OLCUC, OLCUC},
#endif
{ "onlcr", OFLG, ONLCR, ONLCR },
{ "ocrnl", OFLG, OCRNL, OCRNL },
{ "onocr", OFLG, ONOCR, ONOCR },
{ "onlret", OFLG, ONLRET, ONLRET },
{ "ofil", OFLG, OFILL, OFILL },
{ "ofdel", OFLG, OFDEL, OFDEL },
{ "nl0", OFLG, NLDLY, NL0 },
{ "nl1", OFLG, NLDLY, NL1 },
{ "cr0", OFLG, CRDLY, CR0 },
{ "cr1", OFLG, CRDLY, CR1 },
{ "cr2", OFLG, CRDLY, CR2 },
{ "cr3", OFLG, CRDLY, CR3 },
{ "tab0", OFLG, TABDLY, TAB0 },
{ "tab1", OFLG, TABDLY, TAB1 },
{ "tab2", OFLG, TABDLY, TAB2 },
{ "tab3", OFLG, TABDLY, TAB3 },
{ "bs0", OFLG, BSDLY, BS0 },
{ "bs1", OFLG, BSDLY, BS1 },
{ "vt0", OFLG, VTDLY, VT0 },
{ "vt1", OFLG, VTDLY, VT1 },
{ "ff0", OFLG, FFDLY, FF0 },
{ "ff1", OFLG, FFDLY, FF1 },
{ "isig", LFLG, ISIG, ISIG },
{ "icanon", LFLG, ICANON, ICANON },
{"onlcr", OFLG, ONLCR, ONLCR},
{"ocrnl", OFLG, OCRNL, OCRNL},
{"onocr", OFLG, ONOCR, ONOCR},
{"onlret", OFLG, ONLRET, ONLRET},
{"ofil", OFLG, OFILL, OFILL},
{"ofdel", OFLG, OFDEL, OFDEL},
{"nl0", OFLG, NLDLY, NL0},
{"nl1", OFLG, NLDLY, NL1},
{"cr0", OFLG, CRDLY, CR0},
{"cr1", OFLG, CRDLY, CR1},
{"cr2", OFLG, CRDLY, CR2},
{"cr3", OFLG, CRDLY, CR3},
{"tab0", OFLG, TABDLY, TAB0},
{"tab1", OFLG, TABDLY, TAB1},
{"tab2", OFLG, TABDLY, TAB2},
{"tab3", OFLG, TABDLY, TAB3},
{"bs0", OFLG, BSDLY, BS0},
{"bs1", OFLG, BSDLY, BS1},
{"vt0", OFLG, VTDLY, VT0},
{"vt1", OFLG, VTDLY, VT1},
{"ff0", OFLG, FFDLY, FF0},
{"ff1", OFLG, FFDLY, FF1},
{"isig", LFLG, ISIG, ISIG},
{"icanon", LFLG, ICANON, ICANON},
#ifdef XCASE // Missing on OSX, FreeBSD
{ "xcase", LFLG, XCASE, XCASE },
{"xcase", LFLG, XCASE, XCASE},
#endif
{ "echo", LFLG, ECHO, ECHO },
{ "echoe", LFLG, ECHOE, ECHOE },
{ "echok", LFLG, ECHOK, ECHOK },
{ "echonl", LFLG, ECHONL, ECHONL },
{ "noflsh", LFLG, NOFLSH, NOFLSH },
{ "tostop", LFLG, TOSTOP, TOSTOP },
{"echo", LFLG, ECHO, ECHO},
{"echoe", LFLG, ECHOE, ECHOE},
{"echok", LFLG, ECHOK, ECHOK},
{"echonl", LFLG, ECHONL, ECHONL},
{"noflsh", LFLG, NOFLSH, NOFLSH},
{"tostop", LFLG, TOSTOP, TOSTOP},
#ifdef ECHOCTL
{ "echoctl",LFLG, ECHOCTL, ECHOCTL },
{"echoctl", LFLG, ECHOCTL, ECHOCTL},
#endif
#ifdef ECHOPRT
{ "echoprt",LFLG, ECHOPRT, ECHOPRT },
{"echoprt", LFLG, ECHOPRT, ECHOPRT},
#endif
#ifdef ECHOKE
{ "echoke", LFLG, ECHOKE, ECHOKE },
{"echoke", LFLG, ECHOKE, ECHOKE},
#endif
#ifdef FLUSHO
{ "flusho", LFLG, FLUSHO, FLUSHO },
{"flusho", LFLG, FLUSHO, FLUSHO},
#endif
#ifdef PENDIN
{ "pendin", LFLG, PENDIN, PENDIN },
{"pendin", LFLG, PENDIN, PENDIN},
#endif
{ "iexten", LFLG, IEXTEN, IEXTEN },
{"iexten", LFLG, IEXTEN, IEXTEN},
#ifdef TOSTOP
{ "tostop", LFLG, TOSTOP, TOSTOP },
{"tostop", LFLG, TOSTOP, TOSTOP},
#endif
{ "raw", RFLG, 0, 0 },
{ NULL, 0, 0, 0 }
};
{"raw", RFLG, 0, 0},
{NULL, 0, 0, 0}};
static int _stty_set_this(struct termios *term, const sttyset_t *p, bool turnon);
+118 -118
View File
@@ -74,136 +74,136 @@ at_error_format_t at_error_format = AT_ERROR_OFF;
* General errors
* --------------
*/
static const char * _at_error_str[] = {
"phone failure",
"no connection to phone",
"phone-adaptor link reserved",
"operation not allowed",
"operation not supported",
"PH-SIM PIN required",
"PH-FSIM PIN required",
"PH-FSIM PUK required",
NULL,
NULL,
"SIM not inserted",
"SIM PIN required",
"SIM PUK required",
"SIM failure",
"SIM busy",
"SIM wrong",
"incorrect password",
"SIM PIN2 required",
"SIM PUK2 required",
NULL,
"memory full",
"invalid index",
"not found",
"memory failure",
"text string too long",
"invalid characters in text string",
"dial string too long",
"invalid characters in dial string",
NULL,
NULL,
"no network service",
"network timeout",
"network not allowed - emergency calls only",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"network personalization PIN required",
"network personalization PUK required",
"network subset personalization PIN required",
"network subset personalization PUK required",
"service provider personalization PIN required",
"service provider personalization PUK required",
"corporate personalization PIN required",
"corporate personalization PUK required",
"hidden key required",
"EAP method not supported",
"Incorrect parameters",
static const char* const _at_error_str[] = {
"phone failure",
"no connection to phone",
"phone-adaptor link reserved",
"operation not allowed",
"operation not supported",
"PH-SIM PIN required",
"PH-FSIM PIN required",
"PH-FSIM PUK required",
NULL,
NULL,
"SIM not inserted",
"SIM PIN required",
"SIM PUK required",
"SIM failure",
"SIM busy",
"SIM wrong",
"incorrect password",
"SIM PIN2 required",
"SIM PUK2 required",
NULL,
"memory full",
"invalid index",
"not found",
"memory failure",
"text string too long",
"invalid characters in text string",
"dial string too long",
"invalid characters in dial string",
NULL,
NULL,
"no network service",
"network timeout",
"network not allowed - emergency calls only",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"network personalization PIN required",
"network personalization PUK required",
"network subset personalization PIN required",
"network subset personalization PUK required",
"service provider personalization PIN required",
"service provider personalization PUK required",
"corporate personalization PIN required",
"corporate personalization PUK required",
"hidden key required",
"EAP method not supported",
"Incorrect parameters",
};
/*
* GPRS-related errors
* -------------------
*/
static const char* _at_error_gprs[] = {
"Illegal MS",
NULL,
NULL,
"Illegal ME",
"GPRS services not allowed",
NULL,
NULL,
NULL,
"PLMN not allowed",
"Location area not allowed",
"Roaming not allowed in this location area",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"service option not supported",
"requested service option not subscribed",
"service option temporarily out of order",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"unspecified GPRS error",
"PDP authentication failure",
"invalid mobile class",
"Last PDN disconnection not allowed",
static const char* const _at_error_gprs[] = {
"Illegal MS",
NULL,
NULL,
"Illegal ME",
"GPRS services not allowed",
NULL,
NULL,
NULL,
"PLMN not allowed",
"Location area not allowed",
"Roaming not allowed in this location area",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"service option not supported",
"requested service option not subscribed",
"service option temporarily out of order",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"unspecified GPRS error",
"PDP authentication failure",
"invalid mobile class",
"Last PDN disconnection not allowed",
};
/*
* VBS / VGCS and eMLPP -related errors
* ------------------------------------
*/
static const char* _at_error_vbs[] = {
/* 151 "VBS/VGCS not supported by the network" */
"No service subscription on SIM",
"No subscription for group ID",
"Group Id not activated on SIM",
"No matching notification",
"VBS/VGCS call already present",
"Congestion",
"Network failure",
"Uplink busy",
"No access rights for SIM file",
"No subscription for priority",
"operation not applicable or not possible",
"Group Id prefixes not supported",
"Group Id prefixes not usable for VBS",
"Group Id prefix value invalid",
static const char* const _at_error_vbs[] = {
/* 151 "VBS/VGCS not supported by the network" */
"No service subscription on SIM",
"No subscription for group ID",
"Group Id not activated on SIM",
"No matching notification",
"VBS/VGCS call already present",
"Congestion",
"Network failure",
"Uplink busy",
"No access rights for SIM file",
"No subscription for priority",
"operation not applicable or not possible",
"Group Id prefixes not supported",
"Group Id prefixes not usable for VBS",
"Group Id prefix value invalid",
};
/* Returns the verbose value of AT command error */
+22 -22
View File
@@ -89,28 +89,28 @@ typedef int (*_at_response_encode_function_t) (char* buffer, const at_response_t
static _at_response_encode_function_t _at_response_encode_function[AT_RESPONSE_ID_MAX] = {
NULL,
_at_response_encode_cgsn, /* CGSN */
_at_response_encode_cgmi, /* CGMI */
_at_response_encode_cgmm, /* CGMM */
_at_response_encode_cgmr, /* CGMR */
_at_response_encode_cimi, /* CIMI */
_at_response_encode_cfun, /* CFUN */
_at_response_encode_cpin, /* CPIN */
_at_response_encode_csq, /* CSQ */
_at_response_encode_cesq, /* CESQ */
_at_response_encode_clac, /* CLAC */
_at_response_encode_cmee, /* CMEE */
_at_response_encode_cnum, /* CNUM */
_at_response_encode_clck, /* CLCK */
_at_response_encode_cops, /* COPS */
_at_response_encode_creg, /* CREG */
_at_response_encode_cgatt, /* CGATT */
_at_response_encode_cgreg, /* CGREG */
_at_response_encode_cereg, /* CEREG */
_at_response_encode_cgdcont, /* CGDCONT */
_at_response_encode_cgact, /* CGACT */
_at_response_encode_cgpaddr, /* CGPADDR */
_at_response_encode_cgev, /* CGEV: unsolicited result */
_at_response_encode_cgsn, /* CGSN */
_at_response_encode_cgmi, /* CGMI */
_at_response_encode_cgmm, /* CGMM */
_at_response_encode_cgmr, /* CGMR */
_at_response_encode_cimi, /* CIMI */
_at_response_encode_cfun, /* CFUN */
_at_response_encode_cpin, /* CPIN */
_at_response_encode_csq, /* CSQ */
_at_response_encode_cesq, /* CESQ */
_at_response_encode_clac, /* CLAC */
_at_response_encode_cmee, /* CMEE */
_at_response_encode_cnum, /* CNUM */
_at_response_encode_clck, /* CLCK */
_at_response_encode_cops, /* COPS */
_at_response_encode_creg, /* CREG */
_at_response_encode_cgatt, /* CGATT */
_at_response_encode_cgreg, /* CGREG */
_at_response_encode_cereg, /* CEREG */
_at_response_encode_cgdcont, /* CGDCONT */
_at_response_encode_cgact, /* CGACT */
_at_response_encode_cgpaddr, /* CGPADDR */
_at_response_encode_cgev, /* CGEV: unsolicited result */
};
/* String representation of Packet Domain events (cf. network_pdn_state_t) */
+24 -35
View File
@@ -305,44 +305,33 @@ void ComputeOPc(const u8 op[16], u8 op_c_pP[16])
/*-------------------- Rijndael round subkeys ---------------------*/
u8 roundKeys[11][4][4];
/*--------------------- Rijndael S box table ----------------------*/
u8 S[256] = {
99,124,119,123,242,107,111,197, 48, 1,103, 43,254,215,171,118,
202,130,201,125,250, 89, 71,240,173,212,162,175,156,164,114,192,
183,253,147, 38, 54, 63,247,204, 52,165,229,241,113,216, 49, 21,
4,199, 35,195, 24,150, 5,154, 7, 18,128,226,235, 39,178,117,
9,131, 44, 26, 27,110, 90,160, 82, 59,214,179, 41,227, 47,132,
83,209, 0,237, 32,252,177, 91,106,203,190, 57, 74, 76, 88,207,
208,239,170,251, 67, 77, 51,133, 69,249, 2,127, 80, 60,159,168,
81,163, 64,143,146,157, 56,245,188,182,218, 33, 16,255,243,210,
205, 12, 19,236, 95,151, 68, 23,196,167,126, 61,100, 93, 25,115,
96,129, 79,220, 34, 42,144,136, 70,238,184, 20,222, 94, 11,219,
224, 50, 58, 10, 73, 6, 36, 92,194,211,172, 98,145,149,228,121,
231,200, 55,109,141,213, 78,169,108, 86,244,234,101,122,174, 8,
186,120, 37, 46, 28,166,180,198,232,221,116, 31, 75,189,139,138,
112, 62,181,102, 72, 3,246, 14, 97, 53, 87,185,134,193, 29,158,
225,248,152, 17,105,217,142,148,155, 30,135,233,206, 85, 40,223,
140,161,137, 13,191,230, 66,104, 65,153, 45, 15,176, 84,187, 22,
const u8 S[256] = {
99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240,
173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21,
4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160,
82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207,
208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245,
188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115,
96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92,
194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8,
186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14,
97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223,
140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22,
};
/*------- This array does the multiplication by x in GF(2^8) ------*/
u8 Xtime[256] = {
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30,
32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62,
64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94,
96, 98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,
128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,
160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,
192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,
224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,
27, 25, 31, 29, 19, 17, 23, 21, 11, 9, 15, 13, 3, 1, 7, 5,
59, 57, 63, 61, 51, 49, 55, 53, 43, 41, 47, 45, 35, 33, 39, 37,
91, 89, 95, 93, 83, 81, 87, 85, 75, 73, 79, 77, 67, 65, 71, 69,
123,121,127,125,115,113,119,117,107,105,111,109, 99, 97,103,101,
155,153,159,157,147,145,151,149,139,137,143,141,131,129,135,133,
187,185,191,189,179,177,183,181,171,169,175,173,163,161,167,165,
219,217,223,221,211,209,215,213,203,201,207,205,195,193,199,197,
251,249,255,253,243,241,247,245,235,233,239,237,227,225,231,229
};
const u8 Xtime[256] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42,
44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86,
88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130,
132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174,
176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218,
220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 27, 25, 31, 29,
19, 17, 23, 21, 11, 9, 15, 13, 3, 1, 7, 5, 59, 57, 63, 61, 51, 49, 55, 53, 43, 41,
47, 45, 35, 33, 39, 37, 91, 89, 95, 93, 83, 81, 87, 85, 75, 73, 79, 77, 67, 65, 71, 69,
123, 121, 127, 125, 115, 113, 119, 117, 107, 105, 111, 109, 99, 97, 103, 101, 155, 153, 159, 157, 147, 145,
151, 149, 139, 137, 143, 141, 131, 129, 135, 133, 187, 185, 191, 189, 179, 177, 183, 181, 171, 169, 175, 173,
163, 161, 167, 165, 219, 217, 223, 221, 211, 209, 215, 213, 203, 201, 207, 205, 195, 193, 199, 197, 251, 249,
255, 253, 243, 241, 247, 245, 235, 233, 239, 237, 227, 225, 231, 229};
/*-------------------------------------------------------------------
* Rijndael key schedule function. Takes 16-byte key and creates
* all Rijndael's internal subkeys ready for encryption.
+24 -29
View File
@@ -91,29 +91,29 @@ static int _nas_user_proc_clac (nas_user_t *user, const at_command_t *data);
/* NAS procedures applicable to AT commands */
typedef int (*_nas_user_procedure_t) (nas_user_t *, const at_command_t *);
static _nas_user_procedure_t _nas_user_procedure[AT_COMMAND_ID_MAX] = {
NULL,
_nas_user_proc_cgsn, /* CGSN */
_nas_user_proc_cgmi, /* CGMI */
_nas_user_proc_cgmm, /* CGMM */
_nas_user_proc_cgmr, /* CGMR */
_nas_user_proc_cimi, /* CIMI */
_nas_user_proc_cfun, /* CFUN */
_nas_user_proc_cpin, /* CPIN */
_nas_user_proc_csq, /* CSQ */
_nas_user_proc_cesq, /* CESQ */
_nas_user_proc_clac, /* CLAC */
_nas_user_proc_cmee, /* CMEE */
_nas_user_proc_cnum, /* CNUM */
_nas_user_proc_clck, /* CLCK */
_nas_user_proc_cops, /* COPS */
_nas_user_proc_creg, /* CREG */
_nas_user_proc_cgatt, /* CGATT */
_nas_user_proc_cgreg, /* CGREG */
_nas_user_proc_cereg, /* CEREG */
_nas_user_proc_cgdcont, /* CGDCONT */
_nas_user_proc_cgact, /* CGACT */
_nas_user_proc_cgpaddr, /* CGPADDR */
static const _nas_user_procedure_t _nas_user_procedure[AT_COMMAND_ID_MAX] = {
NULL,
_nas_user_proc_cgsn, /* CGSN */
_nas_user_proc_cgmi, /* CGMI */
_nas_user_proc_cgmm, /* CGMM */
_nas_user_proc_cgmr, /* CGMR */
_nas_user_proc_cimi, /* CIMI */
_nas_user_proc_cfun, /* CFUN */
_nas_user_proc_cpin, /* CPIN */
_nas_user_proc_csq, /* CSQ */
_nas_user_proc_cesq, /* CESQ */
_nas_user_proc_clac, /* CLAC */
_nas_user_proc_cmee, /* CMEE */
_nas_user_proc_cnum, /* CNUM */
_nas_user_proc_clck, /* CLCK */
_nas_user_proc_cops, /* COPS */
_nas_user_proc_creg, /* CREG */
_nas_user_proc_cgatt, /* CGATT */
_nas_user_proc_cgreg, /* CGREG */
_nas_user_proc_cereg, /* CEREG */
_nas_user_proc_cgdcont, /* CGDCONT */
_nas_user_proc_cgact, /* CGACT */
_nas_user_proc_cgpaddr, /* CGPADDR */
};
/*
@@ -122,12 +122,7 @@ static _nas_user_procedure_t _nas_user_procedure[AT_COMMAND_ID_MAX] = {
* ---------------------------------------------------------------------
*/
static const char *_nas_user_sim_status_str[] = {
"READY",
"SIM PIN",
"SIM PUK",
"PH-SIM PIN"
};
static const char *const _nas_user_sim_status_str[] = {"READY", "SIM PIN", "SIM PUK", "PH-SIM PIN"};
/****************************************************************************/
/****************** E X P O R T E D F U N C T I O N S ******************/
+1 -1
View File
@@ -1290,7 +1290,7 @@ int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t
}
/* Handlers matrix. Only gNB related procedure present here */
ngap_message_decoded_callback ngap_messages_callback[][3] = {
const ngap_message_decoded_callback ngap_messages_callback[][3] = {
{0, 0, 0}, /* AMFConfigurationUpdate */
{0, 0, 0}, /* AMFStatusIndication */
{0, 0, 0}, /* CellTrafficTrace */
+28 -36
View File
@@ -22,42 +22,34 @@
#include <stdint.h>
/* Rijndael S-box SR */
uint8_t SR[256] = {
0x63,0x7C,0x77,0x7B,0xF2,0x6B,0x6F,0xC5,0x30,0x01,0x67,0x2B,0xFE,0xD7,0xAB,0x76,
0xCA,0x82,0xC9,0x7D,0xFA,0x59,0x47,0xF0,0xAD,0xD4,0xA2,0xAF,0x9C,0xA4,0x72,0xC0,
0xB7,0xFD,0x93,0x26,0x36,0x3F,0xF7,0xCC,0x34,0xA5,0xE5,0xF1,0x71,0xD8,0x31,0x15,
0x04,0xC7,0x23,0xC3,0x18,0x96,0x05,0x9A,0x07,0x12,0x80,0xE2,0xEB,0x27,0xB2,0x75,
0x09,0x83,0x2C,0x1A,0x1B,0x6E,0x5A,0xA0,0x52,0x3B,0xD6,0xB3,0x29,0xE3,0x2F,0x84,
0x53,0xD1,0x00,0xED,0x20,0xFC,0xB1,0x5B,0x6A,0xCB,0xBE,0x39,0x4A,0x4C,0x58,0xCF,
0xD0,0xEF,0xAA,0xFB,0x43,0x4D,0x33,0x85,0x45,0xF9,0x02,0x7F,0x50,0x3C,0x9F,0xA8,
0x51,0xA3,0x40,0x8F,0x92,0x9D,0x38,0xF5,0xBC,0xB6,0xDA,0x21,0x10,0xFF,0xF3,0xD2,
0xCD,0x0C,0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 0x39, 0xF1, 0xB8, 0xF3, 0x3D, 0xF2, 0xD5, 0x97, 0x66, 0x81, 0x32, 0xA0, 0x00,
0x06, 0xCE, 0xF6, 0xEA, 0xB7, 0x17, 0xF7, 0x8C, 0x79, 0xD6, 0xA7, 0xBF, 0x8B, 0x3F, 0x1F, 0x53, 0x63, 0x75, 0x35, 0x2C,
0x60, 0xFD, 0x27, 0xD3, 0x94, 0xA5, 0x7C, 0xA1, 0x05, 0x58, 0x2D, 0xBD, 0xD9, 0xC7, 0xAF, 0x6B, 0x54, 0x0B, 0xE0, 0x38,
0x04, 0xC8, 0x9D, 0xE7, 0x14, 0xB1, 0x87, 0x9C, 0xDF, 0x6F, 0xF9, 0xDA, 0x2A, 0xC4, 0x59, 0x16, 0x74, 0x91, 0xAB, 0x26,
0x61, 0x76, 0x34, 0x2B, 0xAD, 0x99, 0xFB, 0x72, 0xEC, 0x33, 0x12, 0xDE, 0x98, 0x3B, 0xC0, 0x9B, 0x3E, 0x18, 0x10, 0x3A,
0x56, 0xE1, 0x77, 0xC9, 0x1E, 0x9E, 0x95, 0xA3, 0x90, 0x19, 0xA8, 0x6C, 0x09, 0xD0, 0xF0, 0x86};
+1 -1
View File
@@ -52,7 +52,7 @@ extern uint16_t NB_UE_INST;
static uicc_t** uiccArray=NULL;
const char *hexTable="0123456789abcdef";
const char *const hexTable = "0123456789abcdef";
static inline uint8_t mkDigit(unsigned char in) {
for (int i=0; i<16; i++)
if (tolower(in)==hexTable[i])