created centralized function salt_reset()
This commit is contained in:
		
							parent
							
								
									dd99c078f1
								
							
						
					
					
						commit
						327aaf46f8
					
				| @ -44,7 +44,7 @@ extern configData_t cfg; | |||||||
| extern uint8_t mydata[]; | extern uint8_t mydata[]; | ||||||
| extern uint64_t uptimecounter; | extern uint64_t uptimecounter; | ||||||
| extern osjob_t sendjob; | extern osjob_t sendjob; | ||||||
| extern int countermode, screensaver, adrmode, lorasf, txpower, rlim, salt; | extern int countermode, screensaver, adrmode, lorasf, txpower, rlim; | ||||||
| extern bool joinstate; | extern bool joinstate; | ||||||
| extern std::set<uint16_t> wifis;  | extern std::set<uint16_t> wifis;  | ||||||
| extern std::set<uint16_t> macs;  | extern std::set<uint16_t> macs;  | ||||||
|  | |||||||
| @ -19,6 +19,7 @@ typedef struct { | |||||||
|     uint8_t payload[0]; /* network data ended with 4 bytes csum (CRC32) */ |     uint8_t payload[0]; /* network data ended with 4 bytes csum (CRC32) */ | ||||||
| } wifi_ieee80211_packet_t; | } wifi_ieee80211_packet_t; | ||||||
| 
 | 
 | ||||||
|  | uint16_t salt_reset(void); | ||||||
| void BLECount(); | void BLECount(); | ||||||
| void wifi_sniffer_init(void); | void wifi_sniffer_init(void); | ||||||
| void wifi_sniffer_set_channel(uint8_t channel); | void wifi_sniffer_set_channel(uint8_t channel); | ||||||
|  | |||||||
| @ -30,6 +30,7 @@ Refer to LICENSE.txt file in repository for more details. | |||||||
| 
 | 
 | ||||||
| // OLED driver
 | // OLED driver
 | ||||||
| #include <U8x8lib.h> | #include <U8x8lib.h> | ||||||
|  | #include <Wire.h> // Does nothing and avoid any compilation error with I2C
 | ||||||
| 
 | 
 | ||||||
| // LMIC-Arduino LoRaWAN Stack
 | // LMIC-Arduino LoRaWAN Stack
 | ||||||
| #include "loraconf.h" | #include "loraconf.h" | ||||||
| @ -45,7 +46,7 @@ configData_t cfg; // struct holds current device configuration | |||||||
| osjob_t sendjob, initjob; // LMIC
 | osjob_t sendjob, initjob; // LMIC
 | ||||||
| 
 | 
 | ||||||
| // Initialize global variables
 | // Initialize global variables
 | ||||||
| int macnum = 0, salt; | int macnum = 0; | ||||||
| uint64_t uptimecounter = 0; | uint64_t uptimecounter = 0; | ||||||
| bool joinstate = false; | bool joinstate = false; | ||||||
| 
 | 
 | ||||||
| @ -291,7 +292,7 @@ void wifi_sniffer_loop(void * pvParameters) { | |||||||
|                 #ifdef BLECOUNTER |                 #ifdef BLECOUNTER | ||||||
|                   bles.clear();                         // clear BLE macs counter
 |                   bles.clear();                         // clear BLE macs counter
 | ||||||
|                 #endif  |                 #endif  | ||||||
|                 salt = random(65536);                   // get new 16bit random for salting hashes
 |                 salt_reset(); // get new salt for salting hashes
 | ||||||
|                 u8x8.clearLine(0); u8x8.clearLine(1);   // clear Display counter    
 |                 u8x8.clearLine(0); u8x8.clearLine(1);   // clear Display counter    
 | ||||||
|             }       |             }       | ||||||
| 
 | 
 | ||||||
| @ -489,7 +490,7 @@ wifi_sniffer_init(); // setup wifi in monitor mode and start MAC counting | |||||||
| 
 | 
 | ||||||
| // initialize salt value using esp_random() called by random() in arduino-esp32 core
 | // initialize salt value using esp_random() called by random() in arduino-esp32 core
 | ||||||
| // note: do this *after* wifi has started, since gets it's seed from RF noise
 | // note: do this *after* wifi has started, since gets it's seed from RF noise
 | ||||||
| salt = random(65536); // get new 16bit random for salting hashes
 | salt_reset(); // get new 16bit for salting hashes
 | ||||||
|   |   | ||||||
| // Start FreeRTOS tasks
 | // Start FreeRTOS tasks
 | ||||||
| #if CONFIG_FREERTOS_UNICORE // run all tasks on core 0 and switch off core 1
 | #if CONFIG_FREERTOS_UNICORE // run all tasks on core 0 and switch off core 1
 | ||||||
|  | |||||||
| @ -70,7 +70,7 @@ void set_reset(int val) { | |||||||
|             macs.clear(); // clear all macs container
 |             macs.clear(); // clear all macs container
 | ||||||
|             wifis.clear(); // clear Wifi macs container
 |             wifis.clear(); // clear Wifi macs container
 | ||||||
|             bles.clear(); // clear BLE macs container
 |             bles.clear(); // clear BLE macs container
 | ||||||
|             salt = random(65536); // get new 16bit random for salting hashes
 |             salt_reset(); // get new 16bit salt
 | ||||||
|             u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
 |             u8x8.clearLine(0); u8x8.clearLine(1); // clear Display counter
 | ||||||
|             u8x8.clearLine(5); |             u8x8.clearLine(5); | ||||||
|             u8x8.setCursor(0, 5); |             u8x8.setCursor(0, 5); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user