Go to the source code of this file.
Defines | |
| #define | rol32(a, n) |
| Performs a leftward rotation on 32 bits of data, 1 bit at a time. | |
| #define | ror32(a, n) |
| Performs a rightward rotation on 32 bits of data, 1 bit at a time. | |
| #define | c2l(c, l) |
| Copies a 4 byte char buf to a long and moves the ptr. | |
| #define | l2c(l, c) |
| Copies a long to a 4 byte char buf to a long and doesn't advances the char ptr. | |
| #define | brol1(a) |
| Performs a 1 byte block roll to the left equiv to rol32(a, 8). | |
| #define | brol2(a) |
| Performs a 2 byte block roll to the left equiv to rol32(a, 16). | |
| #define | brol3(a) |
| Performs a 3 byte block roll to the left equiv to rol32(a, 24). | |
| #define | bror1(a) (brol3(a)) |
| #define | bror2(a) (brol2(a)) |
| #define | bror3(a) (brol1(a)) |
| #define | fastrol32(a, n) |
| Fast rol to the left using the above primitives. | |
| #define | fastror32(a, n) fastrol32(a, (32-n)) |
| Can be improved to eliminate the subtraction. | |
| #define | c2sM(c, s) |
| Convert a 2 byte char array to an unsigned short. | |
| #define | s2cM(s, c) |
| Convert a unsigned short to a 2 byte char array. | |
Modified: Jing Deng
Definition in file CryptoPrimitives.h.
|
|
Value: ({ \
uint8_t brol1tmp; \
__asm__ ( "mov %1, %D0" "\n\t" \
"mov %D0, %C0" "\n\t" \
"mov %C0, %B0" "\n\t" \
"mov %B0, %A0" "\n\t" \
"mov %A0, %1" "\n\t" \
: "=r"(a), "=r" (brol1tmp) \
: "0" (a) \
); \
});
Definition at line 134 of file CryptoPrimitives.h. |
|
|
Value: ({ \
uint8_t brol2tmp; \
__asm__ ( "mov %1, %A0" "\n\t" \
"mov %A0, %C0" "\n\t" \
"mov %C0, %1" "\n\t" \
"mov %1, %B0" "\n\t" \
"mov %B0, %D0" "\n\t" \
"mov %D0, %1" "\n\t" \
: "=r"(a), "=r" (brol2tmp) \
: "0" (a) \
); \
});
Definition at line 151 of file CryptoPrimitives.h. |
|
|
Value: ({ \
uint8_t brol3tmp; \
__asm__ ( "mov %1, %A0" "\n\t" \
"mov %A0, %B0" "\n\t" \
"mov %B0, %C0" "\n\t" \
"mov %C0, %D0" "\n\t" \
"mov %D0, %1" "\n\t" \
: "=r"(a), "=r" (brol3tmp) \
: "0" (a) \
); \
});
Definition at line 169 of file CryptoPrimitives.h. |
|
|
Value: ({ \
__asm__ ( "mov r30, %A1" "\n\t" \
"mov r31, %B1" "\n\t" \
"ld %A0, Z+" "\n\t" \
"ld %B0, Z+" "\n\t" \
"ld %C0, Z+" "\n\t" \
"ld %D0, Z " "\n\t" \
: "=r" (l) \
: "r" (c) \
: "r30", "r31"); \
});
Definition at line 100 of file CryptoPrimitives.h. |
|
|
Value: (s = ((unsigned short)(*((c)))) <<8L , \ s|= ((unsigned short)(*((c+1))))) Definition at line 219 of file CryptoPrimitives.h. |
|
|
Value: ({ \
switch ((n)) { \
case 0: break; \
case 1: case 2: case 3: case 4: case 5: rol32 (a, (n)); break; \
case 6: case 7: brol1(a); ror32(a, 8-(n)); break; \
case 8: case 9: case 10: case 11: case 12: brol1(a); rol32(a, (n)-8 ); \
break; \
case 13: case 14: case 15: case 16: brol2(a); ror32(a, 16-(n)); break; \
case 17: case 18: case 19: case 20: brol2(a); rol32(a, (n) -16); break; \
case 21: case 22: case 23: case 24: brol3(a); ror32(a, 24-(n)); break; \
case 25: case 26: case 27: case 28: brol3(a); rol32(a, (n) -24); break; \
case 29: case 30: case 31: ror32(a, 32 - (n)); \
} \
});
Definition at line 196 of file CryptoPrimitives.h. |
|
|
Value: ({ \
__asm__ volatile ( "mov r30, %A0" "\n\t" \
"mov r31, %B0" "\n\t" \
"st Z+, %A1" "\n\t" \
"st Z+, %B1" "\n\t" \
"st Z+, %C1" "\n\t" \
"st Z, %D1" "\n\t" \
: \
: "r" (c), "r" (l) \
: "r30", "r31"); \
});
Definition at line 117 of file CryptoPrimitives.h. |
|
|
Value: ({ \
unsigned long num = (unsigned long)(a); \
unsigned char nsh = (unsigned char)(n); \
__asm__ __volatile__ ( \
"dec %0" "\n\t" \
"brmi L_%=" "\n\t" \
"L1_%=:" "\n\t" \
"clc" "\n\t" \
"sbrc %D1, 7" "\n\t" \
"sec" "\n\t" \
"rol %A1" "\n\t" \
"rol %B1" "\n\t" \
"rol %C1" "\n\t" \
"rol %D1" "\n\t" \
"dec %0" "\n\t" \
"brpl L1_%=" "\n\t" \
"L_%=:" "\n\t" \
: "=r" (nsh), "=r" (num) \
: "0" (nsh), "1" (num) \
); \
a = num; \
})
Definition at line 44 of file CryptoPrimitives.h. |
|
|
Value: ({ \
unsigned long num = (unsigned long)(a); \
unsigned char nsh = (unsigned char)(n); \
__asm__ ( \
"dec %0" "\n\t" \
"brmi L_%=" "\n\t" \
"L1_%=:" "\n\t" \
"clc" "\n\t" \
"sbrc %A1, 0" "\n\t" \
"sec" "\n\t" \
"ror %D1" "\n\t" \
"ror %C1" "\n\t" \
"ror %B1" "\n\t" \
"ror %A1" "\n\t" \
"dec %0" "\n\t" \
"brpl L1_%=" "\n\t" \
"L_%=:" "\n\t" \
: "=r" (nsh), "=r" (num) \
: "0" (nsh), "1" (num) \
); \
a = num; \
})
Definition at line 73 of file CryptoPrimitives.h. |
|
|
Value: (*((c)) = (unsigned short)(((s) >> 8L)&0xff), \ *((c+1)) = (unsigned short)(((s) ) &0xff)) Definition at line 226 of file CryptoPrimitives.h. |
1.4.6