Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
ae751e13
Commit
ae751e13
authored
Jul 12, 2023
by
Vaibhav Shrivastava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
incorrectStringBooleanError CPPCheck warnings fix on W27
parent
cf387a48
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
21 deletions
+21
-21
common/utils/ds/byte_array.c
common/utils/ds/byte_array.c
+1
-1
openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c
openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c
+2
-2
openair3/SECU/aes_128_cbc_cmac.c
openair3/SECU/aes_128_cbc_cmac.c
+2
-2
openair3/SECU/aes_128_ctr.c
openair3/SECU/aes_128_ctr.c
+1
-1
openair3/SECU/aes_128_ecb.c
openair3/SECU/aes_128_ecb.c
+1
-1
openair3/SECU/secu_defs.c
openair3/SECU/secu_defs.c
+2
-2
openair3/TEST/test_aes128_ctr.c
openair3/TEST/test_aes128_ctr.c
+12
-12
No files found.
common/utils/ds/byte_array.c
View file @
ae751e13
...
...
@@ -28,7 +28,7 @@ byte_array_t copy_byte_array(byte_array_t src)
{
byte_array_t
dst
=
{
0
};
dst
.
buf
=
malloc
(
src
.
len
);
DevAssert
(
dst
.
buf
!=
NULL
&&
"Memory exhausted"
);
AssertFatal
(
dst
.
buf
!=
NULL
,
"Memory exhausted"
);
memcpy
(
dst
.
buf
,
src
.
buf
,
src
.
len
);
dst
.
len
=
src
.
len
;
return
dst
;
...
...
openair2/LAYER2/nr_pdcp/nr_pdcp_integrity_nia2.c
View file @
ae751e13
...
...
@@ -35,8 +35,8 @@ void *nr_pdcp_integrity_nia2_init(uint8_t integrity_key[16])
// This is a hack. Reduce the 3 functions to just cipher?
// No. The overhead is x8 times more. Don't change before measuring
// return integrity_key;
cbc_cmac_ctx_t
*
ctx
=
calloc
(
1
,
sizeof
(
cbc_cmac_ctx_t
));
DevAssert
(
ctx
!=
NULL
&&
"Memory exhausted"
);
cbc_cmac_ctx_t
*
ctx
=
calloc
(
1
,
sizeof
(
cbc_cmac_ctx_t
));
AssertFatal
(
ctx
!=
NULL
,
"Memory exhausted"
);
*
ctx
=
init_aes_128_cbc_cmac
(
integrity_key
);
return
ctx
;
...
...
openair3/SECU/aes_128_cbc_cmac.c
View file @
ae751e13
...
...
@@ -184,7 +184,7 @@ void aes_128_cbc_cmac(const aes_128_t* k_iv, byte_array_t msg, size_t len_out, u
sz_iv
=
16
;
iv
=
(
uint8_t
*
)
k_iv
->
iv16
.
iv
;
}
else
{
DevAssert
(
0
!=
0
&&
"Unknwon Initialization vector"
);
AssertFatal
(
0
!=
0
,
"Unknwon Initialization vector"
);
}
CMAC_Update
(
ctx
,
iv
,
sz_iv
);
...
...
@@ -233,7 +233,7 @@ void cipher_aes_128_cbc_cmac(cbc_cmac_ctx_t const* ctx, const aes_128_t* k_iv, b
sz_iv
=
16
;
iv
=
(
uint8_t
*
)
k_iv
->
iv16
.
iv
;
}
else
{
DevAssert
(
0
!=
0
&&
"Unknwon Initialization vector"
);
AssertFatal
(
0
!=
0
,
"Unknwon Initialization vector"
);
}
CMAC_Update
(
ctx
->
mac
,
iv
,
sz_iv
);
...
...
openair3/SECU/aes_128_ctr.c
View file @
ae751e13
...
...
@@ -49,7 +49,7 @@ void aes_128_ctr(const aes_128_t* k_iv, byte_array_t msg, size_t len_out, uint8_
int
len_ev
=
0
;
rc
=
EVP_EncryptUpdate
(
ctx
,
out
,
&
len_ev
,
msg
.
buf
,
msg
.
len
);
DevAssert
(
!
(
len_ev
>
len_out
)
&&
"Buffer overflow"
);
AssertFatal
(
!
(
len_ev
>
len_out
),
"Buffer overflow"
);
// Finalise the encryption. Normally ciphertext bytes may be written at
// this stage, but this does not occur in GCM mode
...
...
openair3/SECU/aes_128_ecb.c
View file @
ae751e13
...
...
@@ -40,7 +40,7 @@ void aes_128_ecb(const aes_128_t* k_iv, byte_array_t msg, size_t len_out, uint8_
int
len_ev
=
0
;
rc
=
EVP_EncryptUpdate
(
ctx
,
out
,
&
len_ev
,
msg
.
buf
,
msg
.
len
);
DevAssert
(
!
(
len_ev
>
len_out
)
&&
"Buffer overflow"
);
AssertFatal
(
!
(
len_ev
>
len_out
),
"Buffer overflow"
);
// Finalise the encryption. Normally ciphertext bytes may be written at
// this stage, but this does not occur in GCM mode
...
...
openair3/SECU/secu_defs.c
View file @
ae751e13
...
...
@@ -43,7 +43,7 @@ void stream_compute_integrity(eia_alg_id_e alg, nas_stream_cipher_t const* strea
nas_stream_encrypt_eia2
(
stream_cipher
,
out
);
}
else
{
LOG_E
(
OSA
,
"Provided integrity algorithm is currently not supported = %u
\n
"
,
alg
);
DevAssert
(
0
!=
0
&&
"Unknown Algorithm type"
);
AssertFatal
(
0
!=
0
,
"Unknown Algorithm type"
);
}
}
...
...
@@ -60,7 +60,7 @@ void stream_compute_encrypt(eea_alg_id_e alg, nas_stream_cipher_t const* stream_
nas_stream_encrypt_eea2
(
stream_cipher
,
out
);
}
else
{
LOG_E
(
OSA
,
"Provided encrypt algorithm is currently not supported = %u
\n
"
,
alg
);
DevAssert
(
0
!=
0
&&
"Unknown Algorithm type"
);
AssertFatal
(
0
!=
0
,
"Unknown Algorithm type"
);
}
}
openair3/TEST/test_aes128_ctr.c
View file @
ae751e13
...
...
@@ -49,7 +49,7 @@ void test_1(void)
0xb2
,
0x0e
,
0xd7
,
0xda
,
0xd2
,
0xf2
,
0x33
,
0xdc
,
0x3c
,
0x22
,
0xd7
,
0xbd
,
0xee
,
0xed
,
0x8e
,
0x78
};
int
rc
=
memcmp
(
out
,
result
,
32
);
DevAssert
(
rc
==
0
&&
"Ciphering did not produce the expected results"
);
AssertFatal
(
rc
==
0
,
"Ciphering did not produce the expected results"
);
uint8_t
text_decipher
[
32
]
=
{
0
};
...
...
@@ -57,7 +57,7 @@ void test_1(void)
aes_128_ctr
(
&
p
,
32
,
out
,
32
,
text_decipher
);
rc
=
memcmp
(
text
,
text_decipher
,
32
);
DevAssert
(
rc
==
0
&&
"Text and deciphered text do not match
"
);
AssertFatal
(
rc
==
0
,
"Error: Text and deciphered text do not match
\n
"
);
}
void
test_2
(
void
)
...
...
@@ -83,13 +83,13 @@ void test_2(void)
0x92
,
0x23
,
0x95
,
0x87
,
0xb8
,
0x95
,
0x60
,
0x86
,
0xbc
,
0xab
,
0x18
,
0x83
,
0x60
,
0x42
,
0xe2
,
0xe6
,
0xce
,
0x42
,
0x43
,
0x2a
,
0x17
,
0x10
,
0x5c
,
0x53
,
0xd0
};
int
rc
=
memcmp
(
out
,
result
,
99
);
DevAssert
(
rc
==
0
&&
"Ciphering did not produce the expected results"
);
AssertFatal
(
rc
==
0
,
"Ciphering did not produce the expected results"
);
uint8_t
text_decipher
[
100
]
=
{
0
};
aes_128_ctr
(
&
p
,
99
,
out
,
99
,
text_decipher
);
rc
=
memcmp
(
text
,
text_decipher
,
99
);
DevAssert
(
rc
==
0
&&
"Text and deciphered text do not match"
);
AssertFatal
(
rc
==
0
,
"Text and deciphered text do not match"
);
}
void
test_3
(
void
)
...
...
@@ -110,14 +110,14 @@ void test_3(void)
0xa4
,
0x81
,
0x38
,
0xa3
,
0xb0
,
0xc4
,
0x71
,
0xe2
,
0xa7
,
0x04
,
0x1a
,
0x57
,
0x64
,
0x23
,
0xd2
,
0x92
,
0x72
,
0x87
,
0xf0
,
0x00
};
int
rc
=
memcmp
(
out
,
result
,
39
);
DevAssert
(
rc
==
0
&&
"Ciphering did not produce the expected results"
);
AssertFatal
(
rc
==
0
,
"Ciphering did not produce the expected results"
);
// Decipher
uint8_t
text_decipher
[
40
]
=
{
0
};
aes_128_ctr
(
&
p
,
40
,
out
,
40
,
text_decipher
);
rc
=
memcmp
(
text
,
text_decipher
,
39
);
DevAssert
(
rc
==
0
&&
"Text and deciphered text do not match"
);
AssertFatal
(
rc
==
0
,
"Text and deciphered text do not match"
);
}
void
test_4
(
void
)
...
...
@@ -144,14 +144,14 @@ void test_4(void)
0x10
,
0xfe
,
0xb3
,
0x24
,
0xba
,
0x74
,
0xc4
,
0xc1
,
0x56
,
0xe0
,
0x4d
,
0x39
,
0x09
,
0x72
,
0x09
,
0x65
,
0x3a
,
0xc3
,
0x3e
,
0x5a
,
0x5f
,
0x2d
,
0x88
,
0x64
};
int
rc
=
memcmp
(
out
,
result
,
127
);
DevAssert
(
rc
==
0
&&
"Ciphering did not produce the expected results"
);
AssertFatal
(
rc
==
0
,
"Ciphering did not produce the expected results"
);
// Decipher
uint8_t
text_decipher
[
128
]
=
{
0
};
aes_128_ctr
(
&
p
,
128
,
out
,
128
,
text_decipher
);
rc
=
memcmp
(
text
,
text_decipher
,
127
);
DevAssert
(
rc
==
0
&&
"Text and deciphered text do not match"
);
AssertFatal
(
rc
==
0
,
"Text and deciphered text do not match"
);
}
void
test_5
(
void
)
...
...
@@ -180,14 +180,14 @@ void test_5(void)
0x3f
,
0x95
,
0x62
,
0x33
,
0x71
,
0xd4
,
0x9b
,
0x14
,
0x7c
,
0x0a
,
0xf4
,
0x86
,
0x17
,
0x1f
,
0x22
,
0xcd
,
0x04
,
0xb1
,
0xcb
,
0xeb
,
0x26
,
0x58
,
0x22
,
0x3e
,
0x69
,
0x38
};
int
rc
=
memcmp
(
out
,
result
,
155
);
DevAssert
(
rc
==
0
&&
"Ciphering did not produce the expected results"
);
AssertFatal
(
rc
==
0
,
"Ciphering did not produce the expected results"
);
// Decipher
uint8_t
text_decipher
[
156
]
=
{
0
};
aes_128_ctr
(
&
p
,
156
,
out
,
156
,
text_decipher
);
rc
=
memcmp
(
text
,
text_decipher
,
155
);
DevAssert
(
rc
==
0
&&
"Text and deciphered text do not match"
);
AssertFatal
(
rc
==
0
,
"Text and deciphered text do not match"
);
}
void
test_6
(
void
)
...
...
@@ -238,14 +238,14 @@ void test_6(void)
0x7a
,
0xb3
,
0xb6
,
0x72
,
0x5d
,
0x1a
,
0x6f
,
0x3f
,
0x98
,
0xb9
,
0xc9
,
0xda
,
0xa8
,
0x98
,
0x2a
,
0xff
,
0x06
,
0x78
,
0x28
,
0x00
};
int
rc
=
memcmp
(
out
,
result
,
483
);
DevAssert
(
rc
==
0
&&
"Ciphering did not produce the expected results"
);
AssertFatal
(
rc
==
0
,
"Ciphering did not produce the expected results"
);
// Decipher
uint8_t
text_decipher
[
512
]
=
{
0
};
aes_128_ctr
(
&
p
,
512
,
out
,
512
,
text_decipher
);
rc
=
memcmp
(
text
,
text_decipher
,
483
);
DevAssert
(
rc
==
0
&&
"Text and deciphered text do not match"
);
AssertFatal
(
rc
==
0
,
"Text and deciphered text do not match"
);
}
void
doit
(
void
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment