added MiFare Classic and Crypto1 patch -- thanks to jsrFDED

This commit is contained in:
Georg
2017-01-17 10:53:21 +01:00
parent 55fdc8dd48
commit 82ce8f0dbf
3 changed files with 1368 additions and 357 deletions
File diff suppressed because it is too large Load Diff
+10 -8
View File
@@ -4,18 +4,16 @@
#include <stdint.h>
#include <stdbool.h>
void Crypto1GetState(uint8_t* pEven, uint8_t* pOdd);
/* Gets the current keystream-bit, without shifting the internal LFSR */
uint8_t Crypto1FilterOutput(void);
/* Set up Crypto1 cipher using the given Key, Uid and CardNonce. Also encrypts
* the CardNonce in-place while in non-linear mode. */
void Crypto1Setup(uint8_t Key[6], uint8_t Uid[4], uint8_t CardNonce[4]);
/* Set up Crypto1 cipher using the given Key, Uid and CardNonce. Nested indicates
* whether the CardNonce is encrypted (true) or not (false).
* If the CardNonce is encrypted, it will we decrypted in-place. If not, it will
* be fed into the LFSR, but remains unchanged. */
void Crypto1SetupReader(uint8_t Key[6], uint8_t Uid[4], uint8_t CardNonce[4], bool Nested);
/* Same for nested auth. CardNonce[4]..[7] will contain the parity bits after return */
void Crypto1SetupNested(uint8_t Key[6], uint8_t Uid[4], uint8_t CardNonce[8], bool Decrypt);
/* Load the decrypted ReaderNonce into the Crypto1 state LFSR */
void Crypto1Auth(uint8_t EncryptedReaderNonce[4]);
@@ -23,14 +21,18 @@ void Crypto1Auth(uint8_t EncryptedReaderNonce[4]);
/* Generate 8 Bits of key stream */
uint8_t Crypto1Byte(void);
/* Encrypt/Decrypt array */
void Crypto1ByteArray(uint8_t* Buffer, uint8_t Count);
void Crypto1ByteArrayWithParity(uint8_t* Buffer, uint8_t Count);
/* Generate 4 Bits of key stream */
uint8_t Crypto1Nibble(void);
/* Execute 'ClockCount' cycles on the PRNG state 'State' */
void Crypto1PRNG(uint8_t State[4], uint16_t ClockCount);
void Crypto1PRNG(uint8_t State[4], uint8_t ClockCount);
/* Encrypts buffer with consideration of parity bits */
void Crypto1EncryptWithParity(uint8_t * Buffer, uint16_t BitCount);
void Crypto1EncryptWithParity(uint8_t * Buffer, uint8_t BitCount);
/* Encrypts buffer with LFSR feedback within reader nonce and considers parity bits */
void Crypto1ReaderAuthWithParity(uint8_t PlainReaderAnswerWithParityBits[9]);
File diff suppressed because it is too large Load Diff