Unverified Commit 0bea6d53 by Julio Faracco Committed by Christian Brauner

utils: Fix wrong integer of a function parameter.

If SSL is enabled, utils will include function `do_sha1_hash()` to generate a sha1 encrypted buffer. Last function argument of `EVP_DigestFinal_ex()` requires a `unsigned int` but the current parameter is an `integer` type. See error: utils.c:350:38: error: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Werror,-Wpointer-sign] EVP_DigestFinal_ex(mdctx, md_value, md_len); ^~~~~~ /usr/include/openssl/evp.h:549:49: note: passing argument to parameter 's' here unsigned int *s); Signed-off-by: 's avatarJulio Faracco <jcfaracco@gmail.com>
parent c5abc9de
...@@ -1638,7 +1638,8 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[]) ...@@ -1638,7 +1638,8 @@ static bool prepend_lxc_header(char *path, const char *t, char *const argv[])
FILE *f; FILE *f;
int ret = -1; int ret = -1;
#if HAVE_OPENSSL #if HAVE_OPENSSL
int i, md_len = 0; int i;
unsigned int md_len = 0;
unsigned char md_value[EVP_MAX_MD_SIZE]; unsigned char md_value[EVP_MAX_MD_SIZE];
char *tpath; char *tpath;
#endif #endif
......
...@@ -333,7 +333,7 @@ again: ...@@ -333,7 +333,7 @@ again:
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
#include <openssl/evp.h> #include <openssl/evp.h>
static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, int *md_len) static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, unsigned int *md_len)
{ {
EVP_MD_CTX *mdctx; EVP_MD_CTX *mdctx;
const EVP_MD *md; const EVP_MD *md;
...@@ -353,7 +353,7 @@ static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, in ...@@ -353,7 +353,7 @@ static int do_sha1_hash(const char *buf, int buflen, unsigned char *md_value, in
return 0; return 0;
} }
int sha1sum_file(char *fnam, unsigned char *digest, int *md_len) int sha1sum_file(char *fnam, unsigned char *digest, unsigned int *md_len)
{ {
char *buf; char *buf;
int ret; int ret;
......
...@@ -99,7 +99,7 @@ extern int wait_for_pid(pid_t pid); ...@@ -99,7 +99,7 @@ extern int wait_for_pid(pid_t pid);
extern int lxc_wait_for_pid_status(pid_t pid); extern int lxc_wait_for_pid_status(pid_t pid);
#if HAVE_OPENSSL #if HAVE_OPENSSL
extern int sha1sum_file(char *fnam, unsigned char *md_value, int *md_len); extern int sha1sum_file(char *fnam, unsigned char *md_value, unsigned int *md_len);
#endif #endif
/* initialize rand with urandom */ /* initialize rand with urandom */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment