ssh_key_material.c File Reference

Key material generation. More...

#include "ssh/ssh.h"
#include "ssh/ssh_key_material.h"
#include "ssh/ssh_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   SSH_TRACE_LEVEL
 

Functions

error_t sshInitEncryptionEngine (SshConnection *connection, SshEncryptionEngine *encryptionEngine, const char_t *encAlgo, const char_t *macAlgo, uint8_t x)
 Initialize encryption engine. More...
 
void sshFreeEncryptionEngine (SshEncryptionEngine *encryptionEngine)
 Release encryption engine. More...
 
error_t sshSelectCipherAlgo (SshEncryptionEngine *encryptionEngine, const char_t *encAlgo)
 Select the relevant cipher algorithm. More...
 
error_t sshSelectHashAlgo (SshEncryptionEngine *encryptionEngine, const char_t *encAlgo, const char_t *macAlgo)
 Select the relevant hash algorithm. More...
 
error_t sshDeriveKey (SshConnection *connection, uint8_t x, uint8_t *output, size_t outputLen)
 Key derivation function. More...
 
void sshDumpKey (SshConnection *connection, const char_t *label, const uint8_t *key, size_t keyLen)
 Dump secret key (for debugging purpose only) More...
 

Detailed Description

Key material generation.

License

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

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

This file is part of CycloneSSH 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.

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

Definition in file ssh_key_material.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   SSH_TRACE_LEVEL

Definition at line 32 of file ssh_key_material.c.

Function Documentation

◆ sshDeriveKey()

error_t sshDeriveKey ( SshConnection connection,
uint8_t  x,
uint8_t *  output,
size_t  outputLen 
)

Key derivation function.

Parameters
[in]connectionPointer to the SSH connection
[in]xA single character
[out]outputPointer to the output
[in]outputLenDesired output length
Returns
Error code

Definition at line 1041 of file ssh_key_material.c.

◆ sshDumpKey()

void sshDumpKey ( SshConnection connection,
const char_t label,
const uint8_t *  key,
size_t  keyLen 
)

Dump secret key (for debugging purpose only)

Parameters
[in]connectionPointer to the SSH connection
[in]labelIdentifying label (NULL-terminated string)
[in]keyPointer to the secret key
[in]keyLenLength of the secret key, in bytes

Definition at line 1128 of file ssh_key_material.c.

◆ sshFreeEncryptionEngine()

void sshFreeEncryptionEngine ( SshEncryptionEngine encryptionEngine)

Release encryption engine.

Parameters
[in]encryptionEnginePointer to the encryption/decryption engine

Definition at line 218 of file ssh_key_material.c.

◆ sshInitEncryptionEngine()

error_t sshInitEncryptionEngine ( SshConnection connection,
SshEncryptionEngine encryptionEngine,
const char_t encAlgo,
const char_t macAlgo,
uint8_t  x 
)

Initialize encryption engine.

Parameters
[in]connectionPointer to the SSH connection
[in]encryptionEnginePointer to the encryption/decryption engine to be initialized
[in]encAlgoSelected encryption algorithm (NULL-terminated string)
[in]macAlgoSelected integrity algorithm (NULL-terminated string)
[in]xA single character used to derive keys
Returns
Error code

Definition at line 55 of file ssh_key_material.c.

◆ sshSelectCipherAlgo()

error_t sshSelectCipherAlgo ( SshEncryptionEngine encryptionEngine,
const char_t encAlgo 
)

Select the relevant cipher algorithm.

Parameters
[in]encryptionEnginePointer to the encryption/decryption engine to be initialized
[in]encAlgoEncryption algorithm name
Returns
Error code

Definition at line 260 of file ssh_key_material.c.

◆ sshSelectHashAlgo()

error_t sshSelectHashAlgo ( SshEncryptionEngine encryptionEngine,
const char_t encAlgo,
const char_t macAlgo 
)

Select the relevant hash algorithm.

Parameters
[in]encryptionEnginePointer to the encryption/decryption engine to be initialized
[in]encAlgoEncryption algorithm name
[in]macAlgoIntegrity algorithm name
Returns
Error code

Definition at line 774 of file ssh_key_material.c.