]> git.cryptolib.org Git - avr-crypto-lib.git/blob - bmw/bmw_large.h
9df8d714a6e5235c68f9ac5c86e99a60a560cc59
[avr-crypto-lib.git] / bmw / bmw_large.h
1 /* bmw_large.h */
2 /*
3  This file is part of the AVR-Crypto-Lib.
4  Copyright (C) 2009  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  * \file    bmw_large.h
21  * \author  Daniel Otte
22  * \email   daniel.otte@rub.de
23  * \date    2009-04-27
24  * \license GPLv3 or later
25  * 
26  */
27 #ifndef BMW_LARGE_H_
28 #define BMW_LARGE_H_
29
30 #include <stdint.h>
31
32 #define BMW_LARGE_BLOCKSIZE   1024
33 #define BMW_LARGE_BLOCKSIZE_B ((BMW_LARGE_BLOCKSIZE+7)/8)
34 #define BMW384_BLOCKSIZE      BMW_LARGE_BLOCKSIZE
35 #define BMW384_BLOCKSIZE_B    BMW_LARGE_BLOCKSIZE_B
36 #define BMW512_BLOCKSIZE      BMW_LARGE_BLOCKSIZE
37 #define BMW512_BLOCKSIZE_B    BMW_LARGE_BLOCKSIZE_B
38
39 typedef struct {
40     uint64_t h[16];
41     uint32_t counter;
42 } bmw_large_ctx_t;
43
44 typedef bmw_large_ctx_t bmw384_ctx_t;
45 typedef bmw_large_ctx_t bmw512_ctx_t;
46
47 void bmw384_init(bmw384_ctx_t *ctx);
48 void bmw512_init(bmw512_ctx_t *ctx);
49
50 void bmw_large_nextBlock(bmw_large_ctx_t *ctx, const void *block);
51 void bmw_large_lastBlock(bmw_large_ctx_t *ctx, const void *block,
52         uint16_t length_b);
53
54 void bmw384_nextBlock(bmw384_ctx_t *ctx, const void *block);
55 void bmw384_lastBlock(bmw384_ctx_t *ctx, const void *block, uint16_t length_b);
56
57 void bmw512_nextBlock(bmw512_ctx_t *ctx, const void *block);
58 void bmw512_lastBlock(bmw512_ctx_t *ctx, const void *block, uint16_t length_b);
59
60 void bmw384_ctx2hash(void *dest, const bmw384_ctx_t *ctx);
61 void bmw512_ctx2hash(void *dest, const bmw512_ctx_t *ctx);
62
63 void bmw384(void *dest, const void *msg, uint32_t length_b);
64 void bmw512(void *dest, const void *msg, uint32_t length_b);
65
66 #endif /* BMW_LARGE_H_ */