All pastes #950640 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-03-20 18:56 UTC
rendered paste body
Only in /home/robert/downloads/shallot-0.0.2/src: config.h
diff -u /home/robert/downloads/shallot-0.0.2/src/defines.h ./src/defines.h
--- /home/robert/downloads/shallot-0.0.2/src/defines.h	2007-03-03 00:49:07.000000000 +0000
+++ ./src/defines.h	2008-03-19 20:25:00.000000000 +0000
@@ -3,28 +3,31 @@
 
 #include "config.h"
 
-// our ever-important version string
-#define VERSION "0.0.2-RC5"
+/* our ever-important version string*/
+#define SHALLOT_VERSION "0.0.2-RC5"
 
-// default values
-#define DEFAULT_THREADS 1 // not used on anything but unknown systems
-#define DEFAULT_E_LIMIT 0xFFFFFFFFFFull // must be odd and <= MAXIMUM_E_LIMIT 
-                                        // and >= RSA_PK_EXPONENT
+/* default values*/
+#define DEFAULT_THREADS 1 /* not used on anything but unknown systems*/
+#define DEFAULT_E_LIMIT 0xFFFFFFFFFFull /* must be odd and <= */
+                                        /*    MAXIMUM_E_LIMIT */
+                                        /* and >= RSA_PK_EXPONENT*/
 #define MAXIMUM_E_LIMIT 0xFFFFFFFFFFFFFFFDull
 
-// crypt constants
+/* crypt constants*/
 #define REGEX_COMP_LMAX 0x40
 #define SHA1_DIGEST_LEN 20
 #define RSA_KEYS_BITLEN 0x400
-// be sure to keep these constants in sync if you change them!
+/* be sure to keep these constants in sync if you change them!*/
 #define RSA_PK_EXPONENT 0x10001ull
 #define RSA_PK_E_LENGTH 3
 #define RSA_EXP_DER_LEN 0x8C
-#define RSA_REL_DER_LEN 0x89 // RSA_EXP_DER_LEN - RSA_PK_E_LENGTH
-                             // TODO: will gcc optimize constants w/o this?
-#define RSA_ADD_DER_OFF 0x02 // don't ask...
-#define SHA_REL_CTX_LEN 40   // 10 * sizeof(SHA_LONG)
-                             // TODO: will gcc optimize constants w/o this?
+#define RSA_REL_DER_LEN 0x89 /* RSA_EXP_DER_LEN - RSA_PK_E_LENGTH*/
+                             /* TODO: will gcc optimize constants w/o
+                                this?*/
+#define RSA_ADD_DER_OFF 0x02 /* don't ask...*/
+#define SHA_REL_CTX_LEN 40   /* 10 * sizeof(SHA_LONG)*/
+                             /* TODO: will gcc optimize constants w/o
+                                this?*/
 
 #define BASE32_NUM_BITS SHA1_DIGEST_LEN/2*8
 #define BASE32_ONIONLEN SHA1_DIGEST_LEN/2*8/5+1
@@ -34,12 +37,12 @@
 #define PRINT_ONION_MAX 79
 
 #ifdef LINUX_PORT
-  // Linux constants (lol no API)
+  /* Linux constants (lol no API)*/
   #define CPUINFO_BUF_SIZE 0x400
   #define CPUINFO_PATH "/proc/cpuinfo"
   #define CPUINFO_PROC_STR "processor"
-  #define CPUINFO_PROC_STR_LEN 9 // don't include trailing NULL
-  // constant sanity checking
+  #define CPUINFO_PROC_STR_LEN 9 /* don't include trailing NULL*/
+  /* constant sanity checking*/
   #if CPUINFO_BUF_SIZE < 0x100
     #error CPUINFO_BUFFER_SIZE set too small.  Please make it bigger.
   #elif CPUINFO_BUF_SIZE > 0x7FFF
Only in ./src: defines.h~
diff -u /home/robert/downloads/shallot-0.0.2/src/error.c ./src/error.c
--- /home/robert/downloads/shallot-0.0.2/src/error.c	2007-02-24 09:03:25.000000000 +0000
+++ ./src/error.c	2008-03-19 19:43:56.000000000 +0000
@@ -1,4 +1,4 @@
-// error handling for shallot
+/* error handling for shallot*/
 
 #include "error.h"
 #include "globals.h"
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-// help - how to use this stuff
+/* help - how to use this stuff*/
 void usage(void) {
   printf("Usage: shallot [-dmpv] [-f <file>] [-t count] [-e limit] pattern\n"
          "  -d        : Daemonize (requires -f)\n"
@@ -17,7 +17,7 @@
          "  -f <file> : Write output to <file>\n"
          "  -t count  : Forces exactly count threads to be spawned\n"
          "  -e limit  : Manually define the limit for e\n"
-         "Version: %s\n", VERSION);
+         "Version: %s\n", SHALLOT_VERSION);
   exit(X_WRONG_NUMARGS);
 }
 
