X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=b6c4fc89ad1014086cca57a88efc16ab5cf35fcc;hb=6debc6c79ba385d35f646e0958f84ace5b8f4b4d;hp=ef29c992fcf5d712974d050fda8d6c1588ad582a;hpb=2c6b2d70e6640f39563ad7bb0aa0ba87f883848c;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index ef29c992..b6c4fc89 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1100,7 +1100,7 @@ static int dump_invitations(void) { while((ent = readdir(dir))) { char buf[MAX_STRING_SIZE]; - if(b64decode(ent->d_name, buf, 24) != 18) { + if(b64decode_tinc(ent->d_name, buf, 24) != 18) { continue; } @@ -2127,7 +2127,7 @@ int check_port(const char *name) { fprintf(stderr, "Warning: could not bind to port 655. "); for(int i = 0; i < 100; i++) { - int port = 0x1000 + (rand() & 0x7fff); + uint16_t port = 0x1000 + prng(0x8000); if(try_bind(port)) { char filename[PATH_MAX]; @@ -2802,7 +2802,7 @@ static int cmd_sign(int argc, char *argv[]) { return 1; } - b64encode(sig, sig, 64); + b64encode_tinc(sig, sig, 64); ecdsa_free(key); fprintf(stdout, "Signature = %s %ld %s\n", name, t, sig); @@ -2936,7 +2936,7 @@ static int cmd_verify(int argc, char *argv[]) { fclose(fp); - if(b64decode(sig, sig, 86) != 64 || !ecdsa_verify(key, newline, len + trailer_len - (newline - data), sig)) { + if(b64decode_tinc(sig, sig, 86) != 64 || !ecdsa_verify(key, newline, len + trailer_len - (newline - data), sig)) { fprintf(stderr, "Invalid signature\n"); free(data); ecdsa_free(key); @@ -3302,8 +3302,8 @@ int main(int argc, char *argv[]) { #endif gettimeofday(&now, NULL); - srand(now.tv_sec + now.tv_usec); crypto_init(); + prng_init(); if(optind >= argc) { return cmd_shell(argc, argv);