diff options
Diffstat (limited to 'movement/lib')
-rw-r--r-- | movement/lib/TOTP-MCU/sha1.c | 12 | ||||
-rw-r--r-- | movement/lib/TOTP-MCU/sha1.h | 1 |
2 files changed, 6 insertions, 7 deletions
diff --git a/movement/lib/TOTP-MCU/sha1.c b/movement/lib/TOTP-MCU/sha1.c index 21a24fa5..3dc02190 100644 --- a/movement/lib/TOTP-MCU/sha1.c +++ b/movement/lib/TOTP-MCU/sha1.c @@ -84,7 +84,7 @@ static void addUncounted(uint8_t data) { }
}
-void write(uint8_t data) {
+static void __write(uint8_t data) {
++byteCount;
addUncounted(data);
@@ -93,7 +93,7 @@ void write(uint8_t data) { void writeArray(uint8_t *buffer, uint8_t size){
while (size--) {
- write(*buffer++);
+ __write(*buffer++);
}
}
@@ -144,7 +144,7 @@ void initHmac(const uint8_t* key, uint8_t keyLength) { if (keyLength > BLOCK_LENGTH) {
// Hash long keys
init();
- for (;keyLength--;) write(*key++);
+ for (;keyLength--;) __write(*key++);
memcpy(keyBuffer,result(),HASH_LENGTH);
} else {
// Block length keys are used as is
@@ -153,7 +153,7 @@ void initHmac(const uint8_t* key, uint8_t keyLength) { // Start inner hash
init();
for (i=0; i<BLOCK_LENGTH; i++) {
- write(keyBuffer[i] ^ HMAC_IPAD);
+ __write(keyBuffer[i] ^ HMAC_IPAD);
}
}
@@ -163,7 +163,7 @@ uint8_t* resultHmac(void) { memcpy(innerHash,result(),HASH_LENGTH);
// Calculate outer hash
init();
- for (i=0; i<BLOCK_LENGTH; i++) write(keyBuffer[i] ^ HMAC_OPAD);
- for (i=0; i<HASH_LENGTH; i++) write(innerHash[i]);
+ for (i=0; i<BLOCK_LENGTH; i++) __write(keyBuffer[i] ^ HMAC_OPAD);
+ for (i=0; i<HASH_LENGTH; i++) __write(innerHash[i]);
return result();
}
diff --git a/movement/lib/TOTP-MCU/sha1.h b/movement/lib/TOTP-MCU/sha1.h index 2db8fdf8..bd689c34 100644 --- a/movement/lib/TOTP-MCU/sha1.h +++ b/movement/lib/TOTP-MCU/sha1.h @@ -10,7 +10,6 @@ void init(void); void initHmac(const uint8_t* secret, uint8_t secretLength);
uint8_t* result(void);
uint8_t* resultHmac(void);
-void write(uint8_t);
void writeArray(uint8_t *buffer, uint8_t size);
#endif // SHA1_H
|