mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
make style
This commit is contained in:
+1
-1
@@ -422,7 +422,7 @@ static command_t CommandTable[] = {
|
||||
// {"type5", CmdNFCType5, AlwaysAvailable, "{ NFC Forum Tag Type 5... }"},
|
||||
{"mf", CmdNFCMF, AlwaysAvailable, "{ NFC Type MIFARE Classic/Plus Tag... }"},
|
||||
{"barcode", CmdNFCBarcode, AlwaysAvailable, "{ NFC Barcode Tag... }"},
|
||||
{"vas", CmdVAS, AlwaysAvailable, "{ Apple Value Added Service }"},
|
||||
{"vas", CmdVAS, AlwaysAvailable, "{ Apple Value Added Service }"},
|
||||
// {"--------", CmdHelp, AlwaysAvailable, "--------------------- " _CYAN_("NFC peer-to-peer") " ------------"},
|
||||
// {"isodep", CmdISODEP, AlwaysAvailable, "{ ISO-DEP protocol... }"},
|
||||
// {"llcp", CmdNFCLLCP, AlwaysAvailable, "{ Logical Link Control Protocol... }"},
|
||||
|
||||
+400
-400
File diff suppressed because it is too large
Load Diff
@@ -638,31 +638,31 @@ int blowfish_decrypt(uint8_t *iv, uint8_t *key, uint8_t *input, uint8_t *output,
|
||||
|
||||
// Implementation from http://www.secg.org/sec1-v2.pdf#subsubsection.3.6.1
|
||||
int ansi_x963_sha256(uint8_t *sharedSecret, size_t sharedSecretLen, uint8_t *sharedInfo, size_t sharedInfoLen, size_t keyDataLen, uint8_t *keyData) {
|
||||
// sha256 hash has (practically) no max input len, so skipping that step
|
||||
// sha256 hash has (practically) no max input len, so skipping that step
|
||||
|
||||
if (keyDataLen >= 32 * (pow(2, 32) - 1)) {
|
||||
return 1;
|
||||
}
|
||||
if (keyDataLen >= 32 * (pow(2, 32) - 1)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t counter = 0x00000001;
|
||||
uint32_t counter = 0x00000001;
|
||||
|
||||
for (int i = 0; i < (keyDataLen / 32); ++i) {
|
||||
uint8_t *hashMaterial = malloc(4 + sharedSecretLen + sharedInfoLen);
|
||||
memcpy(hashMaterial, sharedSecret, sharedSecretLen);
|
||||
hashMaterial[sharedSecretLen] = (counter >> 24);
|
||||
hashMaterial[sharedSecretLen + 1] = (counter >> 16) & 0xFF;
|
||||
hashMaterial[sharedSecretLen + 2] = (counter >> 8) & 0xFF;
|
||||
hashMaterial[sharedSecretLen + 3] = counter & 0xFF;
|
||||
memcpy(hashMaterial + sharedSecretLen + 4, sharedInfo, sharedInfoLen);
|
||||
for (int i = 0; i < (keyDataLen / 32); ++i) {
|
||||
uint8_t *hashMaterial = malloc(4 + sharedSecretLen + sharedInfoLen);
|
||||
memcpy(hashMaterial, sharedSecret, sharedSecretLen);
|
||||
hashMaterial[sharedSecretLen] = (counter >> 24);
|
||||
hashMaterial[sharedSecretLen + 1] = (counter >> 16) & 0xFF;
|
||||
hashMaterial[sharedSecretLen + 2] = (counter >> 8) & 0xFF;
|
||||
hashMaterial[sharedSecretLen + 3] = counter & 0xFF;
|
||||
memcpy(hashMaterial + sharedSecretLen + 4, sharedInfo, sharedInfoLen);
|
||||
|
||||
uint8_t hash[32] = {0};
|
||||
sha256hash(hashMaterial, 4 + sharedSecretLen + sharedInfoLen, hash);
|
||||
free(hashMaterial);
|
||||
uint8_t hash[32] = {0};
|
||||
sha256hash(hashMaterial, 4 + sharedSecretLen + sharedInfoLen, hash);
|
||||
free(hashMaterial);
|
||||
|
||||
memcpy(keyData + (32 * i), hash, 32);
|
||||
memcpy(keyData + (32 * i), hash, 32);
|
||||
|
||||
counter++;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Not original to the mbedtls library. Taken from
|
||||
* Not original to the mbedtls library. Taken from
|
||||
* https://github.com/mwarning/mbedtls_ecp_compression
|
||||
* to solve mbedtls' lack of support for elliptic point
|
||||
* compression and decompression
|
||||
@@ -35,13 +35,13 @@ int mbedtls_ecp_decompress(
|
||||
*olen = 2 * plen + 1;
|
||||
|
||||
if (osize < *olen)
|
||||
return(MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL);
|
||||
return (MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL);
|
||||
|
||||
if (ilen != plen + 1)
|
||||
return(MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
return (MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
|
||||
if (input[0] != 0x02 && input[0] != 0x03)
|
||||
return(MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
return (MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
|
||||
// output will consist of 0x04|X|Y
|
||||
memcpy(output, input, ilen);
|
||||
@@ -97,7 +97,7 @@ cleanup:
|
||||
mbedtls_mpi_free(&x);
|
||||
mbedtls_mpi_free(&n);
|
||||
|
||||
return(ret);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int mbedtls_ecp_compress(
|
||||
@@ -112,13 +112,13 @@ int mbedtls_ecp_compress(
|
||||
*olen = plen + 1;
|
||||
|
||||
if (osize < *olen)
|
||||
return(MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL);
|
||||
return (MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL);
|
||||
|
||||
if (ilen != 2 * plen + 1)
|
||||
return (MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
|
||||
if (input[0] != 0x04)
|
||||
return(MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
return (MBEDTLS_ERR_ECP_BAD_INPUT_DATA);
|
||||
|
||||
// output will consist of 0x0?|X
|
||||
memcpy(output, input, *olen);
|
||||
@@ -126,5 +126,5 @@ int mbedtls_ecp_compress(
|
||||
// Encode even/odd of Y into first byte (either 0x02 or 0x03)
|
||||
output[0] = 0x02 + (input[2 * plen] & 1);
|
||||
|
||||
return(0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Not original to the mbedtls library. Taken from
|
||||
* Not original to the mbedtls library. Taken from
|
||||
* https://github.com/mwarning/mbedtls_ecp_compression
|
||||
* to solve mbedtls' lack of support for elliptic point
|
||||
* compression and decompression
|
||||
|
||||
Reference in New Issue
Block a user