diff options
| author | David Phillips <david@sighup.nz> | 2017-05-21 22:14:10 +1200 | 
|---|---|---|
| committer | David Phillips <david@sighup.nz> | 2017-05-21 22:14:10 +1200 | 
| commit | a65bb9861b85dafe81b32e80d4b6b2dc5ab089ec (patch) | |
| tree | 016a5e94aeac95080c69426d5df5f42f9f696ceb | |
| parent | 7e7bfa1752eba09045ccca13607d737195299545 (diff) | |
| download | sand-leek-a65bb9861b85dafe81b32e80d4b6b2dc5ab089ec.tar.xz | |
Add sanity check to back up SSSE3 algorithm
| -rw-r--r-- | sand-leek.c | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/sand-leek.c b/sand-leek.c index c6d5226..a33b524 100644 --- a/sand-leek.c +++ b/sand-leek.c @@ -92,6 +92,9 @@ key_update_d(RSA *rsa_key) {  void*  work(void *arg) {  	char onion[17]; +#ifdef SSSE3_ONION_BASE32 +	char check_onion[17]; /* buffer for onion address used in sanity check */ +#endif  	unsigned char sha[20];  	unsigned long e = EXPONENT_MIN;  	unsigned int e_big_endian = 0; @@ -171,6 +174,20 @@ work(void *arg) {  					goto STOP;  			}  			if(strncmp(onion, search, search_len) == 0) { +#ifdef SSSE3_ONION_BASE32 +				/* sanity check: my SSE algorithm is still experimental, so +				  * check it with old trusty */ +				onion_base32(check_onion, sha); +				check_onion[16] = '\0'; +				if (strcmp(check_onion, onion)) { +					fprintf(stderr, +						"BUG: Discrepancy between SSE algorithm and old trusty\n" +						"SSE gave me %s, but trusty says it should be %s\n" +						"Please report this to the developer\n", +						onion, check_onion); +						continue; +				} +#endif  				fprintf(stderr, "Found %s.onion\n", onion);  #if OPENSSL_VERSION_NUMBER >= 0x10100000L | 
