add eia1 tests and fix sib2 bug (#311)

* Starting to add EIA1 tests.

* Initial tests for EIA1

* Bit shifted bearer by 27. Test case 1 and 4 are passing now.

* Adding EIA test case 7.

* Making sure the test is called.

* Fixed double initialization of msg_len_bits.
master
Andre Puschmann 6 years ago committed by GitHub
parent 192fcd726e
commit 59d9a78869
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -146,7 +146,7 @@ uint8_t security_128_eia1( uint8_t *key,
msg_len_bits = msg_len*8; msg_len_bits = msg_len*8;
m_ptr = snow3g_f9(key, m_ptr = snow3g_f9(key,
count, count,
bearer, bearer<<27,
direction, direction,
msg, msg,
msg_len_bits); msg_len_bits);

@ -29,6 +29,10 @@ add_executable(msg_queue_test msg_queue_test.cc)
target_link_libraries(msg_queue_test srslte_phy srslte_common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) target_link_libraries(msg_queue_test srslte_phy srslte_common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
add_test(msg_queue_test msg_queue_test) add_test(msg_queue_test msg_queue_test)
add_executable(test_eia1 test_eia1.cc)
target_link_libraries(test_eia1 srslte_common srslte_phy ${CMAKE_THREAD_LIBS_INIT})
add_test(test_eia1 test_eia1)
add_executable(test_eea1 test_eea1.cc) add_executable(test_eea1 test_eea1.cc)
target_link_libraries(test_eea1 srslte_common srslte_phy ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(test_eea1 srslte_common srslte_phy ${CMAKE_THREAD_LIBS_INIT})
add_test(test_eea1 test_eea1) add_test(test_eea1 test_eea1)

@ -0,0 +1,204 @@
/*
* Includes
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <sys/time.h>
#include "srslte/srslte.h"
#include "srslte/common/security.h"
/*
* Tests
*
* Document Reference: 33.401 V14.6.0 Annex C.4
*
*/
void test_set_1()
{
uint8_t key[] = {0x2b, 0xd6, 0x45, 0x9f, 0x82, 0xc5, 0xb3, 0x00, 0x95, 0x2c, 0x49, 0x10, 0x48, 0x81, 0xff, 0x48};
uint32_t count = 0x38a6f056;
uint8_t bearer = 0x1f;
uint8_t direction = 0;
uint32_t len_bits = 88, len_bytes = (len_bits + 7) / 8;
uint8_t msg[] = {0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x61, 0x37, 0x34, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8_t mt[] = {0x73, 0x1f, 0x11, 0x65};
uint8_t mac[4];
// gen mac
srslte::security_128_eia1(key, count, bearer, direction, msg, len_bytes, mac);
for(int i=0; i<4; i++) {
assert(mac[i] == mt[i]);
}
}
void test_set_4()
{
uint8_t key[] = {0x83, 0xfd, 0x23, 0xa2, 0x44, 0xa7, 0x4c, 0xf3, 0x58, 0xda, 0x30, 0x19, 0xf1, 0x72, 0x26, 0x35};
uint32_t count = 0x36af6144;
uint8_t bearer = 0x0f;
uint8_t direction = 1;
uint32_t len_bits = 768, len_bytes = (len_bits + 7) / 8;
uint8_t msg[] = {0x35, 0xc6, 0x87, 0x16, 0x63, 0x3c, 0x66, 0xfb, 0x75, 0x0c, 0x26, 0x68, 0x65, 0xd5, 0x3c, 0x11,
0xea, 0x05, 0xb1, 0xe9, 0xfa, 0x49, 0xc8, 0x39, 0x8d, 0x48, 0xe1, 0xef, 0xa5, 0x90, 0x9d, 0x39,
0x47, 0x90, 0x28, 0x37, 0xf5, 0xae, 0x96, 0xd5, 0xa0, 0x5b, 0xc8, 0xd6, 0x1c, 0xa8, 0xdb, 0xef,
0x1b, 0x13, 0xa4, 0xb4, 0xab, 0xfe, 0x4f, 0xb1, 0x00, 0x60, 0x45, 0xb6, 0x74, 0xbb, 0x54, 0x72,
0x93, 0x04, 0xc3, 0x82, 0xbe, 0x53, 0xa5, 0xaf, 0x05, 0x55, 0x61, 0x76, 0xf6, 0xea, 0xa2, 0xef,
0x1d, 0x05, 0xe4, 0xb0, 0x83, 0x18, 0x1e, 0xe6, 0x74, 0xcd, 0xa5, 0xa4, 0x85, 0xf7, 0x4d, 0x7a};
uint8_t mt[] = {0xbb, 0xa7, 0x44, 0x92};
uint8_t mac[4];
// gen mac
srslte::security_128_eia1(key, count, bearer, direction, msg, len_bytes, mac);
for(int i=0; i<4; i++) {
assert(mac[i] == mt[i]);
}
}
void test_set_7()
{
uint8_t key[] = {0xb3, 0x12, 0x0f, 0xfd, 0xb2, 0xcf, 0x6a, 0xf4, 0xe7, 0x3e, 0xaf, 0x2e, 0xf4, 0xeb, 0xec, 0x69};
uint32_t count = 0x296f393c;
uint8_t bearer = 0x0b;
uint8_t direction = 1;
uint32_t len_bits = 16448, len_bytes = (len_bits + 7) / 8;
uint8_t msg[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xe0, 0x95, 0x80,
0x45, 0xf3, 0xa0, 0xbb, 0xa4, 0xe3, 0x96, 0x83, 0x46, 0xf0, 0xa3, 0xb8, 0xa7, 0xc0, 0x2a, 0x01, 0x8a, 0xe6, 0x40,
0x76, 0x52, 0x26, 0xb9, 0x87, 0xc9, 0x13, 0xe6, 0xcb, 0xf0, 0x83, 0x57, 0x00, 0x16, 0xcf, 0x83, 0xef, 0xbc, 0x61,
0xc0, 0x82, 0x51, 0x3e, 0x21, 0x56, 0x1a, 0x42, 0x7c, 0x00, 0x9d, 0x28, 0xc2, 0x98, 0xef, 0xac, 0xe7, 0x8e, 0xd6,
0xd5, 0x6c, 0x2d, 0x45, 0x05, 0xad, 0x03, 0x2e, 0x9c, 0x04, 0xdc, 0x60, 0xe7, 0x3a, 0x81, 0x69, 0x6d, 0xa6, 0x65,
0xc6, 0xc4, 0x86, 0x03, 0xa5, 0x7b, 0x45, 0xab, 0x33, 0x22, 0x15, 0x85, 0xe6, 0x8e, 0xe3, 0x16, 0x91, 0x87, 0xfb,
0x02, 0x39, 0x52, 0x86, 0x32, 0xdd, 0x65, 0x6c, 0x80, 0x7e, 0xa3, 0x24, 0x8b, 0x7b, 0x46, 0xd0, 0x02, 0xb2, 0xb5,
0xc7, 0x45, 0x8e, 0xb8, 0x5b, 0x9c, 0xe9, 0x58, 0x79, 0xe0, 0x34, 0x08, 0x59, 0x05, 0x5e, 0x3b, 0x0a, 0xbb, 0xc3,
0xea, 0xce, 0x87, 0x19, 0xca, 0xa8, 0x02, 0x65, 0xc9, 0x72, 0x05, 0xd5, 0xdc, 0x4b, 0xcc, 0x90, 0x2f, 0xe1, 0x83,
0x96, 0x29, 0xed, 0x71, 0x32, 0x8a, 0x0f, 0x04, 0x49, 0xf5, 0x88, 0x55, 0x7e, 0x68, 0x98, 0x86, 0x0e, 0x04, 0x2a,
0xec, 0xd8, 0x4b, 0x24, 0x04, 0xc2, 0x12, 0xc9, 0x22, 0x2d, 0xa5, 0xbf, 0x8a, 0x89, 0xef, 0x67, 0x97, 0x87, 0x0c,
0xf5, 0x07, 0x71, 0xa6, 0x0f, 0x66, 0xa2, 0xee, 0x62, 0x85, 0x36, 0x57, 0xad, 0xdf, 0x04, 0xcd, 0xde, 0x07, 0xfa,
0x41, 0x4e, 0x11, 0xf1, 0x2b, 0x4d, 0x81, 0xb9, 0xb4, 0xe8, 0xac, 0x53, 0x8e, 0xa3, 0x06, 0x66, 0x68, 0x8d, 0x88,
0x1f, 0x6c, 0x34, 0x84, 0x21, 0x99, 0x2f, 0x31, 0xb9, 0x4f, 0x88, 0x06, 0xed, 0x8f, 0xcc, 0xff, 0x4c, 0x91, 0x23,
0xb8, 0x96, 0x42, 0x52, 0x7a, 0xd6, 0x13, 0xb1, 0x09, 0xbf, 0x75, 0x16, 0x74, 0x85, 0xf1, 0x26, 0x8b, 0xf8, 0x84,
0xb4, 0xcd, 0x23, 0xd2, 0x9a, 0x09, 0x34, 0x92, 0x57, 0x03, 0xd6, 0x34, 0x09, 0x8f, 0x77, 0x67, 0xf1, 0xbe, 0x74,
0x91, 0xe7, 0x08, 0xa8, 0xbb, 0x94, 0x9a, 0x38, 0x73, 0x70, 0x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0x72, 0xb9, 0xec, 0x1d, 0xe2,
0x15, 0x88, 0xbd, 0x35, 0x48, 0x4e, 0xa4, 0x44, 0x36, 0x34, 0x3f, 0xf9, 0x5e, 0xad, 0x6a, 0xb1, 0xd8, 0xaf, 0xb1,
0xb2, 0xa3, 0x03, 0xdf, 0x1b, 0x71, 0xe5, 0x3c, 0x4a, 0xea, 0x6b, 0x2e, 0x3e, 0x93, 0x72, 0xbe, 0x0d, 0x1b, 0xc9,
0x97, 0x98, 0xb0, 0xce, 0x3c, 0xc1, 0x0d, 0x2a, 0x59, 0x6d, 0x56, 0x5d, 0xba, 0x82, 0xf8, 0x8c, 0xe4, 0xcf, 0xf3,
0xb3, 0x3d, 0x5d, 0x24, 0xe9, 0xc0, 0x83, 0x11, 0x24, 0xbf, 0x1a, 0xd5, 0x4b, 0x79, 0x25, 0x32, 0x98, 0x3d, 0xd6,
0xc3, 0xa8, 0xb7, 0xd0};
uint8_t mt[] = {0xab, 0xf3, 0xe6, 0x51};
uint8_t mac[4];
// gen mac
srslte::security_128_eia1(key, count, bearer, direction, msg, len_bytes, mac);
for(int i=0; i<4; i++) {
assert(mac[i] == mt[i]);
}
}
/*
* Functions
*/
int main(int argc, char * argv[]) {
test_set_1();
test_set_4();
test_set_7();
}
Loading…
Cancel
Save