Remove global initialization of sha256
This commit is contained in:
@@ -40,10 +40,14 @@ static void DEBUG_ATSHASOFT_PRINTBUF(char* str, uint8_t* buf, uint8_t sz)
|
||||
#define DEBUG_ATSHASOFT_PRINTBUF(str, buf, sz)
|
||||
#endif
|
||||
|
||||
static Sha256Class Sha256;
|
||||
MySigningDriverAtsha204Soft::MySigningDriverAtsha204Soft()
|
||||
:
|
||||
MySigningDriver(),
|
||||
hmacKey({MY_HMAC_KEY}),
|
||||
verification_ongoing(false),
|
||||
Sha256()
|
||||
|
||||
MySigningDriverAtsha204Soft::MySigningDriverAtsha204Soft() : MySigningDriver(), hmacKey({MY_HMAC_KEY}) {
|
||||
verification_ongoing = false;
|
||||
{
|
||||
// We set the part of the 32-byte nonce that does not fit into a message to 0xAA
|
||||
memset(current_nonce, 0xAA, sizeof(current_nonce));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "MyConfig.h"
|
||||
#include "MySigningDriver.h"
|
||||
#include "utility/ATSHA204.h"
|
||||
#include "utility/sha256.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define SIGNING_IDENTIFIER (1)
|
||||
@@ -34,6 +35,7 @@ public:
|
||||
bool signMsg(MyMessage &msg);
|
||||
bool verifyMsg(MyMessage &msg);
|
||||
private:
|
||||
Sha256Class Sha256;
|
||||
unsigned long timestamp;
|
||||
bool verification_ongoing;
|
||||
uint8_t current_nonce[NONCE_NUMIN_SIZE_PASSTHROUGH];
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <avr/pgmspace.h>
|
||||
#include "sha256.h"
|
||||
|
||||
|
||||
const uint32_t sha256K[] PROGMEM = {
|
||||
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
|
||||
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
|
||||
|
||||
Reference in New Issue
Block a user