1 /* twister-large-asm.S */
3 This file is part of the AVR-Crypto-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/>.
20 * \file twister-large-asm.S
21 * \email daniel.otte@rub.de
24 * \license GPLv3 or later
28 #include "avr-asm-macros.S"
30 /* void checksum_update(twister_large_ctx_t* ctx, uint8_t col) */
43 movw r30, r24 /* X points to ctx->state.s */
55 adiw r30, 1+3*8 /* Z points at ctx->checksum[0][8] */
56 movw r28, r30 /* Y points at ctx->checksum[0][8] */
58 add r30, r16 /* Z points at ctx->checksum[col][8]*/
64 adc r29, r1 /* Y points at ctx->checksum[(col+1)%8][8]*/
119 /*********************************************************************/
120 /* void twister_large_init(twister_large_ctx_t* ctx, uint16_t hashsize_b)*/
123 * param hashsize_b: r22:r23
125 .global twister384_init
129 rjmp twister_large_init
131 .global twister512_init
136 .global twister_large_init
159 subi r30, lo8(1+8+8+8*7+64)
160 sbci r31, hi8(1+8+8+8*7+64)
165 /*********************************************************************/
166 /* void twister_large_nextBlock(twister_state_t* ctx, void* msg) */
177 .global twister_large_nextBlock
178 .global twister384_nextBlock
179 .global twister512_nextBlock
181 twister384_nextBlock:
182 twister512_nextBlock:
183 twister_large_nextBlock:
216 rcall checksum_update
219 rcall twister_mini_round
223 rcall checksum_update
227 rcall twister_mini_round
231 rcall checksum_update
235 rcall twister_mini_round
251 rcall checksum_update
255 rcall twister_mini_round
258 rcall twister_blank_round
262 rcall checksum_update
266 rcall twister_mini_round
282 rcall checksum_update
286 rcall twister_mini_round
290 rcall checksum_update
294 rcall twister_mini_round
298 rcall checksum_update
302 rcall twister_mini_round
305 rcall twister_blank_round
352 /*********************************************************************/
353 /* void twister_large_lastBlock(twister_state_t* ctx, void* msg, uint16_t length_b) */
357 * param length_b: r20:r21
367 .global twister_large_lastBlock
368 .global twister384_lastBlock
369 .global twister512_lastBlock
371 twister384_lastBlock:
372 twister512_lastBlock:
373 twister_large_lastBlock:
388 rcall twister_large_nextBlock
402 sub r19, r18 /* r18: bytes to copy, r19: bytes to clear */
436 rcall twister_large_nextBlock
475 rcall twister_mini_round
510 rcall twister_small_nextBlock