@@ -44,40 +44,40 @@ LOG_MODULE_REGISTER(crypto_smartbond_crypto, CONFIG_CRYPTO_LOG_LEVEL);
4444
4545
4646struct crypto_smartbond_data {
47- /*
48- * Semaphore to provide mutual exclusion when a crypto session is requested.
49- */
47+ /*
48+ * Semaphore to provide mutual exclusion when a crypto session is requested.
49+ */
5050 struct k_sem session_sem ;
5151
52- /*
53- * Semaphore to provide mutual exlusion when a cryptographic task is requested.
54- * (a session should be requested at this point).
55- */
52+ /*
53+ * Semaphore to provide mutual exlusion when a cryptographic task is requested.
54+ * (a session should be requested at this point).
55+ */
5656 struct k_sem device_sem ;
5757#if defined(CONFIG_CRYPTO_ASYNC )
58- /*
59- * User-defined callbacks to be called upon completion of asynchronous
60- * cryptographic operations. Note that the AES and HASH modes can work
61- * complementary to each other.
62- */
58+ /*
59+ * User-defined callbacks to be called upon completion of asynchronous
60+ * cryptographic operations. Note that the AES and HASH modes can work
61+ * complementary to each other.
62+ */
6363 union {
6464 cipher_completion_cb cipher_user_cb ;
6565 hash_completion_cb hash_user_cb ;
6666 };
6767
68- /*
69- * Packet context should be stored during a session so that can be retrieved
70- * from within the crypto engine ISR context.
71- */
68+ /*
69+ * Packet context should be stored during a session so that can be retrieved
70+ * from within the crypto engine ISR context.
71+ */
7272 union {
7373 struct cipher_pkt * cipher_pkt ;
7474 struct hash_pkt * hash_pkt ;
7575 };
7676#else
77- /*
78- * Semaphore used to block for as long as a synchronous cryptographic operation
79- * is in progress.
80- */
77+ /*
78+ * Semaphore used to block for as long as a synchronous cryptographic operation
79+ * is in progress.
80+ */
8181 struct k_sem sync_sem ;
8282#endif
8383};
@@ -96,7 +96,7 @@ static void smartbond_crypto_isr(const void *arg)
9696 uint32_t status = AES_HASH -> CRYPTO_STATUS_REG ;
9797
9898 if (status & AES_HASH_CRYPTO_STATUS_REG_CRYPTO_IRQ_ST_Msk ) {
99- /* Clear interrupt source. Otherwise the handler will be fire constantly! */
99+ /* Clear interrupt source. Otherwise the handler will be fire constantly! */
100100 AES_HASH -> CRYPTO_CLRIRQ_REG = 0x1 ;
101101
102102#if defined(CONFIG_CRYPTO_ASYNC )
@@ -227,7 +227,7 @@ static int crypto_smartbond_hash_set_out_len(void)
227227 uint32_t hash_algo = (AES_HASH -> CRYPTO_CTRL_REG & AES_HASH_CRYPTO_CTRL_REG_CRYPTO_ALG_Msk );
228228
229229 if (AES_HASH -> CRYPTO_CTRL_REG & AES_HASH_CRYPTO_CTRL_REG_CRYPTO_ALG_MD_Msk ) {
230- /* 64-bit HASH operations */
230+ /* 64-bit HASH operations */
231231 switch (hash_algo ) {
232232 case 0x0 :
233233 /* SHA-384: 0..47 --> 1..48 bytes */
@@ -249,7 +249,7 @@ static int crypto_smartbond_hash_set_out_len(void)
249249 break ;
250250 }
251251 } else {
252- /* 32-bit HASH operations */
252+ /* 32-bit HASH operations */
253253 switch (hash_algo ) {
254254 case 0x0 :
255255 /* MD5: 0..15 --> 1..16 bytes */
@@ -278,7 +278,7 @@ static int crypto_smartbond_hash_set_out_len(void)
278278
279279static uint32_t crypto_smartbond_swap_word (uint8_t * data )
280280{
281- /* Check word boundaries of given address and if possible accelerate swapping */
281+ /* Check word boundaries of given address and if possible accelerate swapping */
282282 if ((uint32_t )data & 0x3 ) {
283283 return SWAP32 (sys_get_le32 (data ));
284284 } else {
@@ -623,11 +623,11 @@ crypto_smartbond_cipher_cbc_handler(struct cipher_ctx *ctx, struct cipher_pkt *p
623623 data -> cipher_pkt = pkt ;
624624#endif
625625
626- /* Start crypto processing */
626+ /* Start crypto processing */
627627 AES_HASH -> CRYPTO_START_REG = 1 ;
628628
629629#if !defined(CONFIG_CRYPTO_ASYNC )
630- /* Wait for crypto to finish its task */
630+ /* Wait for crypto to finish its task */
631631 k_sem_take (& data -> sync_sem , K_FOREVER );
632632#endif
633633
@@ -693,11 +693,11 @@ static int crypto_smartbond_cipher_ctr_handler(struct cipher_ctx *ctx,
693693 data -> cipher_pkt = pkt ;
694694#endif
695695
696- /* Start crypto processing */
696+ /* Start crypto processing */
697697 AES_HASH -> CRYPTO_START_REG = 1 ;
698698
699699#if !defined(CONFIG_CRYPTO_ASYNC )
700- /* Wait for crypto to finish its task */
700+ /* Wait for crypto to finish its task */
701701 k_sem_take (& data -> sync_sem , K_FOREVER );
702702#endif
703703
@@ -769,7 +769,7 @@ static int crypto_smartbond_hash_handler(struct hash_ctx *ctx, struct hash_pkt *
769769 data -> hash_pkt = pkt ;
770770#endif
771771
772- /* Start hash processing */
772+ /* Start hash processing */
773773 AES_HASH -> CRYPTO_START_REG = 1 ;
774774
775775#if !defined(CONFIG_CRYPTO_ASYNC )
@@ -973,7 +973,7 @@ static int crypto_smartbond_init(const struct device *dev)
973973 k_sem_init (& data -> device_sem , 1 , 1 );
974974
975975#if !defined(CONFIG_CRYPTO_ASYNC )
976- /* Semaphore used when sync operations are enabled */
976+ /* Semaphore used when sync operations are enabled */
977977 k_sem_init (& data -> sync_sem , 0 , 1 );
978978#endif
979979
0 commit comments