mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-11-10 17:49:32 +08:00
d19754567d
* .h include only the strict minimum for their own parsing * this forces all files to include explicitment their needs and not count on far streched dependencies * this helps Makefile to rebuild only the minimum * according to this rule, most standalone .h are now gone * big app.h is gone * remove seldom __cplusplus, if c++ happens, everything will have to be done properly anyway * all unrequired include were removed * split common/ into common/ (client+arm) and common_arm/ (os+bootloader) * bring zlib to common/ * bring stuff not really/not yet used in common back to armsrc/ or client/ * bring liblua into client/ * bring uart into client/ * move some portions of code around (dbprint, protocols,...) * rename unused files into *_disabled.[ch] to make it explicit * rename soft Uarts between 14a, 14b and iclass, so a standalone could use several without clash * remove PrintAndLogDevice * move deprecated-hid-flasher from client to tools * Makefiles * treat deps in armsrc/ as in client/ * client: stop on warning (-Werror), same as for armsrc/ Tested on: * all standalone modes * Linux
28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
#ifndef __HITAG2_CRYPTO_H
|
|
#define __HITAG2_CRYPTO_H
|
|
|
|
#include "common.h"
|
|
|
|
struct hitag2_tag {
|
|
uint32_t uid;
|
|
enum {
|
|
TAG_STATE_RESET = 0x01, // Just powered up, awaiting GetSnr
|
|
TAG_STATE_ACTIVATING = 0x02, // In activation phase (password mode), sent UID, awaiting reader password
|
|
TAG_STATE_ACTIVATED = 0x03, // Activation complete, awaiting read/write commands
|
|
TAG_STATE_WRITING = 0x04, // In write command, awaiting sector contents to be written
|
|
} state;
|
|
uint16_t active_sector;
|
|
uint8_t crypto_active;
|
|
uint64_t cs;
|
|
uint8_t sectors[12][4];
|
|
};
|
|
|
|
uint32_t _f20(const uint64_t x);
|
|
uint64_t _hitag2_init(const uint64_t key, const uint32_t serial, const uint32_t IV);
|
|
uint64_t _hitag2_round(uint64_t *state);
|
|
uint32_t _hitag2_byte(uint64_t *x);
|
|
void hitag2_cipher_reset(struct hitag2_tag *tag, const uint8_t *iv);
|
|
int hitag2_cipher_authenticate(uint64_t *cs, const uint8_t *authenticator_is);
|
|
int hitag2_cipher_transcrypt(uint64_t *cs, uint8_t *data, uint16_t bytes, uint16_t bits) ;
|
|
|
|
#endif
|