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/>.
21 * \email daniel.otte@rub.de
23 * \license GPLv3 or later
30 #include "avr-asm-macros.S"
48 * void noekeon_omac(void* dest, const void* msg, uint16_t msglength_b,
49 * const void* key, uint8_t t)
52 /* param dest is passed in r24:r25
53 * param msg is passed in r22:r23
54 * param msglength_b is passed in r20:r21
55 * param key is passed in r18:r19
56 * param t is passed in r16
75 rcall push_r18_r27_func
77 rcall pop_r18_r27_func
85 /* copy block to stack buffer */
94 rcall push_r18_r27_func
96 rcall pop_r18_r27_func
103 rcall push_r18_r27_func
105 rcall pop_r18_r27_func
107 bst r20, 6 /* set t bit if msglength_b%128==0*/
111 movw r30, r24 /* z points to encrypted null vector (L) */
121 2: /* B/P has been calculated */
131 /* B/P has been xored into stack buffer */
132 /* now we have to xor-in the remaining message */
146 /* now we have only to insert the 1 at the end of message if msglength_b%128 != 0 */