mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
crypto/cryptosoft: replace macro howmany with common macro div_round_up
Replace the non-standard howmany macro with the common div_round_up macro for consistency and better code maintainability. Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
+2
-5
@@ -31,6 +31,7 @@
|
|||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <nuttx/kmalloc.h>
|
#include <nuttx/kmalloc.h>
|
||||||
|
#include <nuttx/lib/math32.h>
|
||||||
#include <crypto/bn.h>
|
#include <crypto/bn.h>
|
||||||
#include <crypto/cryptodev.h>
|
#include <crypto/cryptodev.h>
|
||||||
#include <crypto/cryptosoft.h>
|
#include <crypto/cryptosoft.h>
|
||||||
@@ -42,10 +43,6 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef howmany
|
|
||||||
# define howmany(x, y) (((x) + ((y) - 1)) / (y))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -275,7 +272,7 @@ int swcr_hash(FAR struct cryptop *crp,
|
|||||||
|
|
||||||
int swcr_authenc(FAR struct cryptop *crp)
|
int swcr_authenc(FAR struct cryptop *crp)
|
||||||
{
|
{
|
||||||
uint32_t blkbuf[howmany(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))];
|
uint32_t blkbuf[div_round_up(EALG_MAX_BLOCK_LEN, sizeof(uint32_t))];
|
||||||
FAR u_char *blk = (u_char *)blkbuf;
|
FAR u_char *blk = (u_char *)blkbuf;
|
||||||
u_char aalg[AALG_MAX_RESULT_LEN];
|
u_char aalg[AALG_MAX_RESULT_LEN];
|
||||||
u_char iv[EALG_MAX_BLOCK_LEN];
|
u_char iv[EALG_MAX_BLOCK_LEN];
|
||||||
|
|||||||
Reference in New Issue
Block a user