OSA SECU harmonization

This commit is contained in:
mir
2023-05-26 12:35:33 +02:00
committed by Robert Schmidt
parent 7c7d54e463
commit c9012298de
53 changed files with 832 additions and 1778 deletions
+8 -13
View File
@@ -53,8 +53,6 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include "secu_defs.h"
#include "emmData.h"
//#define DEBUG_NAS_MESSAGE
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
@@ -1019,7 +1017,8 @@ static int _nas_message_decrypt(
stream_cipher.message = (unsigned char *)src;
/* length in bits */
stream_cipher.blength = length << 3;
nas_stream_encrypt_eea1(&stream_cipher, (unsigned char *)dest);
stream_compute_encrypt(EEA1_128_ALG_ID, &stream_cipher, (unsigned char *)dest);
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
DECODE_U8(dest, *(uint8_t*)(&header), size);
@@ -1054,7 +1053,8 @@ static int _nas_message_decrypt(
stream_cipher.message = (unsigned char *)src;
/* length in bits */
stream_cipher.blength = length << 3;
nas_stream_encrypt_eea1(&stream_cipher, (unsigned char *)dest);
stream_compute_encrypt(EEA1_128_ALG_ID, &stream_cipher, (unsigned char *)dest);
/* Decode the first octet (security header type or EPS bearer identity,
* and protocol discriminator) */
DECODE_U8(dest, *(uint8_t*)(&header), size);
@@ -1186,8 +1186,7 @@ static int _nas_message_encrypt(
stream_cipher.message = (unsigned char *)src;
/* length in bits */
stream_cipher.blength = length << 3;
nas_stream_encrypt_eea1(&stream_cipher, (unsigned char *)dest);
stream_compute_encrypt(EEA1_128_ALG_ID, &stream_cipher, (unsigned char *)dest);
LOG_FUNC_RETURN (length);
}
@@ -1217,7 +1216,7 @@ static int _nas_message_encrypt(
stream_cipher.message = (unsigned char *)src;
/* length in bits */
stream_cipher.blength = length << 3;
nas_stream_encrypt_eea2(&stream_cipher, (unsigned char *)dest);
stream_compute_encrypt(EEA2_128_ALG_ID, &stream_cipher, (unsigned char *)dest);
LOG_FUNC_RETURN (length);
@@ -1356,10 +1355,8 @@ static uint32_t _nas_message_get_mac(
stream_cipher.message = (unsigned char *)buffer;
/* length in bits */
stream_cipher.blength = length << 3;
stream_compute_integrity(EIA1_128_ALG_ID, &stream_cipher, mac);
nas_stream_encrypt_eia1(
&stream_cipher,
mac);
LOG_TRACE(DEBUG,
"NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d",
mac[0], mac[1], mac[2],mac[3],
@@ -1402,10 +1399,8 @@ static uint32_t _nas_message_get_mac(
stream_cipher.message = (unsigned char *)buffer;
/* length in bits */
stream_cipher.blength = length << 3;
stream_compute_integrity(EIA2_128_ALG_ID, &stream_cipher, mac);
nas_stream_encrypt_eia2(
&stream_cipher,
mac);
LOG_TRACE(DEBUG,
"NAS_SECURITY_ALGORITHMS_EIA2 returned MAC %x.%x.%x.%x(%u) for length %d direction %d, count %d",
mac[0], mac[1], mac[2],mac[3],