From: bg Date: Tue, 8 Jul 2014 19:16:21 +0000 (+0200) Subject: C-code for gf256-multiplication in comment X-Git-Url: https://git.cryptolib.org/?a=commitdiff_plain;h=2f89c4687b258a5476576e47c6d436397b13db12;p=avr-crypto-lib.git C-code for gf256-multiplication in comment --- diff --git a/gf256mul/gf256mul.S b/gf256mul/gf256mul.S index b269d3a..d202d84 100644 --- a/gf256mul/gf256mul.S +++ b/gf256mul/gf256mul.S @@ -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: