avr-crypto-lib/des/des.h

101 lines
4.0 KiB
C
Raw Normal View History

2008-05-26 19:13:21 +00:00
/* des.h */
/*
This file is part of the AVR-Crypto-Lib.
2008-05-26 19:13:21 +00:00
Copyright (C) 2008 Daniel Otte (daniel.otte@rub.de)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2007-06-18 04:50:39 +00:00
/**
* \file des.h
* \author Daniel Otte
* \date 2007-06-16
* \brief des and tdes declarations
2008-08-02 04:38:17 +00:00
* \license GPLv3 or later
2007-06-18 04:50:39 +00:00
*
*/
#ifndef DES_H_
#define DES_H_
/* the FIPS 46-3 (1999-10-25) name for triple DES is triple data encryption algorithm so TDEA.
2007-06-18 04:50:39 +00:00
* Also we only implement the three key mode */
2008-08-02 04:38:17 +00:00
/** \def tdea_enc
* \brief defining an alias for void tdes_enc(void *out, const void *in, const void *key)
2008-08-02 04:38:17 +00:00
*/
/** \def tdea_dec
* \brief defining an alias for void tdes_dec(void *out, const void *in, const void *key)
2008-08-02 04:38:17 +00:00
*/
#define tdea_enc tdes_enc
#define tdea_dec tdes_dec
2007-06-18 04:50:39 +00:00
/** \fn void des_enc(void *out, const void *in, const void *key)
2008-08-02 04:38:17 +00:00
* \brief encrypt a block with DES
*
* This function encrypts a block of 64 bits (8 bytes) with the DES algorithm.
* Key expansion is done automatically. The key is 64 bits long, but note that
2010-02-05 08:50:59 +00:00
* only 56 bits are used (the LSB of each byte is dropped). The input and output
2008-08-02 04:38:17 +00:00
* blocks may overlap.
*
* \param out pointer to the block (64 bit = 8 byte) where the ciphertext is written to
* \param in pointer to the block (64 bit = 8 byte) where the plaintext is read from
* \param key pointer to the key (64 bit = 8 byte)
*/
void des_enc(void *out, const void *in, const void *key);
2008-08-02 04:38:17 +00:00
/** \fn void des_dec(void *out, const void *in, const void *key)
2008-08-02 04:38:17 +00:00
* \brief decrypt a block with DES
*
* This function decrypts a block of 64 bits (8 bytes) with the DES algorithm.
* Key expansion is done automatically. The key is 64 bits long, but note that
2010-02-05 08:50:59 +00:00
* only 56 bits are used (the LSB of each byte is dropped). The input and output
2008-08-02 04:38:17 +00:00
* blocks may overlap.
*
* \param out pointer to the block (64 bit = 8 byte) where the plaintext is written to
* \param in pointer to the block (64 bit = 8 byte) where the ciphertext is read from
* \param key pointer to the key (64 bit = 8 byte)
*/
void des_dec(void *out, const void *in, const void *key);
2008-08-02 04:38:17 +00:00
/** \fn void tdes_enc(void *out, const void *in, const void *key)
2008-08-02 04:38:17 +00:00
* \brief encrypt a block with Tripple-DES
*
* This function encrypts a block of 64 bits (8 bytes) with the Tripple-DES (EDE)
* algorithm. Key expansion is done automatically. The key is 192 bits long, but
2010-02-05 08:50:59 +00:00
* note that only 178 bits are used (the LSB of each byte is dropped). The input
2008-08-02 04:38:17 +00:00
* and output blocks may overlap.
*
* \param out pointer to the block (64 bit = 8 byte) where the ciphertext is written to
* \param in pointer to the block (64 bit = 8 byte) where the plaintext is read from
* \param key pointer to the key (192 bit = 24 byte)
*/
void tdes_enc(void *out, const void *in, const void *key);
2008-08-02 04:38:17 +00:00
/** \fn void tdes_dec(void *out, const void *in, const void *key)
2008-08-02 04:38:17 +00:00
* \brief decrypt a block with Tripple-DES
*
* This function decrypts a block of 64 bits (8 bytes) with the Tripple-DES (EDE)
* algorithm. Key expansion is done automatically. The key is 192 bits long, but
2010-02-05 08:50:59 +00:00
* note that only 178 bits are used (the LSB of each byte is dropped). The input
2008-08-02 04:38:17 +00:00
* and output blocks may overlap.
*
* \param out pointer to the block (64 bit = 8 byte) where the plaintext is written to
* \param in pointer to the block (64 bit = 8 byte) where the ciphertext is read from
* \param key pointer to the key (192 bit = 24 byte)
*/
void tdes_dec(void *out, const void *in, const void *key);
2007-06-18 04:50:39 +00:00
#endif /*DES_H_*/