|
|
@ -428,7 +428,6 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nr_up(uint8*
|
|
|
|
|
|
|
|
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_sk_gnb(uint8_t* k_enb, uint8_t* sk_gnb, uint16_t scg_counter)
|
|
|
|
LIBLTE_ERROR_ENUM liblte_security_generate_sk_gnb(uint8_t* k_enb, uint8_t* sk_gnb, uint16_t scg_counter)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
uint8 s[5];
|
|
|
|
uint8 s[5];
|
|
|
|
|
|
|
|
|
|
|
@ -627,7 +626,10 @@ LIBLTE_ERROR_ENUM liblte_security_128_eia2(const uint8* key,
|
|
|
|
LIBLTE_BIT_MSG_STRUCT* msg,
|
|
|
|
LIBLTE_BIT_MSG_STRUCT* msg,
|
|
|
|
uint8* mac)
|
|
|
|
uint8* mac)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
if (!key || !msg || !mac) {
|
|
|
|
|
|
|
|
return LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8 M[msg->N_bits * 8 + 8 + 16];
|
|
|
|
uint8 M[msg->N_bits * 8 + 8 + 16];
|
|
|
|
aes_context ctx;
|
|
|
|
aes_context ctx;
|
|
|
|
uint32 i;
|
|
|
|
uint32 i;
|
|
|
@ -641,7 +643,6 @@ LIBLTE_ERROR_ENUM liblte_security_128_eia2(const uint8* key,
|
|
|
|
uint8 T[16];
|
|
|
|
uint8 T[16];
|
|
|
|
uint8 tmp[16];
|
|
|
|
uint8 tmp[16];
|
|
|
|
|
|
|
|
|
|
|
|
if (key != NULL && msg != NULL && mac != NULL) {
|
|
|
|
|
|
|
|
// Subkey L generation
|
|
|
|
// Subkey L generation
|
|
|
|
aes_setkey_enc(&ctx, key, 128);
|
|
|
|
aes_setkey_enc(&ctx, key, 128);
|
|
|
|
aes_crypt_ecb(&ctx, AES_ENCRYPT, const_zero, L);
|
|
|
|
aes_crypt_ecb(&ctx, AES_ENCRYPT, const_zero, L);
|
|
|
@ -714,10 +715,7 @@ LIBLTE_ERROR_ENUM liblte_security_128_eia2(const uint8* key,
|
|
|
|
mac[i] = T[i];
|
|
|
|
mac[i] = T[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
err = LIBLTE_SUCCESS;
|
|
|
|
return LIBLTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (err);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint32_t GET_WORD(uint32_t* DATA, uint32_t i)
|
|
|
|
uint32_t GET_WORD(uint32_t* DATA, uint32_t i)
|
|
|
|