des3.h
Go to the documentation of this file.
1 /**
2  * @file des3.h
3  * @brief Triple DES (Triple Data Encryption Algorithm)
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneCrypto Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _DES3_H
30 #define _DES3_H
31 
32 //Dependencies
33 #include "core/crypto.h"
34 #include "cipher/des.h"
35 
36 //Triple DES block size
37 #define DES3_BLOCK_SIZE 8
38 //Common interface for encryption algorithms
39 #define DES3_CIPHER_ALGO (&des3CipherAlgo)
40 
41 //C++ guard
42 #ifdef __cplusplus
43  extern "C" {
44 #endif
45 
46 
47 /**
48  * @brief Triple DES algorithm context
49  **/
50 
51 typedef struct
52 {
56 } Des3Context;
57 
58 
59 //Triple DES related constants
60 extern const CipherAlgo des3CipherAlgo;
61 
62 //Triple DES related functions
63 error_t des3Init(Des3Context *context, const uint8_t *key, size_t keyLen);
64 void des3EncryptBlock(Des3Context *context, const uint8_t *input, uint8_t *output);
65 void des3DecryptBlock(Des3Context *context, const uint8_t *input, uint8_t *output);
66 
67 //C++ guard
68 #ifdef __cplusplus
69  }
70 #endif
71 
72 #endif
Triple DES algorithm context.
Definition: des3.h:51
error_t des3Init(Des3Context *context, const uint8_t *key, size_t keyLen)
Initialize a Triple DES context using the supplied key.
Definition: des3.c:68
DesContext k1
Definition: des3.h:53
DES algorithm context.
Definition: des.h:50
General definitions for cryptographic algorithms.
Common interface for encryption algorithms.
Definition: crypto.h:1073
DesContext k2
Definition: des3.h:54
DesContext k3
Definition: des3.h:55
void des3DecryptBlock(Des3Context *context, const uint8_t *input, uint8_t *output)
Decrypt a 8-byte block using Triple DES algorithm.
Definition: des3.c:132
DES (Data Encryption Standard)
error_t
Error codes.
Definition: error.h:40
const CipherAlgo des3CipherAlgo
Definition: des3.c:46
void des3EncryptBlock(Des3Context *context, const uint8_t *input, uint8_t *output)
Encrypt a 8-byte block using Triple DES algorithm.
Definition: des3.c:114