Merge pull request #85 from fallberg/personalizer

SHA204 personalizer updated to handle HMAC key better
This commit is contained in:
Henrik Ekblad
2015-03-09 00:44:42 +01:00
2 changed files with 8 additions and 10 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
#define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this) #define MY_RANDOMSEED_PIN 7 // A7 - Pin used for random generation (do not connect anything to this)
// Key to use for HMAC calculation in MySigningDriverAtsha204Soft (32 bytes) // Key to use for HMAC calculation in MySigningDriverAtsha204Soft (32 bytes)
#define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\ #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
/********************************** /**********************************
@@ -57,12 +57,9 @@
#endif #endif
#ifdef USER_KEY_DATA #ifdef USER_KEY_DATA
const uint8_t user_key_data[32] = { #define MY_HMAC_KEY 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, const uint8_t user_key_data[32] = {MY_HMAC_KEY};
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
#endif #endif
const int sha204Pin = ATSHA204_PIN; const int sha204Pin = ATSHA204_PIN;
@@ -796,7 +793,7 @@ void setup()
} }
#endif //not SKIP_UART_CONFIRMATION #endif //not SKIP_UART_CONFIRMATION
#else //LOCK_CONFIGURATION #else //LOCK_CONFIGURATION
Serial.println(F("Dry-run. Configuration not locked. Define LOCK_CONFIGURATION to lock for real.")); Serial.println(F("Configuration not locked. Define LOCK_CONFIGURATION to lock for real."));
#endif #endif
} }
else else
@@ -833,6 +830,7 @@ void setup()
Serial.println(F("Key is not randomized (configuration not locked):")); Serial.println(F("Key is not randomized (configuration not locked):"));
} }
#endif #endif
Serial.print("#define MY_HMAC_KEY ");
for (int i=0; i<32; i++) for (int i=0; i<32; i++)
{ {
Serial.print("0x"); Serial.print("0x");
@@ -842,7 +840,7 @@ void setup()
} }
Serial.print(key[i], HEX); Serial.print(key[i], HEX);
if (i < 31) Serial.print(','); if (i < 31) Serial.print(',');
if (!((i+1) % 8)) Serial.println(); if (i+1 == 16) Serial.print("\\\n ");
} }
Serial.println(); Serial.println();
@@ -937,7 +935,7 @@ void setup()
} }
#endif //not SKIP_UART_CONFIRMATION #endif //not SKIP_UART_CONFIRMATION
#else //LOCK_DATA #else //LOCK_DATA
Serial.println(F("Dry-run. Data not locked. Define LOCK_DATA to lock for real.")); Serial.println(F("Data not locked. Define LOCK_DATA to lock for real."));
#endif #endif
} }
else else