Skip to content

Commit c8b699d

Browse files
author
Hanno Becker
committed
Fix style in cipher.h
1 parent 0953ba1 commit c8b699d

File tree

1 file changed

+82
-69
lines changed

1 file changed

+82
-69
lines changed

include/mbedtls/cipher.h

Lines changed: 82 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx );
405405
* In future versions, the caller will be required to call
406406
* mbedtls_cipher_init() on the structure first.
407407
*/
408-
int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info );
408+
int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx,
409+
const mbedtls_cipher_info_t *cipher_info );
409410

410411
/**
411412
* \brief This function returns the block size of the given cipher.
@@ -415,7 +416,8 @@ int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_in
415416
* \return The size of the blocks of the cipher.
416417
* \return 0 if \p ctx has not been initialized.
417418
*/
418-
static inline unsigned int mbedtls_cipher_get_block_size( const mbedtls_cipher_context_t *ctx )
419+
static inline unsigned int mbedtls_cipher_get_block_size(
420+
const mbedtls_cipher_context_t *ctx )
419421
{
420422
if( NULL == ctx || NULL == ctx->cipher_info )
421423
return 0;
@@ -432,7 +434,8 @@ static inline unsigned int mbedtls_cipher_get_block_size( const mbedtls_cipher_c
432434
* \return The mode of operation.
433435
* \return #MBEDTLS_MODE_NONE if \p ctx has not been initialized.
434436
*/
435-
static inline mbedtls_cipher_mode_t mbedtls_cipher_get_cipher_mode( const mbedtls_cipher_context_t *ctx )
437+
static inline mbedtls_cipher_mode_t mbedtls_cipher_get_cipher_mode(
438+
const mbedtls_cipher_context_t *ctx )
436439
{
437440
if( NULL == ctx || NULL == ctx->cipher_info )
438441
return MBEDTLS_MODE_NONE;
@@ -450,7 +453,8 @@ static inline mbedtls_cipher_mode_t mbedtls_cipher_get_cipher_mode( const mbedtl
450453
* \return \c 0 for ciphers not using an IV or a nonce.
451454
* \return The actual size if an IV has been set.
452455
*/
453-
static inline int mbedtls_cipher_get_iv_size( const mbedtls_cipher_context_t *ctx )
456+
static inline int mbedtls_cipher_get_iv_size(
457+
const mbedtls_cipher_context_t *ctx )
454458
{
455459
if( NULL == ctx || NULL == ctx->cipher_info )
456460
return 0;
@@ -469,7 +473,8 @@ static inline int mbedtls_cipher_get_iv_size( const mbedtls_cipher_context_t *ct
469473
* \return The type of the cipher.
470474
* \return #MBEDTLS_CIPHER_NONE if \p ctx has not been initialized.
471475
*/
472-
static inline mbedtls_cipher_type_t mbedtls_cipher_get_type( const mbedtls_cipher_context_t *ctx )
476+
static inline mbedtls_cipher_type_t mbedtls_cipher_get_type(
477+
const mbedtls_cipher_context_t *ctx )
473478
{
474479
if( NULL == ctx || NULL == ctx->cipher_info )
475480
return MBEDTLS_CIPHER_NONE;
@@ -486,7 +491,8 @@ static inline mbedtls_cipher_type_t mbedtls_cipher_get_type( const mbedtls_ciphe
486491
* \return The name of the cipher.
487492
* \return NULL if \p ctx has not been not initialized.
488493
*/
489-
static inline const char *mbedtls_cipher_get_name( const mbedtls_cipher_context_t *ctx )
494+
static inline const char *mbedtls_cipher_get_name(
495+
const mbedtls_cipher_context_t *ctx )
490496
{
491497
if( NULL == ctx || NULL == ctx->cipher_info )
492498
return 0;
@@ -503,7 +509,8 @@ static inline const char *mbedtls_cipher_get_name( const mbedtls_cipher_context_
503509
* \return #MBEDTLS_KEY_LENGTH_NONE if ctx \p has not been
504510
* initialized.
505511
*/
506-
static inline int mbedtls_cipher_get_key_bitlen( const mbedtls_cipher_context_t *ctx )
512+
static inline int mbedtls_cipher_get_key_bitlen(
513+
const mbedtls_cipher_context_t *ctx )
507514
{
508515
if( NULL == ctx || NULL == ctx->cipher_info )
509516
return MBEDTLS_KEY_LENGTH_NONE;
@@ -519,7 +526,8 @@ static inline int mbedtls_cipher_get_key_bitlen( const mbedtls_cipher_context_t
519526
* \return The type of operation: #MBEDTLS_ENCRYPT or #MBEDTLS_DECRYPT.
520527
* \return #MBEDTLS_OPERATION_NONE if \p ctx has not been initialized.
521528
*/
522-
static inline mbedtls_operation_t mbedtls_cipher_get_operation( const mbedtls_cipher_context_t *ctx )
529+
static inline mbedtls_operation_t mbedtls_cipher_get_operation(
530+
const mbedtls_cipher_context_t *ctx )
523531
{
524532
if( NULL == ctx || NULL == ctx->cipher_info )
525533
return MBEDTLS_OPERATION_NONE;
@@ -543,8 +551,10 @@ static inline mbedtls_operation_t mbedtls_cipher_get_operation( const mbedtls_ci
543551
* parameter-verification failure.
544552
* \return A cipher-specific error code on failure.
545553
*/
546-
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *key,
547-
int key_bitlen, const mbedtls_operation_t operation );
554+
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,
555+
const unsigned char *key,
556+
int key_bitlen,
557+
const mbedtls_operation_t operation );
548558

549559
#if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
550560
/**
@@ -562,7 +572,8 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *k
562572
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA if the cipher mode
563573
* does not support padding.
564574
*/
565-
int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx, mbedtls_cipher_padding_t mode );
575+
int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx,
576+
mbedtls_cipher_padding_t mode );
566577
#endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */
567578

568579
/**
@@ -582,7 +593,7 @@ int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx, mbedtls_ciph
582593
* parameter-verification failure.
583594
*/
584595
int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx,
585-
const unsigned char *iv, size_t iv_len );
596+
const unsigned char *iv, size_t iv_len );
586597

587598
/**
588599
* \brief This function resets the cipher state.
@@ -597,16 +608,16 @@ int mbedtls_cipher_reset( mbedtls_cipher_context_t *ctx );
597608

598609
#if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C)
599610
/**
600-
* \brief This function adds additional data for AEAD ciphers.
601-
* Currently supported with GCM and ChaCha20+Poly1305.
602-
* Must be called exactly once, after mbedtls_cipher_reset().
611+
* \brief This function adds additional data for AEAD ciphers.
612+
* Currently supported with GCM and ChaCha20+Poly1305.
613+
* Must be called exactly once, after mbedtls_cipher_reset().
603614
*
604-
* \param ctx The generic cipher context.
605-
* \param ad The additional data to use.
606-
* \param ad_len the Length of \p ad.
615+
* \param ctx The generic cipher context.
616+
* \param ad The additional data to use.
617+
* \param ad_len the Length of \p ad.
607618
*
608-
* \return \c 0 on success.
609-
* \return A specific error code on failure.
619+
* \return \c 0 on success.
620+
* \return A specific error code on failure.
610621
*/
611622
int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
612623
const unsigned char *ad, size_t ad_len );
@@ -643,8 +654,10 @@ int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
643654
* unsupported mode for a cipher.
644655
* \return A cipher-specific error code on failure.
645656
*/
646-
int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned char *input,
647-
size_t ilen, unsigned char *output, size_t *olen );
657+
int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx,
658+
const unsigned char *input,
659+
size_t ilen, unsigned char *output,
660+
size_t *olen );
648661

649662
/**
650663
* \brief The generic cipher finalization function. If data still
@@ -736,27 +749,27 @@ int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
736749

737750
#if defined(MBEDTLS_CIPHER_MODE_AEAD)
738751
/**
739-
* \brief The generic autenticated encryption (AEAD) function.
740-
*
741-
* \param ctx The generic cipher context.
742-
* \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers.
743-
* \param iv_len The IV length for ciphers with variable-size IV.
744-
* This parameter is discarded by ciphers with fixed-size IV.
745-
* \param ad The additional data to authenticate.
746-
* \param ad_len The length of \p ad.
747-
* \param input The buffer holding the input data.
748-
* \param ilen The length of the input data.
749-
* \param output The buffer for the output data.
750-
* Must be able to hold at least \p ilen.
751-
* \param olen The length of the output data, to be updated with the
752-
* actual number of Bytes written.
753-
* \param tag The buffer for the authentication tag.
754-
* \param tag_len The desired length of the authentication tag.
755-
*
756-
* \return \c 0 on success.
757-
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
758-
* parameter-verification failure.
759-
* \return A cipher-specific error code on failure.
752+
* \brief The generic autenticated encryption (AEAD) function.
753+
*
754+
* \param ctx The generic cipher context.
755+
* \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers.
756+
* \param iv_len The IV length for ciphers with variable-size IV.
757+
* This parameter is discarded by ciphers with fixed-size IV.
758+
* \param ad The additional data to authenticate.
759+
* \param ad_len The length of \p ad.
760+
* \param input The buffer holding the input data.
761+
* \param ilen The length of the input data.
762+
* \param output The buffer for the output data.
763+
* Must be able to hold at least \p ilen.
764+
* \param olen The length of the output data, to be updated with the
765+
* actual number of Bytes written.
766+
* \param tag The buffer for the authentication tag.
767+
* \param tag_len The desired length of the authentication tag.
768+
*
769+
* \return \c 0 on success.
770+
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
771+
* parameter-verification failure.
772+
* \return A cipher-specific error code on failure.
760773
*/
761774
int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
762775
const unsigned char *iv, size_t iv_len,
@@ -766,32 +779,32 @@ int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
766779
unsigned char *tag, size_t tag_len );
767780

768781
/**
769-
* \brief The generic autenticated decryption (AEAD) function.
770-
*
771-
* \note If the data is not authentic, then the output buffer
772-
* is zeroed out to prevent the unauthentic plaintext being
773-
* used, making this interface safer.
774-
*
775-
* \param ctx The generic cipher context.
776-
* \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers.
777-
* \param iv_len The IV length for ciphers with variable-size IV.
778-
* This parameter is discarded by ciphers with fixed-size IV.
779-
* \param ad The additional data to be authenticated.
780-
* \param ad_len The length of \p ad.
781-
* \param input The buffer holding the input data.
782-
* \param ilen The length of the input data.
783-
* \param output The buffer for the output data.
784-
* Must be able to hold at least \p ilen.
785-
* \param olen The length of the output data, to be updated with the
786-
* actual number of Bytes written.
787-
* \param tag The buffer holding the authentication tag.
788-
* \param tag_len The length of the authentication tag.
789-
*
790-
* \return \c 0 on success.
791-
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
792-
* parameter-verification failure.
793-
* \return #MBEDTLS_ERR_CIPHER_AUTH_FAILED if data is not authentic.
794-
* \return A cipher-specific error code on failure.
782+
* \brief The generic autenticated decryption (AEAD) function.
783+
*
784+
* \note If the data is not authentic, then the output buffer
785+
* is zeroed out to prevent the unauthentic plaintext being
786+
* used, making this interface safer.
787+
*
788+
* \param ctx The generic cipher context.
789+
* \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers.
790+
* \param iv_len The IV length for ciphers with variable-size IV.
791+
* This parameter is discarded by ciphers with fixed-size IV.
792+
* \param ad The additional data to be authenticated.
793+
* \param ad_len The length of \p ad.
794+
* \param input The buffer holding the input data.
795+
* \param ilen The length of the input data.
796+
* \param output The buffer for the output data.
797+
* Must be able to hold at least \p ilen.
798+
* \param olen The length of the output data, to be updated with the
799+
* actual number of Bytes written.
800+
* \param tag The buffer holding the authentication tag.
801+
* \param tag_len The length of the authentication tag.
802+
*
803+
* \return \c 0 on success.
804+
* \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on
805+
* parameter-verification failure.
806+
* \return #MBEDTLS_ERR_CIPHER_AUTH_FAILED if data is not authentic.
807+
* \return A cipher-specific error code on failure.
795808
*/
796809
int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
797810
const unsigned char *iv, size_t iv_len,

0 commit comments

Comments
 (0)