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).
This commit is contained in:
mk-pmb 2014-02-25 15:58:54 +01:00
parent 31e7f3a92f
commit ff14a08d53
2 changed files with 8 additions and 3 deletions

View File

@ -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);
}