mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
style
This commit is contained in:
parent
9f015ad964
commit
414275802d
11 changed files with 93 additions and 73 deletions
|
@ -86,25 +86,25 @@ bool nfc3d_amiibo_unpack(const nfc3d_amiibo_keys_t *amiiboKeys, const uint8_t *t
|
|||
nfc3d_amiibo_cipher(&dataKeys, internal, plain);
|
||||
|
||||
// Regenerate tag HMAC. Note: order matters, data HMAC depends on tag HMAC!
|
||||
mbedtls_md_hmac( mbedtls_md_info_from_type(MBEDTLS_MD_SHA256)
|
||||
, tagKeys.hmacKey
|
||||
, sizeof(tagKeys.hmacKey)
|
||||
, plain + 0x1D4
|
||||
, 0x34
|
||||
, plain + HMAC_POS_TAG
|
||||
);
|
||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256)
|
||||
, tagKeys.hmacKey
|
||||
, sizeof(tagKeys.hmacKey)
|
||||
, plain + 0x1D4
|
||||
, 0x34
|
||||
, plain + HMAC_POS_TAG
|
||||
);
|
||||
|
||||
// Regenerate data HMAC
|
||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256)
|
||||
, dataKeys.hmacKey
|
||||
, sizeof(dataKeys.hmacKey)
|
||||
, plain + 0x029
|
||||
, 0x1DF
|
||||
, plain + HMAC_POS_DATA
|
||||
);
|
||||
, dataKeys.hmacKey
|
||||
, sizeof(dataKeys.hmacKey)
|
||||
, plain + 0x029
|
||||
, 0x1DF
|
||||
, plain + HMAC_POS_DATA
|
||||
);
|
||||
|
||||
return ((memcmp(plain + HMAC_POS_DATA, internal + HMAC_POS_DATA, 32) == 0) &&
|
||||
(memcmp(plain + HMAC_POS_TAG, internal + HMAC_POS_TAG, 32) == 0));
|
||||
(memcmp(plain + HMAC_POS_TAG, internal + HMAC_POS_TAG, 32) == 0));
|
||||
}
|
||||
|
||||
void nfc3d_amiibo_pack(const nfc3d_amiibo_keys_t *amiiboKeys, const uint8_t *plain, uint8_t *tag) {
|
||||
|
@ -118,12 +118,12 @@ void nfc3d_amiibo_pack(const nfc3d_amiibo_keys_t *amiiboKeys, const uint8_t *pla
|
|||
|
||||
// Generate tag HMAC
|
||||
mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256)
|
||||
, tagKeys.hmacKey
|
||||
, sizeof(tagKeys.hmacKey)
|
||||
, plain + 0x1D4
|
||||
, 0x34
|
||||
, cipher + HMAC_POS_TAG
|
||||
);
|
||||
, tagKeys.hmacKey
|
||||
, sizeof(tagKeys.hmacKey)
|
||||
, plain + 0x1D4
|
||||
, 0x34
|
||||
, cipher + HMAC_POS_TAG
|
||||
);
|
||||
|
||||
// Init mbedtls HMAC context
|
||||
mbedtls_md_context_t ctx;
|
||||
|
|
|
@ -20,7 +20,7 @@ static void nfc3d_keygen_prepare_seed(const nfc3d_keygen_masterkeys_t *baseKeys,
|
|||
|
||||
// 1: Copy whole type string
|
||||
// output = (uint8_t *)strcpy((char *)output, baseKeys->typeString);
|
||||
output = memccpy(output, baseKeys->typeString, '\0', sizeof(baseKeys->typeString));
|
||||
output = memccpy(output, baseKeys->typeString, '\0', sizeof(baseKeys->typeString));
|
||||
|
||||
// 2: Append (16 - magicBytesSize) from the input seed
|
||||
size_t leadingSeedBytes = 16 - baseKeys->magicBytesSize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue