nas: do not generate NAS encryption key if also is set to NULL

its more a cosmetic change to clean the logs. this makes
sure that a zero key is logged when NULL encryption is selected.
This commit is contained in:
Andre Puschmann 2020-07-10 13:20:13 +02:00
parent 7866f19f6b
commit dc67d28709
1 changed files with 17 additions and 11 deletions

View File

@ -211,7 +211,8 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8*
LIBLTE_ERROR_ENUM err = LIBLTE_ERROR_INVALID_INPUTS;
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
s[0] = 0x15; // FC
s[1] = 0x01; // P0
@ -223,7 +224,12 @@ LIBLTE_ERROR_ENUM liblte_security_generate_k_nas(uint8*
// Derive KNASenc
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
s[0] = 0x15; // FC
s[1] = 0x02; // P0