BSL v1.1.1 - 50.g42e5d9b
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
KeyStore.h File Reference

Declaration of functions to load and manipulate the Mock BPA key store separate from the API used by the crypto library. More...

#include <bsl/crypto/KeyStore.h>
#include <inttypes.h>
+ Include dependency graph for KeyStore.h:
+ This graph shows which files directly or indirectly include this file:

Functions

BSL_KeyStore_Descriptors_t MockBPA_KeyStore_Descriptors (void)
 Get key store descriptors for the process.
 
void MockBPA_KeyStore_Init (void)
 Initialize the key storage and register it with BSL_KeyStore_Init().
 
void MockBPA_KeyStore_Deinit (void)
 De-register with BSL_KeyStore_Deinit() and clear all key storage.
 
int MockBPA_KeyStore_RemoveKey (const BSL_Data_t *keyid)
 Erase key entry from crypto library registry, if present.
 
int MockBPA_KeyStore_AddKey (const BSL_Data_t *keyid, BSL_Crypto_KeyHandle_t handle)
 Add a new key to the crypto key registry.
 
BSL_Variant_t * MockBPA_KeyStore_SetKeyParameter (BSL_Crypto_KeyHandle_t handle, int64_t param_id)
 Add a context-specific parameter to a known key.
 

Detailed Description

Declaration of functions to load and manipulate the Mock BPA key store separate from the API used by the crypto library.

Function Documentation

◆ MockBPA_KeyStore_AddKey()

int MockBPA_KeyStore_AddKey ( const BSL_Data_t keyid,
BSL_Crypto_KeyHandle_t  handle 
)

Add a new key to the crypto key registry.

Parameters
[in]keyidkey ID that crypto functions will use to access key
[out]handleKey handle to add to the registry. Once the key is added it should be treated as read-only for thread-safety purposes. When handle is output, the handle must be released with BSL_Crypto_ReleaseKeyHandle() when it is done being used.
Returns
Zero upon success.

References ASSERT_ARG_NONNULL, CHK_ARG_NONNULL, keyid, StaticCryptoMutex, and StaticKeyRegistry.

Referenced by BSL_Crypto_AddRegistryKeyName(), MockBPA_KeyStore_Descriptors(), test_AppendixA_Example1_BIB_Source(), test_AppendixA_Example1_BIB_VerifyAccept(), test_AppendixA_Example4_BCB_Source(), test_AppendixA_Example4_BCB_VerifyAccept(), test_AppendixA_Example5_BCB_Source(), test_AppendixA_Example5_BCB_VerifyAccept(), test_AppendixA_Example6_BCB_Source(), test_CCSDS_Example_Mac_Source(), test_CCSDS_Example_Mac_VerifyAccept(), and test_key_stats().

◆ MockBPA_KeyStore_Deinit()

void MockBPA_KeyStore_Deinit ( void  )

De-register with BSL_KeyStore_Deinit() and clear all key storage.

References BSL_KeyStore_Deinit(), StaticCryptoMutex, and StaticKeyRegistry.

Referenced by _tearDown(), LLVMFuzzerTestOneInput(), main(), and tearDown().

◆ MockBPA_KeyStore_Descriptors()

◆ MockBPA_KeyStore_Init()

void MockBPA_KeyStore_Init ( void  )

Initialize the key storage and register it with BSL_KeyStore_Init().

References BSL_KeyStore_Init(), MockBPA_KeyStore_Descriptors(), StaticCryptoMutex, and StaticKeyRegistry.

Referenced by _setUp(), LLVMFuzzerTestOneInput(), main(), and setUp().

◆ MockBPA_KeyStore_RemoveKey()

int MockBPA_KeyStore_RemoveKey ( const BSL_Data_t keyid)

Erase key entry from crypto library registry, if present.

Parameters
[in]keyidkey ID of key to remove.
Returns
Zero if the key was present.

References ASSERT_ARG_NONNULL, BSL_SUCCESS, keyid, StaticCryptoMutex, and StaticKeyRegistry.

Referenced by MockBPA_KeyStore_RemoveKeyName().

◆ MockBPA_KeyStore_SetKeyParameter()

BSL_Variant_t * MockBPA_KeyStore_SetKeyParameter ( BSL_Crypto_KeyHandle_t  handle,
int64_t  param_id 
)

Add a context-specific parameter to a known key.

Parameters
[in]handleThe key ID to update.
[in]param_idThe parameter to access. If the parameter does not already exist it will be created.
Returns
Non-NULL pointer if successful.

References ASSERT_ARG_NONNULL, and BSL_CryptoKey_t::params.

Referenced by MockBPA_KeyStore_Descriptors(), test_AppendixA_Example1_BIB_Source(), test_AppendixA_Example1_BIB_VerifyAccept(), test_AppendixA_Example4_BCB_Source(), test_AppendixA_Example4_BCB_VerifyAccept(), test_AppendixA_Example5_BCB_Source(), test_AppendixA_Example5_BCB_VerifyAccept(), test_AppendixA_Example6_BCB_Source(), test_CCSDS_Example_Mac_Source(), and test_CCSDS_Example_Mac_VerifyAccept().