3 This file is part of the Crypto-avr-lib/microcrypt-lib.
4 Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * \brief SEED parts in assembler for AVR
33 /*******************************************************************************
35 void changeendian32(uint32_t * a){
36 *a = (*a & 0x000000FF) << 24 |
37 (*a & 0x0000FF00) << 8 |
38 (*a & 0x00FF0000) >> 8 |
39 (*a & 0xFF000000) >> 24;
44 .global changeendian32
45 ; === change_endian32 ===
46 ; function that changes the endianess of a 32-bit word
47 ; param1: the 32-bit word
48 ; given in r25,r24,r23,22 (r25 is most significant)
51 movw r20, r22 ; (r22,r23) --> (r20,r21)
60 /*******************************************************************************
61 uint32_t bigendian_sum32(uint32_t a, uint32_t b){
70 .global bigendian_sum32
71 ; === bigendian_sum32 ===
72 ; function that adds two 32-bit words in the bigendian way and returns the result
73 ; param1: the first 32-bit word
74 ; given in r25,r24,r23,22 (r25 is most significant for little endian)
75 ; param2: the second 32-bit word
76 ; given in r21,r20,r19,18 (r21 is most significant for little endian)
85 .global bigendian_sub32
86 ; === bigendian_sub32 ===
87 ; function that subtracts a 32-bit words from another in the bigendian way and returns the result
88 ; param1: the minuend 32-bit word
89 ; given in r25,r24,r23,22 (r25 is most significant for little endian)
90 ; param2: the subtrahend 32-bit word
91 ; given in r21,r20,r19,18 (r21 is most significant for little endian)