Commit ff14a08d authored by mk-pmb's avatar mk-pmb

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).
parent 31e7f3a9
...@@ -131,7 +131,8 @@ int Response_len; ...@@ -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; RSA *pubKey;
long long pk_fingerprint; long long pk_fingerprint;
...@@ -1824,8 +1825,11 @@ int auth_is_success (void) { ...@@ -1824,8 +1825,11 @@ int auth_is_success (void) {
return auth_success; return auth_success;
} }
#define RANDSEED_PASSWORD_FILENAME NULL
#define RANDSEED_PASSWORD_LENGTH 0
void on_start (void) { void on_start (void) {
prng_seed (0, 0); prng_seed (RANDSEED_PASSWORD_FILENAME, RANDSEED_PASSWORD_LENGTH);
if (rsa_public_key_name) { if (rsa_public_key_name) {
if (rsa_load_public_key (rsa_public_key_name) < 0) { if (rsa_load_public_key (rsa_public_key_name) < 0) {
...@@ -1833,7 +1837,8 @@ void on_start (void) { ...@@ -1833,7 +1837,8 @@ void on_start (void) {
exit (1); exit (1);
} }
} else { } 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"); perror ("rsa_load_public_key");
exit (1); exit (1);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment