open5gs/src/mme/nas-security.h

52 lines
1.3 KiB
C
Raw Normal View History

2017-03-08 06:27:48 +00:00
#ifndef __NAS_SECURITY_H__
#define __NAS_SECURITY_H__
2019-04-27 14:54:30 +00:00
#include "ogs-crypt.h"
2017-03-08 06:27:48 +00:00
2019-06-11 13:10:47 +00:00
#include "mme-context.h"
#include "snow-3g.h"
2017-03-08 06:27:48 +00:00
#include "zuc.h"
2017-03-08 10:10:01 +00:00
#define NAS_SECURITY_BEARER 0
#define NAS_SECURITY_DOWNLINK_DIRECTION 1
#define NAS_SECURITY_UPLINK_DIRECTION 0
2017-03-08 13:39:28 +00:00
#define NAS_SECURITY_MAC_SIZE 4
2017-03-08 06:27:48 +00:00
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
2017-07-28 14:07:57 +00:00
typedef struct _nas_security_header_type_t {
union {
struct {
2019-04-27 14:54:30 +00:00
ED5(uint8_t integrity_protected:1;,
uint8_t ciphered:1;,
uint8_t new_security_context:1;,
uint8_t service_request:1;,
uint8_t reserved:4;)
};
2019-04-27 14:54:30 +00:00
uint8_t type;
};
2017-07-28 14:07:57 +00:00
} __attribute__ ((packed)) nas_security_header_type_t;
2019-04-27 14:54:30 +00:00
int nas_security_encode(
ogs_pkbuf_t **pkbuf, mme_ue_t *mme_ue, nas_message_t *message);
int nas_security_decode(mme_ue_t *mme_ue,
nas_security_header_type_t security_header_type, ogs_pkbuf_t *pkbuf);
2017-03-08 10:10:01 +00:00
2019-04-27 14:54:30 +00:00
void nas_mac_calculate(uint8_t algorithm_identity,
uint8_t *knas_int, uint32_t count, uint8_t bearer,
uint8_t direction, ogs_pkbuf_t *pkbuf, uint8_t *mac);
2017-03-08 06:27:48 +00:00
2019-04-27 14:54:30 +00:00
void nas_encrypt(uint8_t algorithm_identity,
uint8_t *knas_enc, uint32_t count, uint8_t bearer,
uint8_t direction, ogs_pkbuf_t *pkbuf);
2017-03-08 06:27:48 +00:00
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __NAS_SECURITY_H__ */