X-Git-Url: https://git.cryptolib.org/?p=avr-crypto-lib.git;a=blobdiff_plain;f=gf256mul%2Fgf256mul.S;h=36991aed0c5bd2d6269ba929663e8fa5a8f9a0cc;hp=b269d3a4a1b760d2d372598bb0cbfdf87de1009c;hb=4b5da1dc27a791b5c448274a3db09cd035b33493;hpb=924aa320bef6f192feecdb67d209c790bd49ea49 diff --git a/gf256mul/gf256mul.S b/gf256mul/gf256mul.S index b269d3a..36991ae 100644 --- a/gf256mul/gf256mul.S +++ b/gf256mul/gf256mul.S @@ -1,7 +1,7 @@ /* gf256mul.S */ /* This file is part of the AVR-Crypto-Lib. - Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de) + Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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: