Fix compiler warnings.

This commit is contained in:
Guus Sliepen 2011-12-26 23:04:40 +01:00
parent 2a9060bba6
commit b50d6a7f2a
4 changed files with 6 additions and 7 deletions

View file

@ -34,7 +34,7 @@ bool ecdsa_set_base64_public_key(ecdsa_t *ecdsa, const char *p) {
int len = strlen(p); int len = strlen(p);
unsigned char pubkey[len / 4 * 3 + 3]; unsigned char pubkey[len / 4 * 3 + 3];
const unsigned char *ppubkey = pubkey; const unsigned char *ppubkey = pubkey;
len = b64decode(p, pubkey, len); len = b64decode(p, (char *)pubkey, len);
if(!o2i_ECPublicKey(ecdsa, &ppubkey, len)) { if(!o2i_ECPublicKey(ecdsa, &ppubkey, len)) {
logger(LOG_DEBUG, "o2i_ECPublicKey failed: %s", ERR_error_string(ERR_get_error(), NULL)); logger(LOG_DEBUG, "o2i_ECPublicKey failed: %s", ERR_error_string(ERR_get_error(), NULL));
@ -49,7 +49,7 @@ char *ecdsa_get_base64_public_key(ecdsa_t *ecdsa) {
int len = i2o_ECPublicKey(*ecdsa, &pubkey); int len = i2o_ECPublicKey(*ecdsa, &pubkey);
char *base64 = malloc(len * 4 / 3 + 5); char *base64 = malloc(len * 4 / 3 + 5);
b64encode(pubkey, base64, len); b64encode((char *)pubkey, base64, len);
free(pubkey); free(pubkey);
@ -87,7 +87,7 @@ size_t ecdsa_size(ecdsa_t *ecdsa) {
bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t len, void *sig) { bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t len, void *sig) {
unsigned int siglen = ECDSA_size(*ecdsa); unsigned int siglen = ECDSA_size(*ecdsa);
char hash[SHA512_DIGEST_LENGTH]; unsigned char hash[SHA512_DIGEST_LENGTH];
SHA512(in, len, hash); SHA512(in, len, hash);
memset(sig, 0, siglen); memset(sig, 0, siglen);
@ -107,7 +107,7 @@ bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t len, void *sig) {
bool ecdsa_verify(ecdsa_t *ecdsa, const void *in, size_t len, const void *sig) { bool ecdsa_verify(ecdsa_t *ecdsa, const void *in, size_t len, const void *sig) {
unsigned int siglen = ECDSA_size(*ecdsa); unsigned int siglen = ECDSA_size(*ecdsa);
char hash[SHA512_DIGEST_LENGTH]; unsigned char hash[SHA512_DIGEST_LENGTH];
SHA512(in, len, hash); SHA512(in, len, hash);
if(!ECDSA_verify(0, hash, sizeof hash, sig, siglen, *ecdsa)) { if(!ECDSA_verify(0, hash, sizeof hash, sig, siglen, *ecdsa)) {

View file

@ -67,7 +67,7 @@ char *ecdsa_get_base64_public_key(ecdsa_t *ecdsa) {
int len = i2o_ECPublicKey(*ecdsa, &pubkey); int len = i2o_ECPublicKey(*ecdsa, &pubkey);
char *base64 = malloc(len * 4 / 3 + 5); char *base64 = malloc(len * 4 / 3 + 5);
b64encode(pubkey, base64, len); b64encode((char *)pubkey, base64, len);
free(pubkey); free(pubkey);

View file

@ -226,7 +226,6 @@ bool send_metakey(connection_t *c) {
static bool metakey_ec_h(connection_t *c, const char *request) { static bool metakey_ec_h(connection_t *c, const char *request) {
size_t siglen = ecdsa_size(&c->ecdsa); size_t siglen = ecdsa_size(&c->ecdsa);
char key[MAX_STRING_SIZE]; char key[MAX_STRING_SIZE];
char sig[siglen];
logger(LOG_DEBUG, "Got ECDH metakey from %s", c->name); logger(LOG_DEBUG, "Got ECDH metakey from %s", c->name);

View file

@ -577,7 +577,7 @@ int main(int argc, char *argv[]) {
#endif #endif
if (slash++) { if (slash++) {
c = xmalloc((slash - argv[0]) + sizeof("tincd")); c = xmalloc((slash - argv[0]) + sizeof("tincd"));
sprintf(c, "%.*stincd", slash - argv[0], argv[0]); sprintf(c, "%.*stincd", (int)(slash - argv[0]), argv[0]);
} }
else else
c = "tincd"; c = "tincd";