forked from acouzens/open5gs
update it
This commit is contained in:
parent
c55429c26d
commit
512c0fbd5c
|
@ -331,23 +331,12 @@ c_int32_t nas_decode_security_mode_reject(nas_message_t *message,
|
|||
status_t nas_plain_decode(nas_message_t *message, pkbuf_t *pkbuf)
|
||||
{
|
||||
status_t rv = CORE_ERROR;
|
||||
nas_security_header_t *security_header = NULL;
|
||||
c_uint16_t size = 0;
|
||||
c_uint16_t decoded = 0;
|
||||
|
||||
d_assert(pkbuf, return CORE_ERROR, "Null param");
|
||||
d_assert(pkbuf->payload, return CORE_ERROR, "Null param");
|
||||
|
||||
security_header = pkbuf->payload;
|
||||
if (security_header->security_header_type !=
|
||||
NAS_SECURITY_HEADER_PLAIN_NAS_MESSAGE)
|
||||
{
|
||||
size = sizeof(nas_security_header_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
decoded += size;
|
||||
}
|
||||
|
||||
memset(message, 0, sizeof(nas_message_t));
|
||||
|
||||
size = sizeof(nas_header_t);
|
||||
|
|
|
@ -105,6 +105,23 @@ status_t nas_security_encode(
|
|||
status_t nas_security_decode(
|
||||
nas_message_t *message, ue_ctx_t *ue, pkbuf_t *pkbuf)
|
||||
{
|
||||
nas_security_header_t *security_header = NULL;
|
||||
c_uint16_t size = 0;
|
||||
c_uint16_t decoded = 0;
|
||||
|
||||
d_assert(pkbuf, return CORE_ERROR, "Null param");
|
||||
d_assert(pkbuf->payload, return CORE_ERROR, "Null param");
|
||||
|
||||
security_header = pkbuf->payload;
|
||||
if (security_header->security_header_type !=
|
||||
NAS_SECURITY_HEADER_PLAIN_NAS_MESSAGE)
|
||||
{
|
||||
size = sizeof(nas_security_header_t);
|
||||
d_assert(pkbuf_header(pkbuf, -size) == CORE_OK,
|
||||
return CORE_ERROR, "pkbuf_header error");
|
||||
decoded += size;
|
||||
}
|
||||
|
||||
return nas_plain_decode(message, pkbuf);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,15 +5,16 @@
|
|||
#include "testutil.h"
|
||||
|
||||
#include "nas_message.h"
|
||||
#include "nas_security.h"
|
||||
|
||||
static void nas_message_test1(abts_case *tc, void *data)
|
||||
{
|
||||
/* Attach Request */
|
||||
char *payload =
|
||||
"17df675aa8050741020bf600f1100002"
|
||||
"01030003e605f07000001000050215d0"
|
||||
"11d15200f11030395c0a003103e5e034"
|
||||
"9011035758a65d0100e0c1";
|
||||
"0741020bf600f110000201030003e605"
|
||||
"f07000001000050215d011d15200f110"
|
||||
"30395c0a003103e5e0349011035758a6"
|
||||
"5d0100e0c1";
|
||||
|
||||
nas_message_t message;
|
||||
pkbuf_t *pkbuf;
|
||||
|
@ -21,7 +22,7 @@ static void nas_message_test1(abts_case *tc, void *data)
|
|||
|
||||
pkbuf = pkbuf_alloc(0, MESSAGE_SDU_SIZE);
|
||||
ABTS_PTR_NOTNULL(tc, pkbuf);
|
||||
pkbuf->len = 59;
|
||||
pkbuf->len = 53;
|
||||
core_ascii_to_hex(payload, strlen(payload), pkbuf->payload, pkbuf->len);
|
||||
|
||||
rv = nas_plain_decode(&message, pkbuf);
|
||||
|
|
Loading…
Reference in New Issue