|
|
@ -211,7 +211,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8*
|
|
|
|
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
uint8 s[7];
|
|
|
|
uint8 s[7];
|
|
|
|
|
|
|
|
|
|
|
|
if (k_asme != NULL && k_nas_enc != NULL && k_nas_int != NULL) {
|
|
|
|
if (k_asme != NULL && k_nas_enc != NULL) { //{}
|
|
|
|
|
|
|
|
if (enc_alg_id != LIBLTE_SECURITY_CIPHERING_ALGORITHM_ID_EEA0) {
|
|
|
|
// Construct S for KNASenc
|
|
|
|
// Construct S for KNASenc
|
|
|
|
s[0] = 0x15; // FC
|
|
|
|
s[0] = 0x15; // FC
|
|
|
|
s[1] = 0x01; // P0
|
|
|
|
s[1] = 0x01; // P0
|
|
|
@ -223,7 +224,12 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8*
|
|
|
|
|
|
|
|
|
|
|
|
// Derive KNASenc
|
|
|
|
// Derive KNASenc
|
|
|
|
sha256(k_asme, 32, s, 7, k_nas_enc, 0);
|
|
|
|
sha256(k_asme, 32, s, 7, k_nas_enc, 0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
memset(k_nas_enc, 0, 32);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (k_asme != NULL && k_nas_int != NULL) {
|
|
|
|
// Construct S for KNASint
|
|
|
|
// Construct S for KNASint
|
|
|
|
s[0] = 0x15; // FC
|
|
|
|
s[0] = 0x15; // FC
|
|
|
|
s[1] = 0x02; // P0
|
|
|
|
s[1] = 0x02; // P0
|
|
|
|