Allow checking variable IV/key size in cipher_info
Signed-off-by: Max Fillinger <max@max-fillinger.net>
This commit is contained in:
parent
3a782a0fe4
commit
f057893035
1 changed files with 36 additions and 0 deletions
|
@ -542,6 +542,42 @@ static inline unsigned int mbedtls_cipher_info_get_block_size(
|
||||||
return( info->MBEDTLS_PRIVATE(block_size) );
|
return( info->MBEDTLS_PRIVATE(block_size) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief This function returns a non-zero value if the key length for
|
||||||
|
* the given cipher is variable.
|
||||||
|
*
|
||||||
|
* \param info The cipher info structure. This may be \c NULL.
|
||||||
|
*
|
||||||
|
* \return Non-zero if the key length is variable, \c 0 otherwise.
|
||||||
|
* \return \c 0 if the given pointer is \c NULL.
|
||||||
|
*/
|
||||||
|
static inline int mbedtls_cipher_info_has_variable_key_bitlen(
|
||||||
|
const mbedtls_cipher_info_t *info )
|
||||||
|
{
|
||||||
|
if( info == NULL )
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
return( info->MBEDTLS_PRIVATE(flags) & MBEDTLS_CIPHER_VARIABLE_KEY_LEN );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief This function returns a non-zero value if the IV size for
|
||||||
|
* the given cipher is variable.
|
||||||
|
*
|
||||||
|
* \param info The cipher info structure. This may be \c NULL.
|
||||||
|
*
|
||||||
|
* \return Non-zero if the IV size is variable, \c 0 otherwise.
|
||||||
|
* \return \c 0 if the given pointer is \c NULL.
|
||||||
|
*/
|
||||||
|
static inline int mbedtls_cipher_info_has_variable_iv_size(
|
||||||
|
const mbedtls_cipher_info_t *info )
|
||||||
|
{
|
||||||
|
if( info == NULL )
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
|
return( info->MBEDTLS_PRIVATE(flags) & MBEDTLS_CIPHER_VARIABLE_IV_LEN );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes a \p cipher_context as NONE.
|
* \brief This function initializes a \p cipher_context as NONE.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue