]> git.cryptolib.org Git - avr-crypto-lib.git/blob - memxor.S
renaming to AVR-Crypto-Lib
[avr-crypto-lib.git] / memxor.S
1 /* memxor.S */
2 /*
3     This file is part of the This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2008  Daniel Otte (daniel.otte@rub.de)
5
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.
10
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.
15
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/>.
18 */
19
20 /* 
21  * File:        memxor.S
22  * Author:      Daniel Otte
23  * Date:        2008-08-07
24  * License:     GPLv3 or later
25  * Description: memxor, XORing one block into another
26  * 
27  */
28  
29 /*
30  * void memxor(void* dest, const void* src, uint16_t n);
31  */
32  /*
33   * param dest is passed in r24:r25
34   * param src  is passed in r22:r23
35   * param n    is passed in r20:r21
36   */
37 .global memxor
38 memxor:
39         movw r30, r24
40         movw r26, r22
41         movw r24, r20
42         tst r24
43         brne 1f
44         tst r25
45         breq 2f
46 1:
47         ld r20, X+
48         ld r21, Z
49         eor r20, r21
50         st Z+, r20
51         sbiw r24, 1
52         brne 1b
53 2:
54         ret
55         
56         
57         
58         
59         
60         
61         
62         
63         
64         
65         
66         
67         
68