mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Wrap long lines
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
@@ -66,7 +66,8 @@ int main( void )
|
|||||||
|
|
||||||
/* The real program starts here. */
|
/* The real program starts here. */
|
||||||
|
|
||||||
const char usage[] = "Usage: cipher_aead_demo [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
|
const char usage[] =
|
||||||
|
"Usage: cipher_aead_demo [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
|
||||||
|
|
||||||
/* Dummy data for encryption: IV/nonce, additional data, 2-part message */
|
/* Dummy data for encryption: IV/nonce, additional data, 2-part message */
|
||||||
const unsigned char iv1[12] = { 0x00 };
|
const unsigned char iv1[12] = { 0x00 };
|
||||||
@@ -175,7 +176,8 @@ static void aead_info( const mbedtls_cipher_context_t *ctx, size_t tag_len )
|
|||||||
: mode == MBEDTLS_MODE_CHACHAPOLY ? "ChachaPoly"
|
: mode == MBEDTLS_MODE_CHACHAPOLY ? "ChachaPoly"
|
||||||
: "???";
|
: "???";
|
||||||
|
|
||||||
printf( "cipher: %s, %d, %s, %u\n", ciph, key_bits, mode_str, (unsigned) tag_len );
|
printf( "cipher: %s, %d, %s, %u\n",
|
||||||
|
ciph, key_bits, mode_str, (unsigned) tag_len );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
* This program AEAD-encrypts a message, using the algorithm and key size
|
* This program AEAD-encrypts a message, using the algorithm and key size
|
||||||
* specified on the command line, using the multi-part API.
|
* specified on the command line, using the multi-part API.
|
||||||
*
|
*
|
||||||
* It comes with a companion program cipher/cipher_aead_demo.c, which does the same
|
* It comes with a companion program cipher/cipher_aead_demo.c, which does the
|
||||||
* operations with the legacy Cipher API. The goal is that comparing the two
|
* same operations with the legacy Cipher API. The goal is that comparing the
|
||||||
* programs will help people migrating to the PSA Crypto API.
|
* two programs will help people migrating to the PSA Crypto API.
|
||||||
*
|
*
|
||||||
* When used with multi-part AEAD operations, the `mbedtls_cipher_context`
|
* When used with multi-part AEAD operations, the `mbedtls_cipher_context`
|
||||||
* serves a triple purpose (1) hold the key, (2) store the algorithm when no
|
* serves a triple purpose (1) hold the key, (2) store the algorithm when no
|
||||||
@@ -18,9 +18,10 @@
|
|||||||
* On the other hand, with PSA, the algorithms encodes the desired tag length;
|
* On the other hand, with PSA, the algorithms encodes the desired tag length;
|
||||||
* with Cipher the desired tag length needs to be tracked separately.
|
* with Cipher the desired tag length needs to be tracked separately.
|
||||||
*
|
*
|
||||||
* This program and its companion cipher/cipher_aead_demo.c illustrate this by doing the
|
* This program and its companion cipher/cipher_aead_demo.c illustrate this by
|
||||||
* same sequence of multi-part AEAD computation with both APIs; looking at the
|
* doing the same sequence of multi-part AEAD computation with both APIs;
|
||||||
* two side by side should make the differences and similarities clear.
|
* looking at the two side by side should make the differences and
|
||||||
|
* similarities clear.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -68,7 +69,8 @@ int main( void )
|
|||||||
|
|
||||||
/* The real program starts here. */
|
/* The real program starts here. */
|
||||||
|
|
||||||
const char usage[] = "Usage: aead_demo [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
|
const char usage[] =
|
||||||
|
"Usage: aead_demo [aes128-gcm|aes256-gcm|aes128-gcm_8|chachapoly]";
|
||||||
|
|
||||||
/* Dummy data for encryption: IV/nonce, additional data, 2-part message */
|
/* Dummy data for encryption: IV/nonce, additional data, 2-part message */
|
||||||
const unsigned char iv1[12] = { 0x00 };
|
const unsigned char iv1[12] = { 0x00 };
|
||||||
|
@@ -13,9 +13,9 @@
|
|||||||
* objects: (1) a psa_key_id_t to hold the key, and (2) a psa_operation_t for
|
* objects: (1) a psa_key_id_t to hold the key, and (2) a psa_operation_t for
|
||||||
* multi-part progress.
|
* multi-part progress.
|
||||||
*
|
*
|
||||||
* This program and its companion hash/md_hmac_demo.c illustrate this by doing the
|
* This program and its companion hash/md_hmac_demo.c illustrate this by doing
|
||||||
* same sequence of multi-part HMAC computation with both APIs; looking at the
|
* the same sequence of multi-part HMAC computation with both APIs; looking at
|
||||||
* two side by side should make the differences and similarities clear.
|
* the two side by side should make the differences and similarities clear.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -118,7 +118,8 @@ psa_status_t hmac_demo(void)
|
|||||||
psa_set_key_type( &attributes, PSA_KEY_TYPE_HMAC );
|
psa_set_key_type( &attributes, PSA_KEY_TYPE_HMAC );
|
||||||
psa_set_key_bits( &attributes, 8 * sizeof( key_bytes ) ); // optional
|
psa_set_key_bits( &attributes, 8 * sizeof( key_bytes ) ); // optional
|
||||||
|
|
||||||
status = psa_import_key( &attributes, key_bytes, sizeof( key_bytes ), &key );
|
status = psa_import_key( &attributes,
|
||||||
|
key_bytes, sizeof( key_bytes ), &key );
|
||||||
if( status != PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
return( status );
|
return( status );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user