projects
/
proxmark3-svn
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated
[proxmark3-svn]
/
armsrc
/
optimized_cipher.c
diff --git
a/armsrc/optimized_cipher.c
b/armsrc/optimized_cipher.c
index 2356262114da1123395e534fab0e30da579743b9..8557a21d6fe489e2005b82eb399ecc88b08dbbbd 100644
(file)
--- a/
armsrc/optimized_cipher.c
+++ b/
armsrc/optimized_cipher.c
@@
-61,12
+61,6
@@
**/
#include "optimized_cipher.h"
**/
#include "optimized_cipher.h"
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <time.h>
-
#define opt_T(s) (0x1 & ((s->t >> 15) ^ (s->t >> 14)^ (s->t >> 10)^ (s->t >> 8)^ (s->t >> 5)^ (s->t >> 4)^ (s->t >> 1)^ s->t))
#define opt_T(s) (0x1 & ((s->t >> 15) ^ (s->t >> 14)^ (s->t >> 10)^ (s->t >> 8)^ (s->t >> 5)^ (s->t >> 4)^ (s->t >> 1)^ s->t))
@@
-104,7
+98,6
@@
uint8_t xopt__select(bool x, bool y, uint8_t r)
void opt_successor(const uint8_t* k, State *s, bool y, State* successor)
{
void opt_successor(const uint8_t* k, State *s, bool y, State* successor)
{
-
uint8_t Tt = 1 & opt_T(s);
successor->t = (s->t >> 1);
uint8_t Tt = 1 & opt_T(s);
successor->t = (s->t >> 1);
@@
-218,26
+211,26
@@
void opt_doReaderMAC(uint8_t *cc_nr_p, uint8_t *div_key_p, uint8_t mac[4])
{
static uint8_t cc_nr[12];
{
static uint8_t cc_nr[12];
- opt_reverse_arraybytecpy(cc_nr, cc_nr_p,12);
+ opt_reverse_arraybytecpy(cc_nr, cc_nr_p,
12);
uint8_t dest []= {0,0,0,0,0,0,0,0};
uint8_t dest []= {0,0,0,0,0,0,0,0};
- opt_MAC(div_key_p,cc_nr, dest);
+ opt_MAC(div_key_p,
cc_nr, dest);
//The output MAC must also be reversed
//The output MAC must also be reversed
- opt_reverse_arraybytecpy(mac, dest,4);
+ opt_reverse_arraybytecpy(mac, dest,
4);
return;
}
void opt_doTagMAC(uint8_t *cc_p, const uint8_t *div_key_p, uint8_t mac[4])
{
static uint8_t cc_nr[8+4+4];
return;
}
void opt_doTagMAC(uint8_t *cc_p, const uint8_t *div_key_p, uint8_t mac[4])
{
static uint8_t cc_nr[8+4+4];
- opt_reverse_arraybytecpy(cc_nr, cc_p,12);
+ opt_reverse_arraybytecpy(cc_nr, cc_p,
12);
State _init = {
((div_key_p[0] ^ 0x4c) + 0xEC) & 0xFF,// l
((div_key_p[0] ^ 0x4c) + 0x21) & 0xFF,// r
0x4c, // b
0xE012 // t
};
State _init = {
((div_key_p[0] ^ 0x4c) + 0xEC) & 0xFF,// l
((div_key_p[0] ^ 0x4c) + 0x21) & 0xFF,// r
0x4c, // b
0xE012 // t
};
- opt_suc(div_key_p,
&_init,cc_nr, 12,
true);
+ opt_suc(div_key_p,
&_init, cc_nr, 12,
true);
uint8_t dest []= {0,0,0,0};
uint8_t dest []= {0,0,0,0};
- opt_output(div_key_p,&_init, dest);
+ opt_output(div_key_p,
&_init, dest);
//The output MAC must also be reversed
opt_reverse_arraybytecpy(mac, dest,4);
return;
//The output MAC must also be reversed
opt_reverse_arraybytecpy(mac, dest,4);
return;
@@
-254,14
+247,14
@@
void opt_doTagMAC(uint8_t *cc_p, const uint8_t *div_key_p, uint8_t mac[4])
State opt_doTagMAC_1(uint8_t *cc_p, const uint8_t *div_key_p)
{
static uint8_t cc_nr[8];
State opt_doTagMAC_1(uint8_t *cc_p, const uint8_t *div_key_p)
{
static uint8_t cc_nr[8];
- opt_reverse_arraybytecpy(cc_nr, cc_p,8);
+ opt_reverse_arraybytecpy(cc_nr, cc_p,
8);
State _init = {
((div_key_p[0] ^ 0x4c) + 0xEC) & 0xFF,// l
((div_key_p[0] ^ 0x4c) + 0x21) & 0xFF,// r
0x4c, // b
0xE012 // t
};
State _init = {
((div_key_p[0] ^ 0x4c) + 0xEC) & 0xFF,// l
((div_key_p[0] ^ 0x4c) + 0x21) & 0xFF,// r
0x4c, // b
0xE012 // t
};
- opt_suc(div_key_p,
&_init,cc_nr, 8,
false);
+ opt_suc(div_key_p,
&_init, cc_nr, 8,
false);
return _init;
}
/**
return _init;
}
/**
@@
-277,10
+270,10
@@
void opt_doTagMAC_2(State _init, uint8_t* nr, uint8_t mac[4], const uint8_t* di
{
static uint8_t _nr [4];
opt_reverse_arraybytecpy(_nr, nr, 4);
{
static uint8_t _nr [4];
opt_reverse_arraybytecpy(_nr, nr, 4);
- opt_suc(div_key_p,&_init,_nr, 4, true);
- //opt_suc(div_key_p,&_init,nr, 4, false);
+ opt_suc(div_key_p,
&_init,_nr, 4, true);
+ //opt_suc(div_key_p,
&_init,nr, 4, false);
uint8_t dest []= {0,0,0,0};
uint8_t dest []= {0,0,0,0};
- opt_output(div_key_p,&_init, dest);
+ opt_output(div_key_p,
&_init, dest);
//The output MAC must also be reversed
opt_reverse_arraybytecpy(mac, dest,4);
return;
//The output MAC must also be reversed
opt_reverse_arraybytecpy(mac, dest,4);
return;
Impressum
,
Datenschutz