BSL v0.0.0
AMMOS Bundle Protocol Security Library (BSL)
|
Header for the implementation of an example default security context (RFC 9173). More...
#include <qcbor/qcbor_encode.h>
#include <qcbor/qcbor_spiffy_decode.h>
#include <stdio.h>
#include <sys/types.h>
#include <time.h>
#include <BPSecLib_Private.h>
#include <CryptoInterface.h>
#include "DefaultSecContext.h"
#include "DefaultSecContext_Private.h"
#include "rfc9173.h"
Go to the source code of this file.
Functions | |
bool | BSLX_BIB_Validate (BSL_LibCtx_t *lib, const BSL_BundleRef_t *bundle, const BSL_SecOper_t *sec_oper) |
bool | BSLX_BCB_Validate (BSL_LibCtx_t *lib, const BSL_BundleRef_t *bundle, const BSL_SecOper_t *sec_oper) |
size_t | BSLX_Bytestr_GetCapacity (void) |
BSL_Data_t | BSLX_Bytestr_AsData (BSLX_Bytestr_t *self) |
static ssize_t | map_rfc9173_sha_variant_to_crypto (size_t rfc9173_sha_variant) |
Provides the mapping from the security-context-specific ID defined in RFC9173 to the local ID of the SHA variant used by the crypto engine (OpenSSL). | |
int | BSLX_BIB_InitFromSecOper (BSLX_BIB_t *self, const BSL_SecOper_t *sec_oper) |
Populate the BIB parameters convenience struct from the security operation struct. | |
int | BSLX_BIB_GenIPPT (BSLX_BIB_t *self, BSL_Data_t ippt_space) |
Computes the Integrity-Protected Plaintext (IPPT) for a canonical bundle block (non-primary) | |
int | BSLX_BIB_GenHMAC (BSLX_BIB_t *self, BSL_Data_t ippt_data) |
Performs the actual HMAC over the given IPPT, placing the result in hmac_result . | |
int | BSLX_BIB_Execute (BSL_LibCtx_t *lib, const BSL_BundleRef_t *bundle, const BSL_SecOper_t *sec_oper, BSL_SecOutcome_t *sec_outcome) |
Header for the implementation of an example default security context (RFC 9173).
Note the prefix "xdefsc" means "Example Default Security Context".
Definition in file BIB_HMAC_SHA2.c.
bool BSLX_BCB_Validate | ( | BSL_LibCtx_t * | lib, |
const BSL_BundleRef_t * | bundle, | ||
const BSL_SecOper_t * | sec_oper | ||
) |
Definition at line 54 of file BIB_HMAC_SHA2.c.
int BSLX_BIB_Execute | ( | BSL_LibCtx_t * | lib, |
const BSL_BundleRef_t * | bundle, | ||
const BSL_SecOper_t * | sec_oper, | ||
BSL_SecOutcome_t * | sec_outcome | ||
) |
Definition at line 292 of file BIB_HMAC_SHA2.c.
int BSLX_BIB_GenHMAC | ( | BSLX_BIB_t * | self, |
BSL_Data_t | ippt_data | ||
) |
Performs the actual HMAC over the given IPPT, placing the result in hmac_result
.
Returns the number of bytes written into hmac_result. Negative indicates error. NOTE: This does NOT resize the result, the caller must do so.
Definition at line 251 of file BIB_HMAC_SHA2.c.
References BSL_AuthCtx_Deinit(), BSL_AuthCtx_DigestBuffer(), BSL_AuthCtx_Finalize(), BSL_AuthCtx_Init(), BSL_ERR_SECURITY_OPERATION_FAILED, BSL_LOG_ERR, BSL_Data_s::len, and BSL_Data_s::ptr.
int BSLX_BIB_GenIPPT | ( | BSLX_BIB_t * | self, |
BSL_Data_t | ippt_space | ||
) |
Computes the Integrity-Protected Plaintext (IPPT) for a canonical bundle block (non-primary)
Definition at line 188 of file BIB_HMAC_SHA2.c.
References BSL_CanonicalBlock_s::block_num, BSL_ERR_ENCODING, BSL_ERR_FAILURE, BSL_LOG_ERR, BSL_CanonicalBlock_s::btsd, BSL_CanonicalBlock_s::btsd_len, BSL_Data_s::len, and BSL_Data_s::ptr.
int BSLX_BIB_InitFromSecOper | ( | BSLX_BIB_t * | self, |
const BSL_SecOper_t * | sec_oper | ||
) |
Populate the BIB parameters convenience struct from the security operation struct.
TODO: move to common function.
Definition at line 107 of file BIB_HMAC_SHA2.c.
References BSL_ERR_PROPERTY_CHECK_FAILED, BSL_LOG_DEBUG, BSL_LOG_WARNING, BSL_SecOper_CountParams(), BSL_SecOper_GetParamAt(), BSL_SecParam_GetAsBytestr(), BSL_SecParam_GetAsUInt64(), BSL_SecParam_GetId(), BSL_SecParam_IsInt64(), BSL_SECPARAM_TYPE_INT_FIXED_KEY, BSL_SECPARAM_TYPE_INT_KEY_ID, BSL_SUCCESS, BSL_Data_s::len, and map_rfc9173_sha_variant_to_crypto().
bool BSLX_BIB_Validate | ( | BSL_LibCtx_t * | lib, |
const BSL_BundleRef_t * | bundle, | ||
const BSL_SecOper_t * | sec_oper | ||
) |
Definition at line 42 of file BIB_HMAC_SHA2.c.
BSL_Data_t BSLX_Bytestr_AsData | ( | BSLX_Bytestr_t * | self | ) |
Definition at line 68 of file BIB_HMAC_SHA2.c.
size_t BSLX_Bytestr_GetCapacity | ( | void | ) |
Definition at line 63 of file BIB_HMAC_SHA2.c.
|
static |
Provides the mapping from the security-context-specific ID defined in RFC9173 to the local ID of the SHA variant used by the crypto engine (OpenSSL).
Definition at line 78 of file BIB_HMAC_SHA2.c.
References BSL_ERR_PROPERTY_CHECK_FAILED, BSL_LOG_DEBUG, and BSL_LOG_ERR.
Referenced by BSLX_BIB_InitFromSecOper().