le_iks_hmac API Reference

Files

file  le_iks_hmac_common.h
 
file  le_iks_hmac_interface.h
 

Macros

#define LE_IKS_HMAC_MAX_TAG_SIZE   64
 

Typedefs

typedef void(* le_iks_hmac_DisconnectHandler_t) (void *)
 

Functions

void le_iks_hmac_ConnectService (void)
 
le_result_t le_iks_hmac_TryConnectService (void)
 
LE_FULL_API void le_iks_hmac_SetServerDisconnectHandler (le_iks_hmac_DisconnectHandler_t disconnectHandler, void *contextPtr)
 
void le_iks_hmac_DisconnectService (void)
 
le_result_t le_iks_hmac_ProcessChunk (uint64_t session, const uint8_t *msgChunkPtr, size_t msgChunkSize)
 
le_result_t le_iks_hmac_Done (uint64_t session, uint8_t *tagBufPtr, size_t *tagBufSizePtr)
 
le_result_t le_iks_hmac_Verify (uint64_t session, const uint8_t *tagBufPtr, size_t tagBufSize)
 

Detailed Description

Macro Definition Documentation

◆ LE_IKS_HMAC_MAX_TAG_SIZE

#define LE_IKS_HMAC_MAX_TAG_SIZE   64

Maximum tag sizes in bytes.

Typedef Documentation

◆ le_iks_hmac_DisconnectHandler_t

typedef void(* le_iks_hmac_DisconnectHandler_t) (void *)

Type for handler called when a server disconnects.

Function Documentation

◆ le_iks_hmac_ConnectService()

void le_iks_hmac_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_hmac_DisconnectService()

void le_iks_hmac_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_hmac_Done()

le_result_t le_iks_hmac_Done ( uint64_t  session,
uint8_t *  tagBufPtr,
size_t *  tagBufSizePtr 
)

Complete message processing and get the processed message's authentication tag.

The maximum size of the authentication tag is the size of the output of the underlying hash function. For example, if the key is of type KEY_TYPE_HMAC_SHA256 then the maximum tag size is 32 bytes.

If the supplied buffer is larger than or equal to the maximum authentication tag size then the full authentication tag is copied to the buffer and the rest of the buffer is left unmodified.

If the supplied buffer is smaller than the maximum tag size then the tag will be truncated. However, all tags produced using the same key must use the same tag size. It is up to the caller to ensure this.

Returns
LE_OK if successful. LE_BAD_PARAMETER if the session reference is invalid or if the key type is invalid or if bufPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if no message was processed or le_iks_hmac_Done() or le_iks_hmac_Verify() has already been called, or if there was an internal error.
Parameters
[in]sessionSession reference.
[out]tagBufPtrBuffer to hold the authentication tag.
[in,out]tagBufSizePtr

◆ le_iks_hmac_ProcessChunk()

le_result_t le_iks_hmac_ProcessChunk ( uint64_t  session,
const uint8_t *  msgChunkPtr,
size_t  msgChunkSize 
)

Process message chunks. This function may be called multiple times to process the entire message but once a message has been completely processed and le_iks_hmac_Done() or le_iks_hmac_Verify() has been called this function should not be called again with the same session.

Returns
LE_OK if successful. LE_BAD_PARAMETER if the session reference is invalid or if the key type is invalid or if msgChunkPtr is NULL. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if no more messages can be processed, ie. le_iks_hmac_Done() or le_iks_hmac_Verify() has already been called, or if there was an internal error.
Parameters
[in]sessionSession reference.
[in]msgChunkPtrMessage chunk.
[in]msgChunkSize

◆ le_iks_hmac_SetServerDisconnectHandler()

LE_FULL_API void le_iks_hmac_SetServerDisconnectHandler ( le_iks_hmac_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_hmac_TryConnectService()

le_result_t le_iks_hmac_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.

◆ le_iks_hmac_Verify()

le_result_t le_iks_hmac_Verify ( uint64_t  session,
const uint8_t *  tagBufPtr,
size_t  tagBufSize 
)

Complete message processing and compare the resulting authentication tag with the supplied tag.

The maximum size of the authentication tag is the size of the output of the underlying hash function. For example, if the key is of type KEY_TYPE_HMAC_SHA256 then the maximum tag size is 32 bytes.

If the supplied tag is larger than or equal to the maximum authentication tag size then the authentication will fail.

If the supplied tag is smaller than the maximum tag size then only the first tagSize bytes will be compared.

All tags produced using the same key must use the same tag size. It is up to the caller to ensure this.

Returns
LE_OK if the specified tag matches the calculated message tag. LE_BAD_PARAMETER if the session reference is invalid or if the key type is invalid or if tagPtr is NULL or tagSize is zero. LE_UNSUPPORTED if underlying resource does not support this operation. LE_FAULT if the specified tag does not match the calculated message tag, or if no message was processed or le_iks_hmac_Done() or or le_iks_hmac_Verify() has already been called, or if there was an internal error.
Parameters
[in]sessionSession reference.
[in]tagBufPtrAuthentication tag to check against.
[in]tagBufSize