12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- Index: b/keygen.c
- ===================================================================
- --- a/keygen.c
- +++ b/keygen.c
- @@ -25,11 +25,11 @@
-
- #define MIN_KEY_BITS 1024
- #define MAX_KEY_BITS 4096
- #define MAX_OUT_SIZE (sizeof(struct RSA_data))
- #define MAX_STR_LEN 256
- -#define DEFAULT_FILE "suspend.key"
- +#define DEFAULT_FILE "/etc/suspend.key"
-
- static char in_buffer[MAX_STR_LEN];
- static char pass_buf[MAX_STR_LEN];
- static struct RSA_data rsa;
- static unsigned char encrypt_buffer[RSA_DATA_SIZE];
- @@ -40,11 +40,11 @@ int main(int argc, char *argv[])
- gcry_ac_handle_t rsa_hd;
- gcry_ac_key_t rsa_priv;
- gcry_ac_key_pair_t rsa_key_pair;
- gcry_mpi_t mpi;
- size_t offset;
- - int len = MIN_KEY_BITS, ret = EXIT_SUCCESS;
- + int len = 2048, ret = EXIT_SUCCESS;
- struct termios termios;
- char *vrfy_buf;
- struct md5_ctx ctx;
- unsigned char key_buf[PK_KEY_SIZE];
- gcry_cipher_hd_t sym_hd;
- @@ -197,12 +197,15 @@ Retry:
- gcry_free(str);
- }
-
- size = offset + sizeof(struct RSA_data) - RSA_DATA_SIZE;
-
- - printf("File name [%s]: ", DEFAULT_FILE);
- - fgets(in_buffer, MAX_STR_LEN, stdin);
- + *in_buffer = 0;
- + if (!((argc > 1) && (strcmp(argv[1], "-q") == 0))) {
- + printf("File name [%s]: ", DEFAULT_FILE);
- + fgets(in_buffer, MAX_STR_LEN, stdin);
- + }
- if (!strlen(in_buffer) || *in_buffer == '\n')
- strcpy(in_buffer, DEFAULT_FILE);
- else if (in_buffer[strlen(in_buffer)-1] == '\n')
- in_buffer[strlen(in_buffer)-1] = '\0';
- fd = open(in_buffer, O_RDWR | O_CREAT | O_TRUNC, 00600);
|