security

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 37

Documentation

Index

Constants

View Source
const (
	NNASEncAlg uint8 = 0x01
	NNASIntAlg uint8 = 0x02
	NRRCEncAlg uint8 = 0x03
	NRRCIntAlg uint8 = 0x04
	NUpEncAlg  uint8 = 0x05
	NUpIntAlg  uint8 = 0x06
)

TS 33.501 Annex A.8 Algorithm distinguisher For Knas_int Knas_enc

View Source
const (
	AlgIntegrity128NIA0 uint8 = 0x00 // NULL
	AlgIntegrity128NIA1 uint8 = 0x01 // 128-Snow3G
	AlgIntegrity128NIA2 uint8 = 0x02 // 128-AES
	AlgIntegrity128NIA3 uint8 = 0x03 // 128-ZUC
)

TS 33.501 5.11.1.1 Algorithm identifier values For integrity algorithm

View Source
const (
	AlgCiphering128NEA0 uint8 = 0x00 // NULL
	AlgCiphering128NEA1 uint8 = 0x01 // 128-Snow3G
	AlgCiphering128NEA2 uint8 = 0x02 // 128-AES
	AlgCiphering128NEA3 uint8 = 0x03 // 128-ZUC
)

TS 33.501 5.11.1.1 Algorithm identifier values For ciphering algorithm

View Source
const (
	DirectionUplink   uint8 = 0x00
	DirectionDownlink uint8 = 0x01
)

1bit

View Source
const (
	OnlyOneBearer uint8 = 0x00
	Bearer3GPP    uint8 = 0x01
	BearerNon3GPP uint8 = 0x02
)

5bits

View Source
const (
	AccessType3GPP    uint8 = 0x01
	AccessTypeNon3GPP uint8 = 0x02
)

TS 33501 Annex A.0 Access type distinguisher For Kgnb Kn3iwf

Variables

This section is empty.

Functions

func NASEncrypt

func NASEncrypt(AlgoID uint8, KnasEnc [16]byte, Count uint32, Bearer uint8,
	Direction uint8, payload []byte,
) error

func NASMacCalculate

func NASMacCalculate(AlgoID uint8, KnasInt [16]uint8, Count uint32,
	Bearer uint8, Direction uint8, msg []byte,
) ([]byte, error)

func NEA1

func NEA1(ck [16]byte, countC, bearer, direction uint32, ibs []byte, length uint32) (obs []byte, err error)

func NEA2

func NEA2(key [16]byte, count uint32, bearer uint8, direction uint8,
	ibs []byte,
) (obs []byte, err error)

ibs: input bit stream, obs: output bit stream

func NEA3

func NEA3(ck [16]byte, count uint32, bearer uint8, direction uint8,
	ibs []byte, length uint32,
) (obs []byte, err error)

NEA3 ibs: input bit stream, obs: output bit stream ref: https://www.gsma.com/security/wp-content/uploads/2019/05/EEA3_EIA3_specification_v1_8.pdf

func NIA1

func NIA1(ik [16]byte, countI uint32, bearer byte, direction uint32, msg []byte, length uint64) (
	mac []byte, err error,
)

func NIA2

func NIA2(key [16]byte, count uint32, bearer uint8, direction uint8, msg []byte) (mac []byte, err error)

func NIA3

func NIA3(ik [16]byte, count uint32, bearer uint8, direction uint8,
	msg []byte, length uint32,
) (mac []byte, err error)

NIA3 ibs: input bit stream, obs: output bit stream (mac) ref: https://www.gsma.com/security/wp-content/uploads/2019/05/EEA3_EIA3_specification_v1_8.pdf

Types

type Count

type Count struct {
	// contains filtered or unexported fields
}

TS 33.501 6.4.3.1

COUNT (32 bits) := 0x00 || NAS COUNT (24 bits)
NAS COUNT (24 bits) := NAS OVERFLOW (16 bits) || NAS SQN (8 bits)

func (*Count) AddOne

func (counter *Count) AddOne()

func (*Count) Get

func (counter *Count) Get() uint32

func (*Count) Overflow

func (counter *Count) Overflow() uint16

func (*Count) SQN

func (counter *Count) SQN() uint8

func (*Count) Set

func (counter *Count) Set(overflow uint16, sqn uint8)

func (*Count) SetOverflow

func (counter *Count) SetOverflow(overflow uint16)

func (*Count) SetSQN

func (counter *Count) SetSQN(sqn uint8)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL