From ff14a08d53ac9e223ffada8a41e69ebb673aa7d7 Mon Sep 17 00:00:00 2001 From: mk-pmb Date: Tue, 25 Feb 2014 15:58:54 +0100 Subject: [PATCH] Enhance naming to show that the pubkey is the server's. While I'm at it, also label the magic constants for prng_seed to avoid confusion with srand(0). --- mtproto-client.c | 11 ++++++++--- tg.pub => tg-server.pub | 0 2 files changed, 8 insertions(+), 3 deletions(-) rename tg.pub => tg-server.pub (100%) diff --git a/mtproto-client.c b/mtproto-client.c index ab55774..13cf983 100644 --- a/mtproto-client.c +++ b/mtproto-client.c @@ -131,7 +131,8 @@ int Response_len; * */ -char *rsa_public_key_name; // = "tg.pub"; +#define TG_SERVER_PUBKEY_FILENAME "tg.pub" +char *rsa_public_key_name; // = TG_SERVER_PUBKEY_FILENAME; RSA *pubKey; long long pk_fingerprint; @@ -1824,8 +1825,11 @@ int auth_is_success (void) { return auth_success; } + +#define RANDSEED_PASSWORD_FILENAME NULL +#define RANDSEED_PASSWORD_LENGTH 0 void on_start (void) { - prng_seed (0, 0); + prng_seed (RANDSEED_PASSWORD_FILENAME, RANDSEED_PASSWORD_LENGTH); if (rsa_public_key_name) { if (rsa_load_public_key (rsa_public_key_name) < 0) { @@ -1833,7 +1837,8 @@ void on_start (void) { exit (1); } } else { - if (rsa_load_public_key ("tg.pub") < 0 && rsa_load_public_key ("/etc/" PROG_NAME "/server.pub") < 0) { + if (rsa_load_public_key (TG_SERVER_PUBKEY_FILENAME) < 0 + && rsa_load_public_key ("/etc/" PROG_NAME "/server.pub") < 0) { perror ("rsa_load_public_key"); exit (1); } diff --git a/tg.pub b/tg-server.pub similarity index 100% rename from tg.pub rename to tg-server.pub