le_iks_aesMilenage API Reference

Files

file  le_iks_aesMilenage_common.h
 
file  le_iks_aesMilenage_interface.h
 

Macros

#define LE_IKS_AESMILENAGE_K_SIZE   16
 
#define LE_IKS_AESMILENAGE_OPC_SIZE   16
 
#define LE_IKS_AESMILENAGE_OP_SIZE   16
 
#define LE_IKS_AESMILENAGE_RAND_SIZE   16
 
#define LE_IKS_AESMILENAGE_AMF_SIZE   2
 
#define LE_IKS_AESMILENAGE_SQN_SIZE   6
 
#define LE_IKS_AESMILENAGE_MACA_SIZE   8
 
#define LE_IKS_AESMILENAGE_MACS_SIZE   8
 
#define LE_IKS_AESMILENAGE_RES_SIZE   8
 
#define LE_IKS_AESMILENAGE_CK_SIZE   16
 
#define LE_IKS_AESMILENAGE_IK_SIZE   16
 
#define LE_IKS_AESMILENAGE_AK_SIZE   6
 

Typedefs

typedef void(* le_iks_aesMilenage_DisconnectHandler_t) (void *)
 

Functions

void le_iks_aesMilenage_ConnectService (void)
 
le_result_t le_iks_aesMilenage_TryConnectService (void)
 