@@ -34,11 +34,12 @@
   exit(X_WRONG_NUMARGS);
 }
 
-// our big error handling/reporting function
+/* our big error handling/reporting function*/
 void error(int32_t code) {
   switch(code) {
     case X_REGEX_COMPILE: {
-      fprintf(stderr, "ERROR: Bad pattern.  Try again with something else!\n");
+      fprintf(stderr, "ERROR: Bad pattern.  Try again with something "
+              "else!\n");
       break;
     }
 
@@ -54,7 +55,8 @@
     }
 
     case X_YOURE_UNLUCKY: {
-      fprintf(stderr, "\nERROR: You happened to find a bad key - congrats.\n");
+      fprintf(stderr, "\nERROR: You happened to find a bad key - "
+              "congrats.\n");
       break;
     }
 
@@ -126,7 +128,7 @@
       fprintf(stderr, "Generic error.  You should never see this...\n");
       break;
     }
-  } // end switch
+  } /* end switch*/
 
   exit(code);
 }
Only in ./src: error.c~
diff -u /home/robert/downloads/shallot-0.0.2/src/error.h ./src/error.h
--- /home/robert/downloads/shallot-0.0.2/src/error.h	2007-03-03 00:48:45.000000000 +0000
+++ ./src/error.h	2008-03-19 20:27:49.000000000 +0000
@@ -3,9 +3,11 @@
 
 #include "config.h"
 
+ 
+
 #include <stdint.h>
 
-// error codes
+/* error codes*/
 #define X_WRONG_NUMARGS 0x01
 #define X_REGEX_COMPILE 0x02
 #define X_REGEX_INVALID 0x03
@@ -22,10 +24,10 @@
 #define X_DAEMON_FAILED 0x0E
 
 #ifdef BSD
-  // BSD specific defines
+  /* BSD specific defines*/
   #define X_SYSCTL_FAILED 0x0F
 #elif defined(LINUX_PORT)
-  // Linux specific defines
+  /* Linux specific defines*/
   #define X_BAD_FILE_DESC 0x0F
   #define X_ABNORMAL_READ 0x10
 #endif
Only in ./src: error.h~
diff -u /home/robert/downloads/shallot-0.0.2/src/globals.h ./src/globals.h
--- /home/robert/downloads/shallot-0.0.2/src/globals.h	2007-02-24 03:28:05.000000000 +0000
+++ ./src/globals.h	2008-03-19 20:27:50.000000000 +0000
@@ -3,13 +3,15 @@
 
 #include "config.h"
 
+ 
+
 #include <regex.h>
 #include <stdint.h>
 #include <pthread.h>
 
-// global variables (saves us the trouble of passing pointers around)
-// TODO: stop being lazy and pass this stuff where it's needed
-// TODO: also put settings in a struct
+/* global variables (saves us the trouble of passing pointers around)*/
+/* TODO: stop being lazy and pass this stuff where it's needed*/
+/* TODO: also put settings in a struct*/
 uint64_t loop, elim;
 uint8_t found, verbose, monitor;
 pthread_t lucky_thread;
Only in ./src: globals.h~
diff -u /home/robert/downloads/shallot-0.0.2/src/linux.c ./src/linux.c
--- /home/robert/downloads/shallot-0.0.2/src/linux.c	2007-03-03 05:07:18.000000000 +0000
+++ ./src/linux.c	2008-03-19 20:18:39.000000000 +0000
@@ -1,4 +1,4 @@
-// linux specific stuff for shallot
+/* linux specific stuff for shallot*/
 
 #include "linux.h"
 
@@ -13,7 +13,7 @@
 #include <netinet/in.h>
 #endif
 
-// why must glibc suck?
+/* why must glibc suck?*/
 #if BYTE_ORDER == BIG_ENDIAN
 #warning Compiling for a BIG_ENDIAN system.
 #define htobe64(x) (x)
@@ -25,12 +25,12 @@
 #else
   #error Sell your PDP.
 #endif
-#endif // defined(LINUX_PORT) || defined(OSX)
+#endif /* defined(LINUX_PORT) || defined(OSX)*/
 
 #ifdef LINUX_PORT
 #include <string.h>
 
