]> git.cryptolib.org Git - avr-crypto-lib.git/blob - seed/seed.h
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / seed / seed.h
1 /* seed.h */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
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        seed.h
21  * \author      Daniel Otte 
22  * \date        2007-06-1
23  * \brief       declarations for seed
24  * \par License 
25  * GPL
26  * 
27  */
28 #ifndef SEED_H_
29 #define SEED_H_
30
31 #include <stdint.h>
32 /** \typedef seed_ctx_t
33  * \brief SEED context
34  * 
35  * A variable of this type may hold the key material for the SEED cipher. 
36  * This context is regulary generated by the 
37  * void seed_init(const void * key, seed_ctx_t * ctx) function.
38  */
39 typedef struct{
40         uint32_t k[4];
41 } seed_ctx_t;
42
43 /******************************************************************************/
44
45 /** \fn void seed_init(const void * key, seed_ctx_t * ctx)
46  * \brief initializes context for SEED operation
47  * 
48  * This function copys the key material into a context variable.
49  * 
50  * \param key  pointer to the key material (128 bit = 16 bytes)
51  * \param ctx  pointer to the context (seed_ctx_t)
52  */
53 void seed_init(const void * key, seed_ctx_t * ctx);
54
55 /** \fn void seed_enc(void * buffer,const seed_ctx_t * ctx)
56  * \brief encrypt a block with SEED
57  * 
58  * This function encrypts a block of 64 bits (8 bytes) with the SEED algorithm.
59  * The round keys are computed on demand, so the context is modifyed while
60  * encrypting but the original stated is restored when the function exits.
61  * 
62  * \param buffer pointer to the block (64 bit = 8 byte) which will be encrypted
63  * \param ctx    pointer to the key material (seed_ctx_t)
64  */
65 void seed_enc(void * buffer, const seed_ctx_t * ctx);
66
67
68 /** \fn void seed_dec(void * buffer, const seed_ctx_t * ctx)
69  * \brief decrypt a block with SEED
70  * 
71  * This function decrypts a block of 64 bits (8 bytes) with the SEED algorithm.
72  * The round keys are computed on demand, so the context is modifyed while
73  * decrypting but the original stated is restored when the function exits.
74  * 
75  * \param buffer pointer to the block (64 bit = 8 byte) which will be decrypted
76  * \param ctx    pointer to the key material (seed_ctx_t)
77  */
78 void seed_dec(void * buffer, const seed_ctx_t * ctx);
79
80         
81 #endif /*SEED_H_*/