mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 11:44:30 +01:00
Create a 'flags' field in cipher_info
This commit is contained in:
parent
0c1ec479fe
commit
81754a0c35
@ -61,6 +61,9 @@
|
|||||||
#define POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED -0x6280 /**< Decryption of block requires a full block. */
|
#define POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED -0x6280 /**< Decryption of block requires a full block. */
|
||||||
#define POLARSSL_ERR_CIPHER_AUTH_FAILED -0x6300 /**< Authentication failed (for AEAD modes). */
|
#define POLARSSL_ERR_CIPHER_AUTH_FAILED -0x6300 /**< Authentication failed (for AEAD modes). */
|
||||||
|
|
||||||
|
#define POLARSSL_CIPHER_VARIABLE_IV_LEN 0x01 /**< Cipher accepts IVs of variable length */
|
||||||
|
#define POLARSSL_CIPHER_VARIABLE_KEY_LEN 0x02 /**< Cipher accepts keys of variable length */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -238,8 +241,8 @@ typedef struct {
|
|||||||
* For cipher that accept many sizes: recommended size */
|
* For cipher that accept many sizes: recommended size */
|
||||||
unsigned int iv_size;
|
unsigned int iv_size;
|
||||||
|
|
||||||
/** Flag for ciphers that accept many sizes of IV/NONCE */
|
/** Flags for variable IV size, variable key size, etc. */
|
||||||
int accepts_variable_iv_size;
|
int flags;
|
||||||
|
|
||||||
/** block size, in bytes */
|
/** block size, in bytes */
|
||||||
unsigned int block_size;
|
unsigned int block_size;
|
||||||
|
@ -204,7 +204,7 @@ int cipher_set_iv( cipher_context_t *ctx,
|
|||||||
if( iv_len > POLARSSL_MAX_IV_LENGTH )
|
if( iv_len > POLARSSL_MAX_IV_LENGTH )
|
||||||
return( POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
return( POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
||||||
|
|
||||||
if( ctx->cipher_info->accepts_variable_iv_size )
|
if( ( ctx->cipher_info->flags & POLARSSL_CIPHER_VARIABLE_IV_LEN ) != 0 )
|
||||||
actual_iv_size = iv_len;
|
actual_iv_size = iv_len;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -374,7 +374,7 @@ const cipher_info_t aes_128_gcm_info = {
|
|||||||
128,
|
128,
|
||||||
"AES-128-GCM",
|
"AES-128-GCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&gcm_aes_info
|
&gcm_aes_info
|
||||||
};
|
};
|
||||||
@ -385,7 +385,7 @@ const cipher_info_t aes_192_gcm_info = {
|
|||||||
192,
|
192,
|
||||||
"AES-192-GCM",
|
"AES-192-GCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&gcm_aes_info
|
&gcm_aes_info
|
||||||
};
|
};
|
||||||
@ -396,7 +396,7 @@ const cipher_info_t aes_256_gcm_info = {
|
|||||||
256,
|
256,
|
||||||
"AES-256-GCM",
|
"AES-256-GCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&gcm_aes_info
|
&gcm_aes_info
|
||||||
};
|
};
|
||||||
@ -429,7 +429,7 @@ const cipher_info_t aes_128_ccm_info = {
|
|||||||
128,
|
128,
|
||||||
"AES-128-CCM",
|
"AES-128-CCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&ccm_aes_info
|
&ccm_aes_info
|
||||||
};
|
};
|
||||||
@ -440,7 +440,7 @@ const cipher_info_t aes_192_ccm_info = {
|
|||||||
192,
|
192,
|
||||||
"AES-192-CCM",
|
"AES-192-CCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&ccm_aes_info
|
&ccm_aes_info
|
||||||
};
|
};
|
||||||
@ -451,7 +451,7 @@ const cipher_info_t aes_256_ccm_info = {
|
|||||||
256,
|
256,
|
||||||
"AES-256-CCM",
|
"AES-256-CCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&ccm_aes_info
|
&ccm_aes_info
|
||||||
};
|
};
|
||||||
@ -728,7 +728,7 @@ const cipher_info_t camellia_128_gcm_info = {
|
|||||||
128,
|
128,
|
||||||
"CAMELLIA-128-GCM",
|
"CAMELLIA-128-GCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&gcm_camellia_info
|
&gcm_camellia_info
|
||||||
};
|
};
|
||||||
@ -739,7 +739,7 @@ const cipher_info_t camellia_192_gcm_info = {
|
|||||||
192,
|
192,
|
||||||
"CAMELLIA-192-GCM",
|
"CAMELLIA-192-GCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&gcm_camellia_info
|
&gcm_camellia_info
|
||||||
};
|
};
|
||||||
@ -750,7 +750,7 @@ const cipher_info_t camellia_256_gcm_info = {
|
|||||||
256,
|
256,
|
||||||
"CAMELLIA-256-GCM",
|
"CAMELLIA-256-GCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&gcm_camellia_info
|
&gcm_camellia_info
|
||||||
};
|
};
|
||||||
@ -783,7 +783,7 @@ const cipher_info_t camellia_128_ccm_info = {
|
|||||||
128,
|
128,
|
||||||
"CAMELLIA-128-CCM",
|
"CAMELLIA-128-CCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&ccm_camellia_info
|
&ccm_camellia_info
|
||||||
};
|
};
|
||||||
@ -794,7 +794,7 @@ const cipher_info_t camellia_192_ccm_info = {
|
|||||||
192,
|
192,
|
||||||
"CAMELLIA-192-CCM",
|
"CAMELLIA-192-CCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&ccm_camellia_info
|
&ccm_camellia_info
|
||||||
};
|
};
|
||||||
@ -805,7 +805,7 @@ const cipher_info_t camellia_256_ccm_info = {
|
|||||||
256,
|
256,
|
||||||
"CAMELLIA-256-CCM",
|
"CAMELLIA-256-CCM",
|
||||||
12,
|
12,
|
||||||
1,
|
POLARSSL_CIPHER_VARIABLE_IV_LEN,
|
||||||
16,
|
16,
|
||||||
&ccm_camellia_info
|
&ccm_camellia_info
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user