mode_moderate.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. diff -Nur secure_delete-3.1-old/smem.1 secure_delete-3.1/smem.1
  2. --- secure_delete-3.1-old/smem.1 2011-06-20 16:31:36.890599669 +0300
  3. +++ secure_delete-3.1/smem.1 2011-06-20 16:37:11.867622820 +0300
  4. @@ -9,7 +9,7 @@
  5. sdmem \- secure memory wiper (secure_deletion toolkit)
  6. .SH SYNOPSIS
  7. -.B sdmem [-f] [-l] [-l] [-v]
  8. +.B sdmem [-f] [-l] [-l] [-m] [-v]
  9. .SH DESCRIPTION
  10. .I sdmem
  11. @@ -54,6 +54,9 @@
  12. -l for a second time lessons the security even more: only one pass with
  13. 0x00 is written.
  14. .TP
  15. +.B \-m
  16. +moderate security. Five passes are written.
  17. +.TP
  18. .B \-v
  19. verbose mode
  20. .PP
  21. diff -Nur secure_delete-3.1-old/smem.c secure_delete-3.1/smem.c
  22. --- secure_delete-3.1-old/smem.c 2011-06-20 16:31:36.889599617 +0300
  23. +++ secure_delete-3.1/smem.c 2011-06-20 16:32:58.805684329 +0300
  24. @@ -46,6 +46,7 @@
  25. printf("Options:\n");
  26. printf("\t-f fast (and insecure mode): no /dev/urandom.\n");
  27. printf("\t-l lessens the security (use twice for total insecure mode).\n");
  28. + printf("\t-m moderate security (5 writes).\n");
  29. printf("\t-v is verbose mode.\n");
  30. printf("\nsmem does a secure overwrite of the memory (RAM), because memory contents can\n");
  31. printf("be recovered even after a shutdown! Default is secure mode (38 writes).\n");
  32. @@ -127,7 +128,19 @@
  33. alarm(600); /* needed to prevent mem caching */
  34. while ( (ptr = calloc(4096, 16)) != NULL) {
  35. - if (mode > 0) {
  36. + if (mode == 3) {
  37. + __sdel_fill_buf(write_modes[0], BLOCKSIZE + 2, buf);
  38. + memcpy(ptr, buf, BLOCKSIZE);
  39. + __sdel_fill_buf(write_modes[1], BLOCKSIZE + 2, buf);
  40. + memcpy(ptr, buf, BLOCKSIZE);
  41. + __sdel_random_buf(BLOCKSIZE + 2, buf);
  42. + memcpy(ptr, buf, BLOCKSIZE);
  43. + __sdel_fill_buf(write_modes[0], BLOCKSIZE + 2, buf);
  44. + memcpy(ptr, buf, BLOCKSIZE);
  45. + __sdel_fill_buf(write_modes[1], BLOCKSIZE + 2, buf);
  46. + memcpy(ptr, buf, BLOCKSIZE);
  47. + }
  48. + else if (mode > 0) {
  49. for (turn=0; turn<=36; turn++) {
  50. if ((mode == 1) && (turn > 0)) break;
  51. if ((turn>=5) && (turn<=31)) {
  52. @@ -170,7 +183,7 @@
  53. help();
  54. while (1) {
  55. - result = getopt(argc, argv, "FfLlSsVvZz");
  56. + result = getopt(argc, argv, "FfLlmSsVvZz");
  57. if (result<0) break;
  58. switch (result) {
  59. case 'F' :
  60. @@ -179,6 +192,8 @@
  61. case 'L' :
  62. case 'l' : if (secure) secure--;
  63. break;
  64. + case 'm' : secure = 3;
  65. + break;
  66. case 'S' :
  67. case 's' : secure++;
  68. break;