des3.c File Reference

Triple DES (Triple Data Encryption Algorithm) More...

#include "core/crypto.h"
#include "cipher/des3.h"
#include "cipher/des.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

__weak_func error_t des3Init (Des3Context *context, const uint8_t *key, size_t keyLen)
 Initialize a Triple DES context using the supplied key. More...
 
__weak_func void des3EncryptBlock (Des3Context *context, const uint8_t *input, uint8_t *output)
 Encrypt a 8-byte block using Triple DES algorithm. More...
 
__weak_func void des3DecryptBlock (Des3Context *context, const uint8_t *input, uint8_t *output)
 Decrypt a 8-byte block using Triple DES algorithm. More...
 
__weak_func void des3Deinit (Des3Context *context)
 Release Triple DES context. More...
 

Variables

const uint8_t DES_EDE3_CBC_OID [8] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x03, 0x07}
 
const CipherAlgo des3CipherAlgo
 

Detailed Description

Triple DES (Triple Data Encryption Algorithm)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCRYPTO Open.

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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Description

Triple DES is an encryption algorithm designed to encipher and decipher blocks of 64 bits under control of a 192-bit key. Refer to FIPS 46-3 for more details

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file des3.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 37 of file des3.c.

Function Documentation

◆ des3DecryptBlock()

__weak_func void des3DecryptBlock ( Des3Context context,
const uint8_t *  input,
uint8_t *  output 
)

Decrypt a 8-byte block using Triple DES algorithm.

Parameters
[in]contextPointer to the Triple DES context
[in]inputCiphertext block to decrypt
[out]outputPlaintext block resulting from decryption

Definition at line 144 of file des3.c.

◆ des3Deinit()

__weak_func void des3Deinit ( Des3Context context)

Release Triple DES context.

Parameters
[in]contextPointer to the Triple DES context

Definition at line 161 of file des3.c.

◆ des3EncryptBlock()

__weak_func void des3EncryptBlock ( Des3Context context,
const uint8_t *  input,
uint8_t *  output 
)

Encrypt a 8-byte block using Triple DES algorithm.

Parameters
[in]contextPointer to the Triple DES context
[in]inputPlaintext block to encrypt
[out]outputCiphertext block resulting from encryption

Definition at line 125 of file des3.c.

◆ des3Init()

__weak_func error_t des3Init ( Des3Context context,
const uint8_t *  key,
size_t  keyLen 
)

Initialize a Triple DES context using the supplied key.

Parameters
[in]contextPointer to the Triple DES context to initialize
[in]keyPointer to the key
[in]keyLenLength of the key
Returns
Error code

Definition at line 74 of file des3.c.

Variable Documentation

◆ des3CipherAlgo

const CipherAlgo des3CipherAlgo
Initial value:
=
{
"3DES",
sizeof(Des3Context),
NULL,
NULL,
}
void(* CipherAlgoDeinit)(void *context)
Definition: crypto.h:983
void(* CipherAlgoDecryptBlock)(void *context, const uint8_t *input, uint8_t *output)
Definition: crypto.h:980
error_t(* CipherAlgoInit)(void *context, const uint8_t *key, size_t keyLen)
Definition: crypto.h:968
void(* CipherAlgoEncryptBlock)(void *context, const uint8_t *input, uint8_t *output)
Definition: crypto.h:977
@ CIPHER_ALGO_TYPE_BLOCK
Definition: crypto.h:932
__weak_func error_t des3Init(Des3Context *context, const uint8_t *key, size_t keyLen)
Initialize a Triple DES context using the supplied key.
Definition: des3.c:74
__weak_func void des3EncryptBlock(Des3Context *context, const uint8_t *input, uint8_t *output)
Encrypt a 8-byte block using Triple DES algorithm.
Definition: des3.c:125
__weak_func void des3DecryptBlock(Des3Context *context, const uint8_t *input, uint8_t *output)
Decrypt a 8-byte block using Triple DES algorithm.
Definition: des3.c:144
__weak_func void des3Deinit(Des3Context *context)
Release Triple DES context.
Definition: des3.c:161
#define DES3_BLOCK_SIZE
Definition: des3.h:44
Triple DES algorithm context.
Definition: des3.h:59

Definition at line 51 of file des3.c.

◆ DES_EDE3_CBC_OID

const uint8_t DES_EDE3_CBC_OID[8] = {0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x03, 0x07}

Definition at line 48 of file des3.c.