-// Linux specific stuff (damn this is ugly code.  blame linus.)
+/* Linux specific stuff (damn this is ugly code.  blame linus.)*/
 uint8_t parse_cpuinfo(char *buf, uint16_t avail, uint16_t *used) {
   uint16_t x = 0;
   char procsfound = 0;
@@ -53,7 +53,8 @@
   *used = x;
 
   if(!x)
-    return 0; // prevent the next if statement from causing a buffer overflow
+    return 0; /* prevent the next if statement from causing a buffer
+                 overflow*/
 
   if((x == avail) && (buf[x - 1] != '\n'))
     skip = 1;
Only in ./src: linux.c~
diff -u /home/robert/downloads/shallot-0.0.2/src/linux.h ./src/linux.h
--- /home/robert/downloads/shallot-0.0.2/src/linux.h	2007-03-02 20:39:32.000000000 +0000
+++ ./src/linux.h	2008-03-19 20:27:50.000000000 +0000
@@ -3,6 +3,8 @@
 
 #include "config.h"
 
+ 
+
 #if defined(LINUX_PORT) || defined(OSX) || defined(GENERIC)
 #include <stdint.h>
 uint64_t htobe64(uint64_t x);
Only in ./src: linux.h~
diff -u /home/robert/downloads/shallot-0.0.2/src/math.c ./src/math.c
--- /home/robert/downloads/shallot-0.0.2/src/math.c	2007-02-24 02:18:26.000000000 +0000
+++ ./src/math.c	2008-03-19 20:19:16.000000000 +0000
@@ -1,15 +1,15 @@
-// custom math routines for shallot
+/* custom math routines for shallot*/
 
 #include "math.h"
 
-void int_pow(uint32_t base, uint8_t pwr, uint64_t *out) { // integer pow()
+void int_pow(uint32_t base, uint8_t pwr, uint64_t *out) { /* integer pow()*/
   *out = (uint64_t)base;
   uint8_t round = 1;
   for(; round < pwr; round++)
     *out *= base;
 }
 
-// LCM for BIGNUMs
+/* LCM for BIGNUMs*/
 uint8_t BN_lcm(BIGNUM *r, BIGNUM *a, BIGNUM *b, BIGNUM *gcd, BN_CTX *ctx) {
   BIGNUM *tmp = BN_CTX_get(ctx);
   if(!BN_div(tmp, NULL, a, gcd, ctx))
@@ -19,40 +19,41 @@
   return 1;
 }
 
-uint8_t sane_key(RSA *rsa) { // checks sanity of a RSA key (PKCS#1 v2.1)
+uint8_t sane_key(RSA *rsa) { /* checks sanity of a RSA key (PKCS#1 v2.1)*/
   uint8_t sane = 1;
 
   BN_CTX *ctx = BN_CTX_new();
   BN_CTX_start(ctx);
-  BIGNUM *p1     = BN_CTX_get(ctx), // p - 1
-         *q1     = BN_CTX_get(ctx), // q - 1
-         *chk    = BN_CTX_get(ctx), // storage to run checks with
-         *gcd    = BN_CTX_get(ctx), // GCD(p - 1, q - 1)
-         *lambda = BN_CTX_get(ctx); // LCM(p - 1, q - 1)
-
-  BN_sub(p1, rsa->p, BN_value_one()); // p - 1
-  BN_sub(q1, rsa->q, BN_value_one()); // q - 1
-  BN_gcd(gcd, p1, q1, ctx);           // gcd(p - 1, q - 1)
-  BN_lcm(lambda, p1, q1, gcd, ctx);   // lamba(n)
+  BIGNUM *p1     = BN_CTX_get(ctx), /* p - 1*/
+         *q1     = BN_CTX_get(ctx), /* q - 1*/
+         *chk    = BN_CTX_get(ctx), /* storage to run checks with*/
+         *gcd    = BN_CTX_get(ctx), /* GCD(p - 1, q - 1)*/
+         *lambda = BN_CTX_get(ctx); /* LCM(p - 1, q - 1)*/
+
+  BN_sub(p1, rsa->p, BN_value_one()); /* p - 1*/
+  BN_sub(q1, rsa->q, BN_value_one()); /* q - 1*/
+  BN_gcd(gcd, p1, q1, ctx);           /* gcd(p - 1, q - 1)*/
+  BN_lcm(lambda, p1, q1, gcd, ctx);   /* lamba(n)*/
 
-  BN_gcd(chk, lambda, rsa->e, ctx); // check if e is coprime to lambda(n)
+  BN_gcd(chk, lambda, rsa->e, ctx); /* check if e is coprime to lambda(n)*/
   if(!BN_is_one(chk))
     sane = 0;
 
-  // check if public exponent e is less than n - 1
-  BN_sub(chk, rsa->e, rsa->n); // subtract n from e to avoid checking BN_is_zero
+  /* check if public exponent e is less than n - 1*/
+  BN_sub(chk, rsa->e, rsa->n); /* subtract n from e to avoid checking
+                                  BN_is_zero*/
   if(!chk->neg)
     sane = 0;
 
-  BN_mod_inverse(rsa->d, rsa->e, lambda, ctx);    // d
-  BN_mod(rsa->dmp1, rsa->d, p1, ctx);             // d mod (p - 1)
-  BN_mod(rsa->dmq1, rsa->d, q1, ctx);             // d mod (q - 1)
-  BN_mod_inverse(rsa->iqmp, rsa->q, rsa->p, ctx); // q ^ -1 mod p
+  BN_mod_inverse(rsa->d, rsa->e, lambda, ctx);    /* d*/
+  BN_mod(rsa->dmp1, rsa->d, p1, ctx);             /* d mod (p - 1)*/
+  BN_mod(rsa->dmq1, rsa->d, q1, ctx);             /* d mod (q - 1)*/
+  BN_mod_inverse(rsa->iqmp, rsa->q, rsa->p, ctx); /* q ^ -1 mod p*/
   BN_CTX_end(ctx);
   BN_CTX_free(ctx);
 
-  // this is excessive but you're better off safe than (very) sorry
-  // in theory this should never be true unless I made a mistake ;)
+  /* this is excessive but you're better off safe than (very) sorry*/
+  /* in theory this should never be true unless I made a mistake ;)*/
   if((RSA_check_key(rsa) != 1) && sane) {
     fprintf(stderr, "WARNING: Key looked okay, but OpenSSL says otherwise!\n");
     sane = 0;
Only in ./src: math.c~
diff -u /home/robert/downloads/shallot-0.0.2/src/math.h ./src/math.h
--- /home/robert/downloads/shallot-0.0.2/src/math.h	2007-02-24 08:13:01.000000000 +0000
+++ ./src/math.h	2008-03-19 20:27:50.000000000 +0000
@@ -3,7 +3,9 @@
 
 #include "config.h"
 
-// check config - include in first file including config
+ 
+
+/* check config - include in first file including config*/
 #ifdef BSD
   #ifdef LINUX_PORT
     #error BSD and LINUX_PORT defined.
Only in ./src: math.h~
diff -u /home/robert/downloads/shallot-0.0.2/src/print.c ./src/print.c
--- /home/robert/downloads/shallot-0.0.2/src/print.c	2007-03-02 21:02:56.000000000 +0000
+++ ./src/print.c	2008-03-19 20:27:50.000000000 +0000
@@ -1,7 +1,9 @@
-// printing functions for shallot
+/* printing functions for shallot*/
 
 #include "config.h"
 
+ 
+
 #include "print.h"
 #include "defines.h"
 #include "globals.h"
@@ -10,7 +12,7 @@
 #include <string.h>
 #include <openssl/pem.h>
 
-void base32_onion(char *dst, unsigned char *src) { // base32 encode hash
+void base32_onion(char *dst, unsigned char *src) { /* base32 encode hash*/
   uint16_t i, bit, v, u;
   for(i = 0, bit = 0; bit < BASE32_NUM_BITS; ++i, bit += 5) {
     v = ((uint8_t)src[bit/8]) << 8;
@@ -21,7 +23,7 @@
   dst[i] = '\0';
 }
 
-void print_onion(char *onion) { // pretty print hash
+void print_onion(char *onion) { /* pretty print hash*/
   uint8_t i;
   char *s;
   #ifdef GENERIC
@@ -31,15 +33,15 @@
   asprintf(&s, PRINT_ONION_STR, loop, onion);
   #endif
   for(i=0; i<strlen(s); i++)
-    printf("-"); // TODO: use fputc()?
+    printf("-"); /* TODO: use fputc()?*/
   printf("\n%s\n", s);
   for(i=0; i<strlen(s); i++)
-    printf("-"); // TODO: use fputc()?
+    printf("-"); /* TODO: use fputc()?*/
   printf("\n");
   free(s);
 }
 
-void print_prkey(RSA *rsa) { // print PEM formated RSA key
+void print_prkey(RSA *rsa) { /* print PEM formated RSA key*/
   BUF_MEM *buf;
   BIO *b = BIO_new(BIO_s_mem());
   PEM_write_bio_RSAPrivateKey(b, rsa, NULL, NULL, 0, NULL, NULL);
Only in ./src: print.c~
diff -u /home/robert/downloads/shallot-0.0.2/src/shallot.c ./src/shallot.c
--- /home/robert/downloads/shallot-0.0.2/src/shallot.c	2007-03-03 00:46:58.000000000 +0000
+++ ./src/shallot.c	2008-03-19 20:28:07.000000000 +0000
@@ -31,6 +31,7 @@
 
 #include "config.h"
 
+
 #include "math.h"
 #include "error.h"
 #include "print.h"
@@ -39,16 +40,16 @@
 #include "globals.h"
 
 #ifdef LINUX_PORT
-// Linux specific headers
+/* Linux specific headers*/
 #include "linux.h"
 #include <fcntl.h>
-#include <string.h> // included with something else on *BSD
+#include <string.h> /* included with something else on *BSD*/
 #include <sys/uio.h>
 #endif
 
 #ifdef BSD
-// BSD specific headers
-#include <sys/param.h> // needed on OpenBSD
+/* BSD specific headers*/
+#include <sys/param.h> /* needed on OpenBSD*/
 #include <sys/sysctl.h>
 #endif
 
@@ -56,19 +57,21 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
-void terminate(int signum) { // Ctrl-C/kill handler
+
+static void terminate() { /* Ctrl-C/kill handler*/
   error(X_SGNL_INT_TERM);
 }
 
-int main(int argc, char *argv[]) { // onions are fun, here we go
-  signal(SIGTERM, terminate); // always let people kill
+int main(int argc, char *argv[]) { /* onions are fun, here we go*/
+  signal(SIGTERM, terminate); /* always let people kill*/
 
-  if(argc < 2) // not enough arguments
+  if(argc < 2) /* not enough arguments*/
     usage();
 
-  // set up our initial values
-  uint8_t daemon = 0;
-  uint32_t threads = 1, x = 1;
+  /* set up our initial values*/
+  uint8_t shallot_daemon = 0;
+  uint32_t threads = 1, threadcnt = 1;
+  int32_t x = 1;
   char *file = 0;
   elim = DEFAULT_E_LIMIT;
   loop = 0;
@@ -76,47 +79,48 @@
   verbose = 0;
   monitor = 0;
 
-  #ifdef BSD                                   // my
-  int mib[2] = { CTL_HW, HW_NCPU };            // how
-  size_t size = sizeof(threads);               // easy
-  if(sysctl(mib, 2, &threads, &size, NULL, 0)) // BSD
-    error(X_SYSCTL_FAILED);                    // is
-
-  #elif defined(LINUX_PORT) // Oh no!  We're on linux... :(
-  // ...even *Windows 95* (gasp!) has a better way of doing this...
-  // TODO: move this to linux.c
+  #ifdef BSD                                   /* my*/
+  int mib[2] = { CTL_HW, HW_NCPU };            /* how*/
+  size_t size = sizeof(threads);               /* easy*/
+  if(sysctl(mib, 2, &threads, &size, NULL, 0)) /* BSD*/
+    error(X_SYSCTL_FAILED);                    /* is*/
+
+  #elif defined(LINUX_PORT) /* Oh no!  We're on linux... :(*/
+  /* ...even *Windows 95* (gasp!) has a better way of doing this...*/
+  /* TODO: move this to linux.c*/
   char cpuinfo[CPUINFO_BUF_SIZE] = "";
   int fd = open(CPUINFO_PATH, O_RDONLY);
 
   if(fd < 0)
     error(X_BAD_FILE_DESC);
 
-  threads--; // reset threads to 0
+  threads--; /* reset threads to 0*/
   size_t r = 0;
-  ssize_t tmp = 1; // must not initially be 0!
+  ssize_t tmp = 1; /* must not initially be 0!*/
   uint16_t used = 0;
 
   do {
     if(tmp)
-      tmp = read(fd, &cpuinfo[r], CPUINFO_BUF_SIZE - r); // fill the buffer
+      tmp = read(fd, &cpuinfo[r], CPUINFO_BUF_SIZE - r); /* fill the
+                                                            buffer*/
 
-    if(tmp < 0) // something went wrong
+    if(tmp < 0) /* something went wrong*/
       error(X_ABNORMAL_READ);
 
-    r += tmp; // add how much we read
+    r += tmp; /* add how much we read*/
 
     if(r < CPUINFO_BUF_SIZE)
       cpuinfo[r] = 0;
 
     threads += parse_cpuinfo(&cpuinfo[0], (uint16_t)r, &used);
-    r -= used; // subtract what we parsed
+    r -= used; /* subtract what we parsed*/
 
     memmove(&cpuinfo[0], &cpuinfo[used], r);
   } while(used > 0);
 
-  close(fd); // TODO: add error handling! (is there any point?)
+  close(fd); /* TODO: add error handling! (is there any point?)*/
 
-  if(!threads) { // This is needed for Liunx/ARM (do not remove!)
+  if(!threads) { /* This is needed for Liunx/ARM (do not remove!)*/
     printf("WARNING: No CPUs detected.  Defaulting to 1 thread... "
            "(or manually specify thread count with -t)\n");
     threads++;
@@ -126,7 +130,7 @@
   printf("WARNING: Threads will default to 1 unless specified with -t\n");
   #endif
 
-  for(; x < argc - 1; x++) { // options parsing
+  for(; x < argc - 1; x++) { /* options parsing*/
     if(argv[x][0] != '-') {
       fprintf(stderr, "Error: Options must start with '-'\n");
       usage();
@@ -135,23 +139,23 @@
     for(; argv[x][y] != '\0'; y++) {
       uint8_t dbreak = 0;
       switch(argv[x][y]) {
-        case 'd': { // daemonize
-          daemon = 1;
+        case 'd': { /* daemonize*/
+          shallot_daemon = 1;
           break;
         }
-        case 'm': { // monitor
+        case 'm': { /* monitor*/
           monitor = 1;
           break;
         }
-        case 'p': { // pattern help
+        case 'p': { /* pattern help*/
           pattern();
           break;
         }
-        case 'v': { // verbose
+        case 'v': { /* verbose*/
           verbose = 1;
           break;
         }
-        case 'f': { // file <file>
+        case 'f': { /* file <file>*/
           if((argv[x][y + 1] != '\0') || (x + 1 > argc)) {
             fprintf(stderr, "Error: -f format is '-f <file>'\n");
             usage();
@@ -160,7 +164,7 @@
           dbreak = 1;
           break;
         }
-        case 't': { // threads
+        case 't': { /* threads*/
           if((argv[x][y + 1] != '\0') || (x + 1 > argc)) {
             fprintf(stderr, "Error: -t format is '-t threads'\n");
             usage();
@@ -169,7 +173,7 @@
           dbreak = 1;
           break;
         }
-        case 'e': { // e limit
+        case 'e': { /* e limit*/
           if((argv[x][y + 1] != '\0') || (x + 1 > argc)) {
             fprintf(stderr, "Error: -e format is '-e limit'\n");
             usage();
@@ -178,20 +182,20 @@
           dbreak = 1;
           break;
         }
-        default: { // unrecognized
+        default: { /* unrecognized*/
           fprintf(stderr, "Error: Unrecognized option - '%c'\n", argv[x][y]);
           usage();
-          break; // redundant... but safe :)
+          break; /* redundant... but safe :)*/
         }
       }
       if(dbreak) {
-        x++; //skip the next param
+        x++; /*skip the next param*/
         break;
       }
     }
   }
 
-  // now for our sanity checks
+  /* now for our sanity checks*/
   if(threads < 1)
     error(X_INVALID_THRDS);
 
@@ -201,21 +205,21 @@
   if(!(elim & 1) || (elim < RSA_PK_EXPONENT) || (elim > MAXIMUM_E_LIMIT))
     error(X_INVALID_E_LIM);
 
-  if(daemon && !file)
+  if(shallot_daemon && !file)
     error(X_NEED_FILE_OUT);
 
   if(verbose)
     printf("Options parsed successfully.\nCompiling regex...\n");
 
-  // compile regular expression from argument
-  char *pattern = argv[argc - 1];
+  /* compile regular expression from argument*/
+  char *regex_pattern = argv[argc - 1];
 
-  if(*pattern == '-')
+  if(*regex_pattern == '-')
     error(X_REGEX_INVALID);
 
   regex = malloc(REGEX_COMP_LMAX);
 
-  if(regcomp(regex, pattern, REG_EXTENDED | REG_NOSUB))
+  if(regcomp(regex, regex_pattern, REG_EXTENDED | REG_NOSUB))
     error(X_REGEX_COMPILE);
 
   if(verbose)
@@ -225,34 +229,34 @@
     if(verbose)
       printf("Redirecting output to file...\n");
 
-    umask(077); // remove permissions to be safe
+    umask(077); /* remove permissions to be safe*/
 
-    // redirect output
+    /* redirect output*/
     freopen(file, "w", stdout);
     freopen(file, "w", stderr);
   }
 
-  if(daemon && (getppid() != 1)) { // daemonize if we should
+  if(shallot_daemon && (getppid() != 1)) { /* daemonize if we should*/
     if(verbose)
       printf("Daemonizing...\n");
 
     pid_t pid = fork();
 
-    if(pid < 0) // fork failed
+    if(pid < 0) /* fork failed*/
       error(X_DAEMON_FAILED);
 
-    if(pid) // exit on the parent process
+    if(pid) /* exit on the parent process*/
       exit(0);
 
-    if(setsid() < 0) // get a new SID
+    if(setsid() < 0) /* get a new SID*/
       error(X_DAEMON_FAILED);
 
-    if(chdir("/") < 0) // cd to root
+    if(chdir("/") < 0) /* cd to root*/
       error(X_DAEMON_FAILED);
 
-    freopen("/dev/null", "r", stdin); // block input
+    freopen("/dev/null", "r", stdin); /* block input*/
 
-    // ignore certain signals
+    /* ignore certain signals*/
     signal(SIGCHLD, SIG_IGN);
     signal(SIGTSTP, SIG_IGN);
     signal(SIGTTOU, SIG_IGN);
@@ -261,24 +265,24 @@
 
     if(verbose)
       printf("Daemonization completed successfully!\n");
-  } else signal(SIGINT, terminate); // die on CTRL-C
+  } else signal(SIGINT, terminate); /* die on CTRL-C*/
 
   pthread_t thrd;
 
   if(verbose)
     printf("Spawning threads... (Total: %u)\n", threads);
 
-  // create our threads for 2+ cores
-  for(x = 1; x < threads; x++) {
+  /* create our threads for 2+ cores*/
+  for(threadcnt = 1; threadcnt < threads; threadcnt++) {
     if(verbose)
-      printf("Additional thread spawning (%u)...\n", x);
+      printf("Additional thread spawning (%u)...\n", threadcnt);
 
     if(pthread_create(&thrd, NULL, worker, NULL))
       error(X_THREAD_CREATE);
   }
 
   if(monitor) {
-    // TODO: when support is added for -mv, put a message here
+    /* TODO: when support is added for -mv, put a message here*/
     if(pthread_create(&thrd, NULL, monitor_proc, NULL))
       error(X_THREAD_CREATE);
   }
@@ -288,14 +292,14 @@
            "Main thread (ID: 0x%X) entering loop...\n",
            (uint32_t)pthread_self());
 
-  worker(NULL); // use main thread for brute forcing too
+  worker(NULL); /* use main thread for brute forcing too*/
 
-  if(pthread_self() != lucky_thread) { // be safe and avoid EDEADLK
+  if(pthread_self() != lucky_thread) { /* be safe and avoid EDEADLK*/
     if(verbose)
       printf("Main thread waiting on lucky thread (ID: 0x%X) to exit...\n",
              (uint32_t)lucky_thread);
 
-    pthread_join(lucky_thread, NULL); // wait for the lucky thread to exit
+    pthread_join(lucky_thread, NULL); /* wait for the lucky thread to exit*/
   }
 
   if(verbose)
Only in ./src: shallot.c~
diff -u /home/robert/downloads/shallot-0.0.2/src/thread.c ./src/thread.c
--- /home/robert/downloads/shallot-0.0.2/src/thread.c	2007-03-10 08:39:17.000000000 +0000
+++ ./src/thread.c	2008-03-19 20:27:50.000000000 +0000
@@ -1,13 +1,15 @@
-// thread procs for shallot
+/* thread procs for shallot*/
 
 #include "config.h"
 
-#include <stdint.h> // OpenBSD needs this included before sys/endian.h
+ 
+
+#include <stdint.h> /* OpenBSD needs this included before sys/endian.h*/
 
 #if defined(LINUX_PORT) || defined(OSX) || defined(GENERIC)
   #include "linux.h"
 #else
-  #include <sys/param.h> // OpenBSD needs this early on too
+  #include <sys/param.h> /* OpenBSD needs this early on too*/
   #include <sys/endian.h>
 #endif
 
@@ -24,9 +26,9 @@
 #include <openssl/rsa.h>
 #include <openssl/sha.h>
 
-void *worker(void *unused) { // life cycle of a cracking pthread
+void *worker(void *unused) { /* life cycle of a cracking pthread*/
   uint16_t len;
-  uint64_t e_be; // storage for our "big endian" version of e
+  uint64_t e_be; /* storage for our "big endian" version of e*/
   uint8_t buf[SHA1_DIGEST_LEN],
           der[RSA_KEYS_BITLEN];
   char onion[BASE32_ONIONLEN];
@@ -37,25 +39,26 @@
     printf("Thread entering loop... (ID: 0x%X)\n", (uint32_t)pthread_self());
 
   while(!found) {
-    // keys are only generated every so often
-    // every 549,755,781,120 tries by default
+    /* keys are only generated every so often*/
+    /* every 549,755,781,120 tries by default*/
     if(verbose)
       printf("Generating new key... (ID: 0x%X)\n", (uint32_t)pthread_self());
 
     rsa = RSA_generate_key(RSA_KEYS_BITLEN, RSA_PK_EXPONENT, NULL, NULL);
-    if(!rsa) // if key generation fails (no prng seed?)
+    if(!rsa) /* if key generation fails (no prng seed?)*/
       error(X_KEY_GEN_FAILS);
 
     uint8_t *tmp = der;
-    len = i2d_RSAPublicKey(rsa, &tmp); // convert RSA key to X.690 DER format
-    if(len != RSA_EXP_DER_LEN) // if we got an unexpected length...
-      continue; // ...try again
+    len = i2d_RSAPublicKey(rsa, &tmp); /* convert RSA key to X.690 DER
+                                          format*/
+    if(len != RSA_EXP_DER_LEN) /* if we got an unexpected length...*/
+      continue; /* ...try again*/
 
-    uint8_t e_bytes = RSA_PK_E_LENGTH; // number of bytes e occupies
-    uint64_t e = RSA_PK_EXPONENT; // public exponent
+    uint8_t e_bytes = RSA_PK_E_LENGTH; /* number of bytes e occupies*/
+    uint64_t e = RSA_PK_EXPONENT; /* public exponent*/
     uint64_t e_byte_thresh;
 
-    SHA1_Init(&hash); // TODO: move to a function (is that thread safe?)
+    SHA1_Init(&hash); /* TODO: move to a function (is that thread safe?)*/
     SHA1_Update(&hash, der, RSA_REL_DER_LEN);
 
     int_pow(2, e_bytes * 8, &e_byte_thresh);
@@ -63,46 +66,48 @@
 
     uint8_t *e_ptr = ((uint8_t*)&e_be) + 8 - e_bytes;
 
-    while((e <= elim) && !found) { // main loop
-      // copy the relevant parts of our already set up context
-      memcpy(&copy, &hash, SHA_REL_CTX_LEN); // 40 bytes here...
-      copy.num = hash.num;                   // and don't forget the num (9)
+    while((e <= elim) && !found) { /* main loop*/
+      /* copy the relevant parts of our already set up context*/
+      memcpy(&copy, &hash, SHA_REL_CTX_LEN); /* 40 bytes here...*/
+      copy.num = hash.num;                   /* and don't forget the num
+                                                (9)*/
 
-      // convert e to big-endian format
+      /* convert e to big-endian format*/
       e_be = htobe64(e);
 
-      // compute SHA1 digest (majority of loop time spent here?  time it!)
+      /* compute SHA1 digest (majority of loop time spent here?  time it!)*/
       SHA1_Update(&copy, e_ptr, e_bytes);
       SHA1_Final(buf, &copy);
 
-      base32_onion(onion, buf); // base32 encode SHA1 digest
-      loop++; // keep track of our tries...
+      base32_onion(onion, buf); /* base32 encode SHA1 digest*/
+      loop++; /* keep track of our tries...*/
 
-      if(!regexec(regex, onion, 0, 0, 0)) { // check for a match
+      if(!regexec(regex, onion, 0, 0, 0)) { /* check for a match*/
         if(verbose)
           printf("Matching hash found, killing off other threads..."
                  " (ID: 0x%X)\n", (uint32_t)pthread_self());
 
-        // let our main thread know on which thread to wait
+        /* let our main thread know on which thread to wait*/
         lucky_thread = pthread_self();
-        found = 1; // kill off our other threads, asyncronously
+        found = 1; /* kill off our other threads, asyncronously*/
 
         if(monitor)
-          printf("\n"); // keep our printing pretty!
+          printf("\n"); /* keep our printing pretty!*/
 
-        if(!BN_bin2bn(e_ptr, e_bytes, rsa->e)) // store our e in the actual key
-          error(X_BIGNUM_FAILED); // and make sure it got there
+        if(!BN_bin2bn(e_ptr, e_bytes, rsa->e)) /* store our e in the actual
+                                                  key*/
+          error(X_BIGNUM_FAILED); /* and make sure it got there*/
 
-        if(!sane_key(rsa)) // check our key
-          error(X_YOURE_UNLUCKY); // bad key :(
+        if(!sane_key(rsa)) /* check our key*/
+          error(X_YOURE_UNLUCKY); /* bad key :(*/
 
         if(verbose)
           printf("Public exponent (e) is 0x%llX.\n", e);
 
-        print_onion(onion); // print our domain
-        print_prkey(rsa); // and more importantly the key
+        print_onion(onion); /* print our domain*/
+        print_prkey(rsa); /* and more importantly the key*/
 
-        RSA_free(rsa); // free up what's left
+        RSA_free(rsa); /* free up what's left*/
 
         if(verbose)
           printf("Thread exiting loop... (ID: 0x%X)\n",
@@ -111,27 +116,28 @@
         return 0;
       }
 
-      e += 2; // do *** NOT *** forget this!
+      e += 2; /* do *** NOT *** forget this!*/
 
-      if(e == e_byte_thresh) { // ASN.1 stuff (hey, it could be worse!)
-        // calculate our new threshold
+      if(e == e_byte_thresh) { /* ASN.1 stuff (hey, it could be worse!)*/
+        /* calculate our new threshold*/
         int_pow(2, ++e_bytes * 8, &e_byte_thresh);
         e_byte_thresh++;
 
-        // play with our key structure (do not try this at home!)
+        /* play with our key structure (do not try this at home!)*/
         der[RSA_ADD_DER_OFF]++;
         der[RSA_REL_DER_LEN - 1]++;
 
-        // and our prebuilt hash
-        SHA1_Init(&hash); // TODO: move to a function (is that thread safe?)
+        /* and our prebuilt hash*/
+        SHA1_Init(&hash); /* TODO: move to a function (is that thread
+                             safe?)*/
         SHA1_Update(&hash, der, RSA_REL_DER_LEN);
 
-        e_ptr--; // and move the pointer back
+        e_ptr--; /* and move the pointer back*/
       }
     }
   }
 
-  if(rsa) // let our other threads free their (now useless) stuff
+  if(rsa) /* let our other threads free their (now useless) stuff*/
     RSA_free(rsa);
 
   if(verbose)
@@ -145,7 +151,7 @@
   time_t start = time(NULL);
 
   for(;;) {
-    fflush(stdout); // make sure it gets printed
+    fflush(stdout); /* make sure it gets printed*/
     sleep(20);
 
     if(found)
@@ -155,12 +161,12 @@
     time_t elapsed = current - start;
 
     if(!elapsed)
-      continue; // be paranoid and avoid divide-by-zero exceptions
+      continue; /* be paranoid and avoid divide-by-zero exceptions*/
 
     printf("\033[u\033[KHashes: %-20llu  Time: %-10d  Speed: %-llu",
            loop, (int)elapsed, loop / elapsed);
   }
 
-  return 0; // unreachable code, but prevents warnings (!?)
+  return 0; /* unreachable code, but prevents warnings (!?)*/
 }
 
Only in ./src: thread.c~
Only in ./src: thread.h~