C-code for gf256-multiplication in comment

This commit is contained in:
bg nerilex 2014-07-08 21:16:21 +02:00
parent 226bfa4c5f
commit 2f89c4687b
1 changed files with 19 additions and 1 deletions

View File

@ -62,8 +62,26 @@ gf256mul:
#else
/*
uint8_t gf256mul(uint8_t a, uint8_t b, uint8_t p) {
uint8_t r = 0, c = 8;
do {
if (a & 1) {
r ^= b;
}
a >>= 1;
if (b & 0x80) {
b ^= p;
}
b <<= 1;
} while (--c);
return r;
}
*/
gf256mul:
mov r21, r24
mov A, r24
clr r24
ldi r25, 8
1: