Fix signedness compiler warnings.
[tinc] / src / protocol_key.c
index a56ff91..591bb66 100644 (file)
@@ -142,10 +142,11 @@ bool req_key_h(connection_t *c)
 
 bool send_ans_key(connection_t *c, const node_t *from, const node_t *to)
 {
 
 bool send_ans_key(connection_t *c, const node_t *from, const node_t *to)
 {
-       char key[MAX_STRING_SIZE];
+       char *key;
 
        cp();
 
 
        cp();
 
+       key = alloca(2 * from->keylength + 1);
        bin2hex(from->key, key, from->keylength);
        key[from->keylength * 2] = '\0';
 
        bin2hex(from->key, key, from->keylength);
        key[from->keylength * 2] = '\0';
 
@@ -261,7 +262,7 @@ bool ans_key_h(connection_t *c)
        from->compression = compression;
 
        if(from->cipher)
        from->compression = compression;
 
        if(from->cipher)
-               if(!EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, from->key, from->key + from->cipher->key_len)) {
+               if(!EVP_EncryptInit_ex(&from->packet_ctx, from->cipher, NULL, (unsigned char *)from->key, (unsigned char *)from->key + from->cipher->key_len)) {
                        logger(LOG_ERR, _("Error during initialisation of key from %s (%s): %s"),
                                        from->name, from->hostname, ERR_error_string(ERR_get_error(), NULL));
                        return false;
                        logger(LOG_ERR, _("Error during initialisation of key from %s (%s): %s"),
                                        from->name, from->hostname, ERR_error_string(ERR_get_error(), NULL));
                        return false;