ssh_exchange_hash.c File Reference

Exchange hash calculation. More...

#include "ssh/ssh.h"
#include "ssh/ssh_sign_generate.h"
#include "ssh/ssh_sign_verify.h"
#include "ssh/ssh_exchange_hash.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 sshInitExchangeHash (SshConnection *connection)
 Initialize exchange hash. More...
 
error_t sshUpdateExchangeHash (SshConnection *connection, const void *data, size_t length)
 Update exchange hash calculation. More...
 
error_t sshUpdateExchangeHashRaw (SshConnection *connection, const void *data, size_t length)
 Update exchange hash calculation (raw data) More...
 
error_t sshFinalizeExchangeHash (SshConnection *connection, uint8_t *digest, size_t *digestLen)
 Finalize exchange hash calculation. More...
 
error_t sshGenerateExchangeHashSignature (SshConnection *connection, uint8_t *p, size_t *written)
 Compute the signature on the exchange hash. More...
 
error_t sshVerifyExchangeHashSignature (SshConnection *connection, const SshBinaryString *serverHostKey, const SshBinaryString *signature)
 Verify the signature on the exchange hash. More...
 

Detailed Description

Exchange hash calculation.

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_exchange_hash.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   SSH_TRACE_LEVEL

Definition at line 32 of file ssh_exchange_hash.c.

Function Documentation

◆ sshFinalizeExchangeHash()

error_t sshFinalizeExchangeHash ( SshConnection connection,
uint8_t *  digest,
size_t *  digestLen 
)

Finalize exchange hash calculation.

Parameters
[in]connectionPointer to the SSH connection
[out]digestBuffer where to store the resulting hash value
[out]digestLenLength of the resulting hash value, in bytes
Returns
Error code

Definition at line 236 of file ssh_exchange_hash.c.

◆ sshGenerateExchangeHashSignature()

error_t sshGenerateExchangeHashSignature ( SshConnection connection,
uint8_t *  p,
size_t *  written 
)

Compute the signature on the exchange hash.

Parameters
[in]connectionPointer to the SSH connection
[out]pOutput stream where to write the signature
[out]writtenTotal number of bytes that have been written
Returns
Error code

Definition at line 271 of file ssh_exchange_hash.c.

◆ sshInitExchangeHash()

error_t sshInitExchangeHash ( SshConnection connection)

Initialize exchange hash.

Parameters
[in]connectionPointer to the SSH connection
Returns
Error code

Definition at line 52 of file ssh_exchange_hash.c.

◆ sshUpdateExchangeHash()

error_t sshUpdateExchangeHash ( SshConnection connection,
const void *  data,
size_t  length 
)

Update exchange hash calculation.

Parameters
[in]connectionPointer to the SSH connection
[in]dataPointer to the data block to be hashed
[in]lengthLength of the data block, in bytes
Returns
Error code

Definition at line 164 of file ssh_exchange_hash.c.

◆ sshUpdateExchangeHashRaw()

error_t sshUpdateExchangeHashRaw ( SshConnection connection,
const void *  data,
size_t  length 
)

Update exchange hash calculation (raw data)

Parameters
[in]connectionPointer to the SSH connection
[in]dataPointer to the data block to be hashed
[in]lengthLength of the data block, in bytes
Returns
Error code

Definition at line 203 of file ssh_exchange_hash.c.

◆ sshVerifyExchangeHashSignature()

error_t sshVerifyExchangeHashSignature ( SshConnection connection,
const SshBinaryString serverHostKey,
const SshBinaryString signature 
)

Verify the signature on the exchange hash.

Parameters
[in]connectionPointer to the SSH connection
[in]serverHostKeyServer's public host key
[in]signatureSignature to be verified
Returns
Error code

Definition at line 330 of file ssh_exchange_hash.c.