X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprotocol_key.c;h=591bb66026d024b8a3e7b017496286563cca116e;hp=a56ff919df8d1de88b718d502bf6e7c01bc8357a;hb=af95368c0f30955f0e13b587d5d6d4989fd5a83e;hpb=df3220a1549f992cbf4a9b6e67c1e67b69896c7d diff --git a/src/protocol_key.c b/src/protocol_key.c index a56ff919..591bb660 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -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) { - char key[MAX_STRING_SIZE]; + char *key; cp(); + key = alloca(2 * from->keylength + 1); 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) - 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;