diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-05-02 18:39:45 -0500 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-05-02 18:39:45 -0500 |
commit | cd405735351035df657b64547b3dfc6a3d59db56 (patch) | |
tree | 1cdd5e6b0d0434d20f71045178a1e5e7377eb56f /movement/lib/TOTP-MCU/sha1.c | |
parent | 0004c30f422e702fd184a54e9f1d55da878bcd0f (diff) | |
parent | 35d1f5e647ac1b5fcccdb43ec58058587dd5301b (diff) | |
download | Sensor-Watch-cd405735351035df657b64547b3dfc6a3d59db56.tar.gz Sensor-Watch-cd405735351035df657b64547b3dfc6a3d59db56.tar.bz2 Sensor-Watch-cd405735351035df657b64547b3dfc6a3d59db56.zip |
Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into motion-express
Diffstat (limited to 'movement/lib/TOTP-MCU/sha1.c')
-rw-r--r-- | movement/lib/TOTP-MCU/sha1.c | 12 |
1 files changed, 6 insertions, 6 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();
}
|