]> git.cryptolib.org Git - avr-crypto-lib.git/blob - echo/echo.h
179564f2de8d3a7b6720330ff41707e3666a3604
[avr-crypto-lib.git] / echo / echo.h
1 /* echo.h */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2010 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 #ifndef ECHO_H_
21 #define ECHO_H_
22
23 #include <stdint.h>
24
25 #define ECHO_SMALL_BLOCKSIZE 1536
26 #define ECHO_SMALL_BLOCKSIZE_B ((ECHO_SMALL_BLOCKSIZE+7)/8)
27 #define ECHO_LARGE_BLOCKSIZE 1024
28 #define ECHO_LARGE_BLOCKSIZE_B ((ECHO_LARGE_BLOCKSIZE+7)/8)
29
30 #define ECHO224_BLOCKSIZE ECHO_SMALL_BLOCKSIZE
31 #define ECHO224_BLOCKSIZE_B ((ECHO224_BLOCKSIZE+7)/8)
32 #define ECHO256_BLOCKSIZE ECHO_SMALL_BLOCKSIZE
33 #define ECHO256_BLOCKSIZE_B ((ECHO256_BLOCKSIZE+7)/8)
34 #define ECHO384_BLOCKSIZE ECHO_LARGE_BLOCKSIZE
35 #define ECHO384_BLOCKSIZE_B ((ECHO384_BLOCKSIZE+7)/8)
36 #define ECHO512_BLOCKSIZE ECHO_LARGE_BLOCKSIZE
37 #define ECHO512_BLOCKSIZE_B ((ECHO512_BLOCKSIZE+7)/8)
38
39 typedef struct{
40         uint8_t v[4*16];
41         uint8_t salt[16];
42         uint64_t counter;
43         uint16_t id;
44 }echo_small_ctx_t;
45
46 typedef struct{
47         uint8_t v[8*16];
48         uint8_t salt[16];
49         uint64_t counter;
50         uint16_t id;
51 }echo_large_ctx_t;
52
53 void echo_small_nextBlock(echo_small_ctx_t *ctx, void *block);
54 void echo_small_lastBlock(echo_small_ctx_t *ctx, void *block, uint16_t length_b);
55 void echo_small_ctx2hash(void *dest, uint16_t length_b, echo_small_ctx_t *ctx);
56 void echo224_ctx2hash(void *dest, echo_small_ctx_t *ctx);
57 void echo256_ctx2hash(void *dest, echo_small_ctx_t *ctx);
58 void echo224_init(echo_small_ctx_t *ctx);
59 void echo256_init(echo_small_ctx_t *ctx);
60
61 void echo_large_nextBlock(echo_large_ctx_t *ctx, void *block);
62 void echo_large_lastBlock(echo_large_ctx_t *ctx, void *block, uint16_t length_b);
63 void echo_large_ctx2hash(void *dest, uint16_t length_b, echo_large_ctx_t *ctx);
64 void echo384_ctx2hash(void *dest, echo_large_ctx_t *ctx);
65 void echo512_ctx2hash(void *dest, echo_large_ctx_t *ctx);
66 void echo384_init(echo_large_ctx_t *ctx);
67 void echo512_init(echo_large_ctx_t *ctx);
68
69 #endif /* ECHO_H_ */