LE_FULL_API void le_iks_aesMilenage_SetServerDisconnectHandler (le_iks_aesMilenage_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_iks_aesMilenage_DisconnectService (void)
 
le_result_t le_iks_aesMilenage_GetMacA (uint64_t kRef, uint64_t opcRef, const uint8_t *randPtr, size_t randSize, const uint8_t *amfPtr, size_t amfSize, const uint8_t *sqnPtr, size_t sqnSize, uint8_t *macaPtr, size_t *macaSizePtr)
 
le_result_t le_iks_aesMilenage_GetMacS (uint64_t kRef, uint64_t opcRef, const uint8_t *randPtr, size_t randSize, const uint8_t *amfPtr, size_t amfSize, const uint8_t *sqnPtr, size_t sqnSize, uint8_t *macsPtr, size_t *macsSizePtr)
 
le_result_t le_iks_aesMilenage_GetKeys (uint64_t kRef, uint64_t opcRef, const uint8_t *randPtr, size_t randSize, uint8_t *resPtr, size_t *resSizePtr, uint8_t *ckPtr, size_t *ckSizePtr, uint8_t *ikPtr, size_t *ikSizePtr, uint8_t *akPtr, size_t *akSizePtr)
 
le_result_t le_iks_aesMilenage_GetAk (uint64_t kRef, uint64_t opcRef, const uint8_t *randPtr, size_t randSize, uint8_t *akPtr, size_t *akSizePtr)
 
le_result_t le_iks_aesMilenage_DeriveOpc (uint64_t opRef, const uint8_t *kPtr, size_t kSize, uint8_t *opcPtr, size_t *opcSizePtr)
 

Detailed Description

Macro Definition Documentation

◆ LE_IKS_AESMILENAGE_K_SIZE

#define LE_IKS_AESMILENAGE_K_SIZE   16

Key size in bytes. This refers to the subscriber key, K.

◆ LE_IKS_AESMILENAGE_OP_SIZE

#define LE_IKS_AESMILENAGE_OP_SIZE   16

OP size in bytes.

◆ LE_IKS_AESMILENAGE_OPC_SIZE

#define LE_IKS_AESMILENAGE_OPC_SIZE   16

OPC size in bytes.

◆ LE_IKS_AESMILENAGE_RAND_SIZE

#define LE_IKS_AESMILENAGE_RAND_SIZE   16

Milenage parameter sizes in bytes.

Typedef Documentation

◆ le_iks_aesMilenage_DisconnectHandler_t

typedef void(* le_iks_aesMilenage_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

Function Documentation

◆ le_iks_aesMilenage_ConnectService()

void le_iks_aesMilenage_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client Specific Functions.

This function is created automatically.

◆ le_iks_aesMilenage_DeriveOpc()

le_result_t le_iks_aesMilenage_DeriveOpc ( uint64_t  opRef,
const uint8_t *  kPtr,
size_t  kSize,
uint8_t *  opcPtr,
size_t *  opcSizePtr 
)

Derive an OPc value from the specified K and the internal OP value.

Note
This function is generally not used in devices as most OPc values are derived in a factory or network setting.
Returns
LE_OK if successful. LE_BAD_PARAMETER if OP reference is invalid or if kPtr, opcPtr is NULL. LE_FAULT if there was an internal error.
Parameters
[in]opRefReference to OP key.
[in]kPtrK.
[in]kSize
[out]opcPtrBuffer to hold the OPc value.
[in,out]opcSizePtr

◆ le_iks_aesMilenage_DisconnectService()

void le_iks_aesMilenage_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client Specific Functions.

This function is created automatically.

◆ le_iks_aesMilenage_GetAk()

le_result_t le_iks_aesMilenage_GetAk ( uint64_t  kRef,
uint64_t  opcRef,
const uint8_t *  randPtr,
size_t  randSize,
uint8_t *  akPtr,
size_t *  akSizePtr 
)

Derives the anonymity key for the re-synchronisation message using the Milenage algorithm set with AES-128 as the block cipher. Implements the Milenage functions f5*.

Returns
LE_OK if successful. LE_BAD_PARAMETER if either K or OPc reference is invalid or if either K or OPc key type is invalid or if either randPtr or akPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if there was an internal error.
Parameters
[in]kRefReference to K.
[in]opcRefReference to OPc.
[in]randPtrRAND challenge. Assumed to be RAND_SIZE bytes.
[in]randSize
[out]akPtrBuffer to hold the anonymity key AK. Assumed to be AK_SIZE bytes.
[in,out]akSizePtr

◆ le_iks_aesMilenage_GetKeys()

le_result_t le_iks_aesMilenage_GetKeys ( uint64_t  kRef,
uint64_t  opcRef,
const uint8_t *  randPtr,
size_t  randSize,
uint8_t *  resPtr,
size_t *  resSizePtr,
uint8_t *  ckPtr,
size_t *  ckSizePtr,
uint8_t *  ikPtr,
size_t *  ikSizePtr,
uint8_t *  akPtr,
size_t *  akSizePtr 
)

Derives authentication response and keys using the Milenage algorithm set with AES-128 as the block cipher. Implements the Milenage functions f2, f3, f4, f5.

Returns
LE_OK if successful. LE_BAD_PARAMETER if either K or OPc reference is invalid or if either K or OPc key type is invalid or if either randPtr, resPtr, ckPtr, ikPtr or akPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if there was an internal error.
Parameters
[in]kRefReference to K.
[in]opcRefReference to OPc.
[in]randPtrRAND challenge. Assumed to be RAND_SIZE bytes.
[in]randSize
[out]resPtrBuffer to hold the authentication response RES. Assumed to be RES_SIZE bytes.
[in,out]resSizePtr
[out]ckPtrBuffer to hold the confidentiality key CK. Assumed to be CK_SIZE bytes.
[in,out]ckSizePtr
[out]ikPtrBuffer to hold the integrity key IK. Assumed to be IK_SIZE bytes.
[in,out]ikSizePtr
[out]akPtrBuffer to hold the anonymity key AK. Assumed to be AK_SIZE bytes.
[in,out]akSizePtr

◆ le_iks_aesMilenage_GetMacA()

le_result_t le_iks_aesMilenage_GetMacA ( uint64_t  kRef,
uint64_t  opcRef,
const uint8_t *  randPtr,
size_t  randSize,
const uint8_t *  amfPtr,
size_t  amfSize,
const uint8_t *  sqnPtr,
size_t  sqnSize,
uint8_t *  macaPtr,
size_t *  macaSizePtr 
)

Calculates the network authentication code MAC-A using the Milenage algorithm set with AES-128 as the block cipher. Implements the Milenage function f1.

Returns
LE_OK if successful. LE_BAD_PARAMETER if either K or OPc reference is invalid or if either K or OPc key type is invalid or if either randPtr, amfPtr, sqnPtr, or macaPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if there was an internal error.
Parameters
[in]kRefReference to K.
[in]opcRefReference to OPc.
[in]randPtrRAND challenge. Assumed to be RAND_SIZE bytes.
[in]randSize
[in]amfPtrAuthentication management field, AMF. Assumed to be AMF_SIZE bytes.
[in]amfSize
[in]sqnPtrSequence number, SQN. Assumed to be SQN_SIZE bytes.
[in]sqnSize
[out]macaPtrBuffer to hold the network authentication code. Assumed to be MACA_SIZE bytes.
[in,out]macaSizePtr

◆ le_iks_aesMilenage_GetMacS()

le_result_t le_iks_aesMilenage_GetMacS ( uint64_t  kRef,
uint64_t  opcRef,
const uint8_t *  randPtr,
size_t  randSize,
const uint8_t *  amfPtr,
size_t  amfSize,
const uint8_t *  sqnPtr,
size_t  sqnSize,
uint8_t *  macsPtr,
size_t *  macsSizePtr 
)

Calculates the re-synchronisation authentication code MAC-S using the Milenage algorithm set with AES-128 as the block cipher. Implements the Milenage function f1*.

Returns
LE_OK if successful. LE_BAD_PARAMETER if either K or OPc reference is invalid or if either K or OPc key type is invalid or if either randPtr, amfPtr, sqnPtr, or macsPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if there was an internal error.
Parameters
[in]kRefReference to K.
[in]opcRefReference to OPc.
[in]randPtrRAND challenge. Assumed to be RAND_SIZE bytes.
[in]randSize
[in]amfPtrAuthentication management field, AMF. Assumed to be AMF_SIZE bytes.
[in]amfSize
[in]sqnPtrSequence number, SQN. Assumed to be SQN_SIZE bytes.
[in]sqnSize
[out]macsPtrBuffer to hold the re-sync authentication code. Assumed to be MACS_SIZE bytes.
[in,out]macsSizePtr

◆ le_iks_aesMilenage_SetServerDisconnectHandler()

LE_FULL_API void le_iks_aesMilenage_SetServerDisconnectHandler ( le_iks_aesMilenage_DisconnectHandler_t  disconnectHandler,
void *  contextPtr 
)

Set handler called when server disconnection is detected.

When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.

◆ le_iks_aesMilenage_TryConnectService()

le_result_t le_iks_aesMilenage_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client Specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.