suspend-0.80-keygen-new-defaults.diff 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Index: b/keygen.c
  2. ===================================================================
  3. --- a/keygen.c
  4. +++ b/keygen.c
  5. @@ -25,11 +25,11 @@
  6. #define MIN_KEY_BITS 1024
  7. #define MAX_KEY_BITS 4096
  8. #define MAX_OUT_SIZE (sizeof(struct RSA_data))
  9. #define MAX_STR_LEN 256
  10. -#define DEFAULT_FILE "suspend.key"
  11. +#define DEFAULT_FILE "/etc/suspend.key"
  12. static char in_buffer[MAX_STR_LEN];
  13. static char pass_buf[MAX_STR_LEN];
  14. static struct RSA_data rsa;
  15. static unsigned char encrypt_buffer[RSA_DATA_SIZE];
  16. @@ -40,11 +40,11 @@ int main(int argc, char *argv[])
  17. gcry_ac_handle_t rsa_hd;
  18. gcry_ac_key_t rsa_priv;
  19. gcry_ac_key_pair_t rsa_key_pair;
  20. gcry_mpi_t mpi;
  21. size_t offset;
  22. - int len = MIN_KEY_BITS, ret = EXIT_SUCCESS;
  23. + int len = 2048, ret = EXIT_SUCCESS;
  24. struct termios termios;
  25. char *vrfy_buf;
  26. struct md5_ctx ctx;
  27. unsigned char key_buf[PK_KEY_SIZE];
  28. gcry_cipher_hd_t sym_hd;
  29. @@ -197,12 +197,15 @@ Retry:
  30. gcry_free(str);
  31. }
  32. size = offset + sizeof(struct RSA_data) - RSA_DATA_SIZE;
  33. - printf("File name [%s]: ", DEFAULT_FILE);
  34. - fgets(in_buffer, MAX_STR_LEN, stdin);
  35. + *in_buffer = 0;
  36. + if (!((argc > 1) && (strcmp(argv[1], "-q") == 0))) {
  37. + printf("File name [%s]: ", DEFAULT_FILE);
  38. + fgets(in_buffer, MAX_STR_LEN, stdin);
  39. + }
  40. if (!strlen(in_buffer) || *in_buffer == '\n')
  41. strcpy(in_buffer, DEFAULT_FILE);
  42. else if (in_buffer[strlen(in_buffer)-1] == '\n')
  43. in_buffer[strlen(in_buffer)-1] = '\0';
  44. fd = open(in_buffer, O_RDWR | O_CREAT | O_TRUNC, 00600);