fix build warning.

CC:  vfs/fs_lseek.c /home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c: In function ‘HMAC_CTX_new’:
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
   57 |       (mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
      |                               ^~~~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:28:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
   27 | #include <mbedtls/hmac_drbg.h>
  +++ |+#include <stdlib.h>
   28 | #include <mbedtls/md.h>
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: warning: incompatible implicit declaration of built-in function ‘malloc’ [-Wbuiltin-declaration-mismatch]
   57 |       (mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
      |                               ^~~~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:57:31: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c: In function ‘HMAC_CTX_free’:
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
  126 |   free(ctx);
      |   ^~~~
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: warning: incompatible implicit declaration of built-in function ‘free’ [-Wbuiltin-declaration-mismatch]
/home/cuiziwei/vela/happy/apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c:126:3: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
This commit is contained in:
cuiziwei 2023-10-19 16:49:29 +08:00 committed by Xiang Xiao
parent f7582e34e5
commit 6721ae3555

View file

@ -26,6 +26,7 @@
#include <openssl/hmac.h>
#include <mbedtls/hmac_drbg.h>
#include <mbedtls/md.h>
#include <stdlib.h>
/****************************************************************************
* Public Functions