]> git.cryptolib.org Git - avr-crypto-lib.git/commitdiff
C-code for gf256-multiplication in comment
authorbg <bg@nerilex.org>
Tue, 8 Jul 2014 19:16:21 +0000 (21:16 +0200)
committerbg <bg@nerilex.org>
Tue, 8 Jul 2014 19:16:21 +0000 (21:16 +0200)
gf256mul/gf256mul.S

index b269d3a4a1b760d2d372598bb0cbfdf87de1009c..d202d84fed5014f62aa6a89080b7efbb12229d93 100644 (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: