diff --git a/src/bench.c b/src/bench.c index 65035c5b7..65b68d4e4 100644 --- a/src/bench.c +++ b/src/bench.c @@ -305,7 +305,7 @@ char *benchmark_format(struct fmt_main *format, int salts, clock_t start_virtual, end_virtual; struct tms buf; #endif - int64 crypts; + jtrint64 crypts; char *ciphertext; void *salt, *two_salts[2]; int index, max, i; @@ -588,7 +588,7 @@ char *benchmark_format(struct fmt_main *format, int salts, return event_abort ? "" : NULL; } -void benchmark_cps(int64 *crypts, clock_t time, char *buffer) +void benchmark_cps(jtrint64 *crypts, clock_t time, char *buffer) { unsigned long long cps; diff --git a/src/bench.h b/src/bench.h index 7b002d1ae..722b43f28 100644 --- a/src/bench.h +++ b/src/bench.h @@ -29,7 +29,7 @@ struct bench_results { clock_t real, virtual; /* Number of ciphertexts computed */ - int64 crypts; + jtrint64 crypts; /* Number of salts actually tested */ int salts_done; @@ -63,7 +63,7 @@ extern char *benchmark_format(struct fmt_main *format, int salts, /* * Converts benchmarked c/s into an ASCII string. */ -extern void benchmark_cps(int64 *crypts, clock_t time, char *buffer); +extern void benchmark_cps(jtrint64 *crypts, clock_t time, char *buffer); /* * Benchmarks all the registered cracking algorithms and prints the results diff --git a/src/best.c b/src/best.c index ddb6ad7a1..838b34efa 100644 --- a/src/best.c +++ b/src/best.c @@ -38,7 +38,7 @@ int main(int argc, char **argv) struct fmt_main *format; struct bench_results results; unsigned long virtual; - int64 tmp; + jtrint64 tmp; char s_real[64], s_virtual[64]; if (argc != 2) return 1; diff --git a/src/cracker.c b/src/cracker.c index 77d3ddcf6..eaeaba4c3 100644 --- a/src/cracker.c +++ b/src/cracker.c @@ -93,7 +93,7 @@ static int crk_key_index, crk_last_key; static void *crk_last_salt; void (*crk_fix_state)(void); static struct db_keys *crk_guesses; -static int64 *crk_timestamps; +static jtrint64 *crk_timestamps; static char crk_stdout_key[PLAINTEXT_BUFFER_SIZE]; int64_t crk_pot_pos; @@ -208,8 +208,8 @@ void crk_init(struct db_main *db, void (*fix_state)(void), crk_guesses = guesses; if (db->loaded) { - size = crk_params.max_keys_per_crypt * sizeof(int64); - memset(crk_timestamps = mem_alloc_tiny(size, sizeof(int64)), + size = crk_params.max_keys_per_crypt * sizeof(jtrint64); + memset(crk_timestamps = mem_alloc_tiny(size, sizeof(jtrint64)), -1, size); } else crk_stdout_key[0] = 0; @@ -341,7 +341,7 @@ static int crk_process_guess(struct db_salt *salt, struct db_password *pw, if (index >= 0 && index < crk_params.max_keys_per_crypt) { dupe = !memcmp(&crk_timestamps[index], - &status.crypts, sizeof(int64)); + &status.crypts, sizeof(jtrint64)); crk_timestamps[index] = status.crypts; } else dupe = 0; @@ -827,7 +827,7 @@ static int crk_password_loop(struct db_salt *salt) crk_last_key = count; { - int64 effective_count; + jtrint64 effective_count; mul32by32(&effective_count, salt->count, count); status_update_crypts(&effective_count, count); } @@ -1003,7 +1003,7 @@ static int crk_salt_loop(void) mask_int_cand.num_int_cand); #else /* Safe for > 4G crypts per call */ - int64 totcand; + jtrint64 totcand; mul32by32(&totcand, crk_key_index, mask_int_cand.num_int_cand); add64to64(&status.cands, &totcand); #endif diff --git a/src/math.c b/src/math.c index e9096e417..7d44ebce0 100644 --- a/src/math.c +++ b/src/math.c @@ -12,7 +12,7 @@ #include "math.h" #include "memdbg.h" -void add32to64(int64 *dst, unsigned int src) +void add32to64(jtrint64 *dst, unsigned int src) { unsigned int saved; @@ -26,19 +26,19 @@ void add32to64(int64 *dst, unsigned int src) if (dst->lo < saved) dst->hi++; } -void add64to64(int64 *dst, int64 *src) +void add64to64(jtrint64 *dst, jtrint64 *src) { add32to64(dst, src->lo); dst->hi += src->hi; } -void neg64(int64 *dst) +void neg64(jtrint64 *dst) { dst->lo = ~dst->lo; dst->hi = ~dst->hi; add32to64(dst, 1); } -static void add32to64m(int64 *dst, unsigned int a) +static void add32to64m(jtrint64 *dst, unsigned int a) { unsigned int saved; @@ -52,7 +52,7 @@ static void add32to64m(int64 *dst, unsigned int a) dst->hi += ((dst->lo < saved) ? 1 : 0) + (a >> 16); } -void mul32by32(int64 *dst, unsigned int m1, unsigned int m2) +void mul32by32(jtrint64 *dst, unsigned int m1, unsigned int m2) { dst->lo = (m1 & 0xFFFF) * (m2 & 0xFFFF); dst->hi = 0; @@ -63,9 +63,9 @@ void mul32by32(int64 *dst, unsigned int m1, unsigned int m2) dst->hi += (m1 >> 16) * (m2 >> 16); } -void mul64by32(int64 *dst, unsigned int m) +void mul64by32(jtrint64 *dst, unsigned int m) { - int64 tmp; + jtrint64 tmp; mul32by32(&tmp, dst->hi, m); dst->hi = tmp.lo; @@ -74,7 +74,7 @@ void mul64by32(int64 *dst, unsigned int m) dst->hi += tmp.hi; } -unsigned int div64by32lo(int64 *src, unsigned int d) +unsigned int div64by32lo(jtrint64 *src, unsigned int d) { unsigned int lo, hi, q, s, mask; @@ -106,9 +106,9 @@ unsigned int div64by32lo(int64 *src, unsigned int d) return q; } -void div64by32(int64 *dst, unsigned int d) +void div64by32(jtrint64 *dst, unsigned int d) { - int64 tmp; + jtrint64 tmp; tmp.lo = dst->lo; tmp.hi = dst->hi % d; diff --git a/src/math.h b/src/math.h index 41cb459a9..eaa320a87 100644 --- a/src/math.h +++ b/src/math.h @@ -15,19 +15,19 @@ #ifndef _JOHN_MATH_H #define _JOHN_MATH_H -#undef int64 -#define int64 _john_int64_composite +#undef jtrint64 +#define jtrint64 _john_int64_composite typedef struct { unsigned int lo, hi; -} int64; +} jtrint64; -extern void add32to64(int64 *dst, unsigned int src); -extern void add64to64(int64 *dst, int64 *src); -extern void neg64(int64 *dst); -extern void mul32by32(int64 *dst, unsigned int m1, unsigned int m2); -extern void mul64by32(int64 *dst, unsigned int m); -extern unsigned int div64by32lo(int64 *src, unsigned int d); -extern void div64by32(int64 *dst, unsigned int d); +extern void add32to64(jtrint64 *dst, unsigned int src); +extern void add64to64(jtrint64 *dst, jtrint64 *src); +extern void neg64(jtrint64 *dst); +extern void mul32by32(jtrint64 *dst, unsigned int m1, unsigned int m2); +extern void mul64by32(jtrint64 *dst, unsigned int m); +extern unsigned int div64by32lo(jtrint64 *src, unsigned int d); +extern void div64by32(jtrint64 *dst, unsigned int d); #endif diff --git a/src/status.c b/src/status.c index 2a856c74a..d42b9c242 100644 --- a/src/status.c +++ b/src/status.c @@ -97,7 +97,7 @@ void status_ticks_overflow_safety(void) } } -void status_update_crypts(int64 *combs, unsigned int crypts) +void status_update_crypts(jtrint64 *combs, unsigned int crypts) { { unsigned int saved_hi = status.combs.hi; @@ -122,9 +122,9 @@ void status_update_cands(unsigned int cands) status_ticks_overflow_safety(); } -static char *status_get_c(char *buffer, int64 *c, unsigned int c_ehi) +static char *status_get_c(char *buffer, jtrint64 *c, unsigned int c_ehi) { - int64 current, next, rem; + jtrint64 current, next, rem; char *p; if (c_ehi) { @@ -156,12 +156,12 @@ unsigned int status_get_time(void) (get_time() - status.start_time) / clk_tck; } -static char *status_get_cps(char *buffer, int64 *c, unsigned int c_ehi) +static char *status_get_cps(char *buffer, jtrint64 *c, unsigned int c_ehi) { int use_ticks; clock_t ticks; unsigned long time; - int64 tmp, cps; + jtrint64 tmp, cps; if (!(c->lo | c->hi | c_ehi)) return "0"; @@ -306,7 +306,7 @@ static void status_print_cracking(double percent) unsigned int time = status_get_time(); char *key1, key2[PLAINTEXT_BUFFER_SIZE]; char t1buf[PLAINTEXT_BUFFER_SIZE + 1]; - int64 g; + jtrint64 g; char s_gps[32], s_pps[32], s_crypts_ps[32], s_combs_ps[32]; char s[1024], *p; char sc[32]; diff --git a/src/status.h b/src/status.h index 3ceb0d8fb..7001176d9 100644 --- a/src/status.h +++ b/src/status.h @@ -36,7 +36,7 @@ struct status_main { clock_t start_time; unsigned int guess_count; - int64 combs, crypts, cands; + jtrint64 combs, crypts, cands; unsigned int combs_ehi; int compat; int pass; @@ -76,7 +76,7 @@ extern void status_ticks_overflow_safety(void); * to them. * Calls status_ticks_overflow_safety() once in a while. */ -extern void status_update_crypts(int64 *combs, unsigned int crypts); +extern void status_update_crypts(jtrint64 *combs, unsigned int crypts); /* * Updates the candidates counter by adding the supplied number to it. diff --git a/src/uaf_encode.c b/src/uaf_encode.c index 08dbd17d7..7d9d5e257 100644 --- a/src/uaf_encode.c +++ b/src/uaf_encode.c @@ -49,11 +49,11 @@ #include #include #include -#define UAIsC_AD_II UAI$C_AD_II -#define UAIsC_PURDY UAI$C_PURDY -#define UAIsC_PURDY_V UAI$C_PURDY_V -#define UAIsC_PURDY_S UAI$C_PURDY_S -#define UAIsM_PWDMIX UAI$M_PWDMIX +#define UAIsC_AD_II UAI_C_AD_II +#define UAIsC_PURDY UAI_C_PURDY +#define UAIsC_PURDY_V UAI_C_PURDY_V +#define UAIsC_PURDY_S UAI_C_PURDY_S +#define UAIsM_PWDMIX UAI_M_PWDMIX #else /* * Emulate symbols defined for VMS services. @@ -64,12 +64,12 @@ #define UAIsC_PURDY_S 3 #define UAIsM_PWDMIX 0x2000000 -struct dsc$descriptor_s { - unsigned short int dsc$w_length; - unsigned char dsc$b_dtype, dsc$b_char; - char *dsc$a_pointer; +struct dsc_descriptor_s { + unsigned short int dsc_w_length; + unsigned char dsc_b_dtype, dsc_b_char; + char *dsc_a_pointer; }; -#define $DESCRIPTOR(x,s) struct dsc$descriptor_s x={sizeof(s), 1, 1, s} +#define _DESCRIPTOR(x,s) struct dsc_descriptor_s x={sizeof(s), 1, 1, s} #endif #ifdef HAVE_PTHREADS @@ -99,13 +99,13 @@ static unsigned short enc_map[256]; static unsigned short r50_map[256]; /* * Forward reference to main function that hashes a password as OpenVMS does - * in its SYSUAF file. Function takes same arguments as SYS$HASH_PASSWORD + * in its SYSUAF file. Function takes same arguments as SYS_HASH_PASSWORD * system service but in different order. */ static int hash_password ( uaf_qword *, /* Receives result hash */ - struct dsc$descriptor_s *, /* Password */ + struct dsc_descriptor_s *, /* Password */ unsigned char, unsigned short, /* Algorithm code and salt */ - struct dsc$descriptor_s *); /* Username (eff. more salt) */ + struct dsc_descriptor_s *); /* Username (eff. more salt) */ /****************************************************************************/ /* Internal helper functions. @@ -414,7 +414,7 @@ int uaf_hash_decode ( err = decode_6bit ( encoded, SYSUAF_FMT, &pwd->hash, &pwd->alg, &pwd->salt, &pwd->username, &pwd->opt ); /* - * expand 4-bit flags field into standard UAI$_FLAGS bits. + * expand 4-bit flags field into standard UAI__FLAGS bits. */ pwd->flags = ((pwd->opt&1) ? UAIsM_PWDMIX : 0); @@ -429,7 +429,7 @@ int uaf_getuai_info ( { static long uai_ctx = -1; /* protected by uaf_static mutex */ #ifdef VMS - $DESCRIPTOR(username_dx,""); + _DESCRIPTOR(username_dx,""); char owner[32]; /* counted string */ char defdev[32]; /* counted string */ char defdir[64]; /* counted string */ @@ -471,9 +471,9 @@ int uaf_getuai_info ( * Call system to get the information and fixup. Serialize. */ pthread_mutex_lock ( &uaf_static ); - username_dx.dsc$a_pointer = (char *) username; - username_dx.dsc$w_length = strlen(username); - status = SYS$GETUAI ( 0, &uai_ctx, &username_dx, item, 0, 0, 0 ); + username_dx.dsc_a_pointer = (char *) username; + username_dx.dsc_w_length = strlen(username); + status = SYS_GETUAI ( 0, &uai_ctx, &username_dx, item, 0, 0, 0 ); pthread_mutex_unlock ( &uaf_static ); if ( (status&1) == 0 ) { return status; @@ -527,8 +527,8 @@ int uaf_test_password ( int replace_if, uaf_qword *hashed_password ) /* Update pwd if false */ { char uc_username[32], uc_password[32]; - $DESCRIPTOR(username_dx, uc_username ); - $DESCRIPTOR(password_dx,""); + _DESCRIPTOR(username_dx, uc_username ); + _DESCRIPTOR(password_dx,""); int status, i, ulen; memset(hashed_password, 0, sizeof(uaf_qword)); /* @@ -537,19 +537,19 @@ int uaf_test_password ( ulen = strlen ( pwd->username.s ); if ( ulen > sizeof(uc_username)-1 ) return 0; /* name too long */ strcpy ( uc_username, pwd->username.s ); - username_dx.dsc$w_length = ulen; + username_dx.dsc_w_length = ulen; - password_dx.dsc$w_length = strlen(password); + password_dx.dsc_w_length = strlen(password); if ( pwd->flags & UAIsM_PWDMIX ) { /* take password verbatim */ - password_dx.dsc$a_pointer = (char *) password; + password_dx.dsc_a_pointer = (char *) password; } else { /* * Upcase password. */ - password_dx.dsc$a_pointer = uc_password; - if ( password_dx.dsc$w_length > sizeof(uc_password) ) - password_dx.dsc$w_length = sizeof(uc_password); - for ( i = 0; i < password_dx.dsc$w_length; i++ ) + password_dx.dsc_a_pointer = uc_password; + if ( password_dx.dsc_w_length > sizeof(uc_password) ) + password_dx.dsc_w_length = sizeof(uc_password); + for ( i = 0; i < password_dx.dsc_w_length; i++ ) uc_password[i] = toupper ( ARCH_INDEX(password[i]) ); } /* @@ -560,7 +560,7 @@ int uaf_test_password ( &password_dx, pwd->alg, pwd->salt, &username_dx ); if ( ((status&1) == 0) ) { - printf("Retry... (lgi$hpwd2 status %d)\n", status ); + printf("Retry... (lgi_hpwd2 status %d)\n", status ); } if ( pwd->flags & UAIsM_PWDMIX ) memset ( uc_password, 0, sizeof(uc_password) ); diff --git a/src/uaf_hash.c b/src/uaf_hash.c index 114e15f1e..c3693f0c9 100644 --- a/src/uaf_hash.c +++ b/src/uaf_hash.c @@ -20,9 +20,9 @@ #ifdef VMS #include -#define SSs_ABORT SS$_ABORT -#define SSs_BADPARAM SS$_BADPARAM -#define SSs_NORMAL SS$_NORMAL +#define SSs_ABORT SS__ABORT +#define SSs_BADPARAM SS__BADPARAM +#define SSs_NORMAL SS__NORMAL #else /* * Emulate symbols defined for VMS services. @@ -37,16 +37,16 @@ /***************************************************************************/ /* -Title: hash_password (originaly LGI$HPWD) +Title: hash_password (originaly LGI_HPWD) Author: Shawn A. Clifford (sysop@robot.nuceng.ufl.edu) Date: 19-FEB-1993 Revised: 7-JUL-2009 Rework by David Jones for John the Ripper Purpose: Portable C version of the last 3 encryption methods for DEC's password hashing algorithms. -Usage: status = lgi$hpwd(&out_buf, &uaf_buf, encrypt, salt, &unam_buf); +Usage: status = lgi_hpwd(&out_buf, &uaf_buf, encrypt, salt, &unam_buf); - int lgi$hpwd2( + int lgi_hpwd2( unsigned long long *output_hash, string *password, unsigned char *encrypt, @@ -64,7 +64,7 @@ Usage: status = lgi$hpwd(&out_buf, &uaf_buf, encrypt, salt, &unam_buf); salt = 2 byte (word) random number username = up to 31 character username descriptor - status is either SS$_NORMAL (1) or SS$_ABORT (44) + status is either SS__NORMAL (1) or SS$_ABORT (44) Compilation: VAXC compiler, or 'gcc -traditional -c' to get hpwd.o file on a Un*x machine. @@ -77,7 +77,7 @@ Comments: The overall speed of this routine is not great. This is */ -typedef struct dsc$descriptor_s string; +typedef struct dsc_descriptor_s string; /* @@ -153,7 +153,7 @@ int uaf_init ( void ) return 1; } -/** LGI$HPWD entry point **/ +/** LGI_HPWD entry point **/ static int hash_password ( uaf_qword *output_hash, @@ -179,7 +179,7 @@ static int hash_password ( return -1; // exit(SSs_BADPARAM); } - if (username->dsc$w_length > 31) { + if (username->dsc_w_length > 31) { puts("2"); printf("Internal coding error, username is more than 31 bytes long.\n"); exit(SSs_ABORT); @@ -189,7 +189,7 @@ static int hash_password ( /* Setup pointer references */ r3 = password; /* 1st COLLAPSE uses the password desc. */ r4 = &qword; /* @r4..@r4+7 equals obuf */ - r5 = username->dsc$w_length; + r5 = username->dsc_w_length; r7 = (encrypt == 3); /* Clear the output buffer (zero the quadword) */ @@ -198,7 +198,7 @@ static int hash_password ( UAF_QW_SET(*output_hash,0); /* Check for the null password and return zero as the hash value if so */ - if (password->dsc$w_length == 0) { + if (password->dsc_w_length == 0) { return SSs_NORMAL; } @@ -212,9 +212,9 @@ static int hash_password ( /* Use a blank padded username */ strncpy(uname," ",sizeof(uname)); - strncpy(uname, username->dsc$a_pointer, r5); - username->dsc$a_pointer = (char *)&uname; - username->dsc$w_length = 12; + strncpy(uname, username->dsc_a_pointer, r5); + username->dsc_a_pointer = (char *)&uname; + username->dsc_w_length = 12; break; case UAIsC_PURDY_V: /* Purdy with blanks stripped */ @@ -225,14 +225,14 @@ static int hash_password ( * 2 bytes of class information (4 bytes total), then the address of the * buffer. Usernames can not be longer than 31 characters. */ - for ( ulen = username->dsc$w_length; ulen > 0; ulen-- ) { - if ( username->dsc$a_pointer[ulen-1] != ' ' ) break; - username->dsc$w_length--; + for ( ulen = username->dsc_w_length; ulen > 0; ulen-- ) { + if ( username->dsc_a_pointer[ulen-1] != ' ' ) break; + username->dsc_w_length--; } /* If Purdy_S: Bytes 0-1 => plaintext length */ if (r7) { - r4->ulw[0] = password->dsc$w_length; + r4->ulw[0] = password->dsc_w_length; } break; @@ -274,7 +274,7 @@ static int hash_password ( /* Normal exit */ return SSs_NORMAL; -} /* LGI$HPWD */ +} /* LGI_HPWD */ @@ -307,11 +307,11 @@ static void COLLAPSE_R2 (string *r3, quad *r4, char r7) /* --------------------------------------------------------------------- */ - r0 = r3->dsc$w_length; /* Obtain the number of input bytes */ + r0 = r3->dsc_w_length; /* Obtain the number of input bytes */ if (r0 == 0) return; /* Do nothing with empty string */ - r2 = r3->dsc$a_pointer; /* Obtain pointer to input string */ + r2 = r3->dsc_a_pointer; /* Obtain pointer to input string */ for (; (r0 != 0); r0--) { /* Loop until input string exhausted */ @@ -429,7 +429,7 @@ static void EMULQ (uaf_lword a, uaf_lword b, quad *result) * that if I made the variables global, that would save a little time on * allocating space for the vectors and matrices. Last, I removed the matrix, and * added all the values to the 'temp' vector on the fly. This greatly increased - * the speed, but still nowhere near Knuth or calling LIB$EMULQ. + * the speed, but still nowhere near Knuth or calling LIB_EMULQ. */ {