• Cedric Roux's avatar
    bugfix: use correct algorithm and derive keys accordingly · a1eb8f35
    Cedric Roux authored
    This was not a big problem, but we were advertising wrong
    algorithm and deriving keys using this wrong algorithm in case
    DRB ciphering and/or integrity was not active. (Say SRBs
    are configured with NIA2 but DRBs are configured without
    integrity, we would advertise NIA2 and send the integrity
    key derived for NIA2, instead of NIA0 for both.)
    
    It was not a problem because in the PDU Session Resource To Setup
    item, there is "securityIndication" which we use to effectively
    activate/deactivate the ciphering and/or integrity.
    
    But it did not look clean to see a SecurityInformation with
    incorrect data when inspecting the message in wireshark.
    
    So let's use the correct values.
    
    We could also not include the SecurityInformation if both ciphering
    and integrity are not used, and only include ciphering if integrity
    is not used (because integrity settings are optional).
    
    But then if only integrity is used, we still need to include
    ciphering, setting algorithm to NEA0 (no ciphering), because
    the ciphering settings are always included.
    
    This logic is too complex, let's use the simple one to always
    include SecurityInformation with NEA0 and/or NIA0 if ciphering
    and/or integrity is not activated.
    a1eb8f35
rrc_gNB_NGAP.c 63.5 KB