diff mbox series

Fix some compiler warnings if !CONFIG_HASH_VERIFY

Message ID 20180116143010.30298-1-christian.storm@siemens.com
State Accepted
Headers show
Series Fix some compiler warnings if !CONFIG_HASH_VERIFY | expand

Commit Message

Storm, Christian Jan. 16, 2018, 2:30 p.m. UTC
Fix "statement with no effect [-Wunused-value]" and
"unused variable [-Wunused-variable]" warnings caused
by swupdate_HASH_update() and swupdate_HASH_final()
calls if !CONFIG_HASH_VERIFY.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 include/sslapi.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Comments

Stefano Babic Jan. 16, 2018, 6:28 p.m. UTC | #1
On 16/01/2018 15:30, Christian Storm wrote:
> Fix "statement with no effect [-Wunused-value]" and
> "unused variable [-Wunused-variable]" warnings caused
> by swupdate_HASH_update() and swupdate_HASH_final()
> calls if !CONFIG_HASH_VERIFY.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  include/sslapi.h | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sslapi.h b/include/sslapi.h
> index 59eaf73..6b742f4 100644
> --- a/include/sslapi.h
> +++ b/include/sslapi.h
> @@ -91,8 +91,26 @@ int swupdate_HASH_compare(unsigned char *hash1, unsigned char *hash2);
>  #define swupdate_dgst_init(sw, keyfile) ( 0 )
>  #define swupdate_HASH_init(p) ( NULL )
>  #define swupdate_verify_file(dgst, sigfile, file) ( 0 )
> -#define swupdate_HASH_update(p, buf, len)	(-1)
> -#define swupdate_HASH_final(p, result, len)	(-1)
> +static inline int swupdate_HASH_update(struct swupdate_digest *dgst,
> +				       unsigned char *buf, size_t len);
> +static inline int swupdate_HASH_update(struct swupdate_digest *dgst,
> +				       unsigned char *buf, size_t len)
> +{
> +	(void)dgst;
> +	(void)buf;
> +	(void)len;
> +	return -1;
> +}
> +static inline int swupdate_HASH_final(struct swupdate_digest *dgst,
> +				      unsigned char *md_value, unsigned int *md_len);
> +static inline int swupdate_HASH_final(struct swupdate_digest *dgst,
> +				      unsigned char *md_value, unsigned int *md_len)
> +{
> +	(void)dgst;
> +	(void)md_value;
> +	(void)md_len;
> +	return -1;
> +}
>  #define swupdate_HASH_cleanup(sw)
>  #define swupdate_HASH_compare(hash1,hash2)	(0)
>  #endif
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/include/sslapi.h b/include/sslapi.h
index 59eaf73..6b742f4 100644
--- a/include/sslapi.h
+++ b/include/sslapi.h
@@ -91,8 +91,26 @@  int swupdate_HASH_compare(unsigned char *hash1, unsigned char *hash2);
 #define swupdate_dgst_init(sw, keyfile) ( 0 )
 #define swupdate_HASH_init(p) ( NULL )
 #define swupdate_verify_file(dgst, sigfile, file) ( 0 )
-#define swupdate_HASH_update(p, buf, len)	(-1)
-#define swupdate_HASH_final(p, result, len)	(-1)
+static inline int swupdate_HASH_update(struct swupdate_digest *dgst,
+				       unsigned char *buf, size_t len);
+static inline int swupdate_HASH_update(struct swupdate_digest *dgst,
+				       unsigned char *buf, size_t len)
+{
+	(void)dgst;
+	(void)buf;
+	(void)len;
+	return -1;
+}
+static inline int swupdate_HASH_final(struct swupdate_digest *dgst,
+				      unsigned char *md_value, unsigned int *md_len);
+static inline int swupdate_HASH_final(struct swupdate_digest *dgst,
+				      unsigned char *md_value, unsigned int *md_len)
+{
+	(void)dgst;
+	(void)md_value;
+	(void)md_len;
+	return -1;
+}
 #define swupdate_HASH_cleanup(sw)
 #define swupdate_HASH_compare(hash1,hash2)	(0)
 #endif