+ RSA *rsa_key;
+
+ fprintf(stderr, _("Seeding the PRNG: please press some keys or move\nthe mouse if this program seems to have halted...\n"));
+ RAND_load_file("/dev/random", 1024); /* OpenSSL PRNG state apparently uses 1024 bytes, but it seems pretty sufficient anyway :) */
+
+ fprintf(stderr, _("Generating %d bits keys:\n"), bits);
+ rsa_key = RSA_generate_key(bits, 0xFFFF, indicator, NULL);
+ if(!rsa_key)
+ {
+ fprintf(stderr, _("Error during key generation!"));
+ return -1;
+ }
+ else
+ fprintf(stderr, _("Done.\n"));
+
+ fprintf(stderr, _("Please copy the private key to tinc.conf and the\npublic key to your host configuration file:\n\n"));
+ printf("PublicKey = %s\n", BN_bn2hex(rsa_key->n));
+ printf("PrivateKey = %s\n", BN_bn2hex(rsa_key->d));
+
+ fflush(stdin);
+ return 0;
+}
+
+void memory_full(int size)
+{
+ syslog(LOG_ERR, _("Memory exhausted (last is %s:%d) (couldn't allocate %d bytes), exiting."), cp_file, cp_line, size);