ssh_kex_dh_gex.h File Reference

DH GEX (Diffie-Hellman Group Exchange) key exchange. More...

#include "ssh/ssh.h"

Go to the source code of this file.

Functions

error_t sshSendKexDhGexRequest (SshConnection *connection)
 Send SSH_MSG_KEX_DH_GEX_REQUEST message. More...
 
error_t sshSendKexDhGexGroup (SshConnection *connection)
 Send SSH_MSG_KEX_DH_GEX_GROUP message. More...
 
error_t sshSendKexDhGexInit (SshConnection *connection)
 Send SSH_MSG_KEX_DH_GEX_INIT message. More...
 
error_t sshSendKexDhGexReply (SshConnection *connection)
 Send SSH_MSG_KEX_DH_GEX_REPLY message. More...
 
error_t sshFormatKexDhGexRequest (SshConnection *connection, uint8_t *p, size_t *length)
 Format SSH_MSG_KEX_DH_GEX_REQUEST message. More...
 
error_t sshFormatKexDhGexGroup (SshConnection *connection, uint8_t *p, size_t *length)
 Format SSH_MSG_KEX_DH_GEX_GROUP message. More...
 
error_t sshFormatKexDhGexInit (SshConnection *connection, uint8_t *p, size_t *length)
 Format SSH_MSG_KEX_DH_GEX_INIT message. More...
 
error_t sshFormatKexDhGexReply (SshConnection *connection, uint8_t *p, size_t *length)
 Format SSH_MSG_KEX_DH_GEX_REPLY message. More...
 
error_t sshParseKexDhGexRequest (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_KEX_DH_GEX_REQUEST message. More...
 
error_t sshParseKexDhGexRequestOld (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_KEX_DH_GEX_REQUEST_OLD message. More...
 
error_t sshParseKexDhGexGroup (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_KEX_DH_GEX_GROUP message. More...
 
error_t sshParseKexDhGexInit (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_KEX_DH_GEX_INIT message. More...
 
error_t sshParseKexDhGexReply (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_KEX_DH_GEX_REPLY message. More...
 
error_t sshParseKexDhGexMessage (SshConnection *connection, uint8_t type, const uint8_t *message, size_t length)
 Parse Diffie-Hellman Group Exchange specific messages. More...
 
int_t sshSelectDhGexGroup (SshContext *context, uint32_t minDhModulusSize, uint32_t preferredDhModulusSize, uint32_t maxDhModulusSize)
 Select a Diffie-Hellman group that best matches client's request. More...
 
error_t sshComputeDhGexSharedSecret (SshConnection *connection)
 Diffie-Hellman shared secret calculation. More...
 
error_t sshDigestDhGexParams (SshConnection *connection)
 Update exchange hash with min, n, max, p, g and e. More...
 

Detailed Description

DH GEX (Diffie-Hellman Group Exchange) key exchange.

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_kex_dh_gex.h.

Function Documentation

◆ sshComputeDhGexSharedSecret()

error_t sshComputeDhGexSharedSecret ( SshConnection connection)

Diffie-Hellman shared secret calculation.

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

Definition at line 1184 of file ssh_kex_dh_gex.c.

◆ sshDigestDhGexParams()

error_t sshDigestDhGexParams ( SshConnection connection)

Update exchange hash with min, n, max, p, g and e.

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

Definition at line 1214 of file ssh_kex_dh_gex.c.

◆ sshFormatKexDhGexGroup()

error_t sshFormatKexDhGexGroup ( SshConnection connection,
uint8_t *  p,
size_t *  length 
)

Format SSH_MSG_KEX_DH_GEX_GROUP message.

Parameters
[in]connectionPointer to the SSH connection
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 335 of file ssh_kex_dh_gex.c.

◆ sshFormatKexDhGexInit()

error_t sshFormatKexDhGexInit ( SshConnection connection,
uint8_t *  p,
size_t *  length 
)

Format SSH_MSG_KEX_DH_GEX_INIT message.

Parameters
[in]connectionPointer to the SSH connection
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 400 of file ssh_kex_dh_gex.c.

◆ sshFormatKexDhGexReply()

error_t sshFormatKexDhGexReply ( SshConnection connection,
uint8_t *  p,
size_t *  length 
)

Format SSH_MSG_KEX_DH_GEX_REPLY message.

Parameters
[in]connectionPointer to the SSH connection
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 443 of file ssh_kex_dh_gex.c.

◆ sshFormatKexDhGexRequest()

error_t sshFormatKexDhGexRequest ( SshConnection connection,
uint8_t *  p,
size_t *  length 
)

Format SSH_MSG_KEX_DH_GEX_REQUEST message.

Parameters
[in]connectionPointer to the SSH connection
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 294 of file ssh_kex_dh_gex.c.

◆ sshParseKexDhGexGroup()

error_t sshParseKexDhGexGroup ( SshConnection connection,
const uint8_t *  message,
size_t  length 
)

Parse SSH_MSG_KEX_DH_GEX_GROUP message.

Parameters
[in]connectionPointer to the SSH connection
[in]messagePointer to message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 690 of file ssh_kex_dh_gex.c.

◆ sshParseKexDhGexInit()

error_t sshParseKexDhGexInit ( SshConnection connection,
const uint8_t *  message,
size_t  length 
)

Parse SSH_MSG_KEX_DH_GEX_INIT message.

Parameters
[in]connectionPointer to the SSH connection
[in]messagePointer to message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 783 of file ssh_kex_dh_gex.c.

◆ sshParseKexDhGexMessage()

error_t sshParseKexDhGexMessage ( SshConnection connection,
uint8_t  type,
const uint8_t *  message,
size_t  length 
)

Parse Diffie-Hellman Group Exchange specific messages.

Parameters
[in]connectionPointer to the SSH connection
[in]typeSSH message type
[in]messagePointer to message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 1027 of file ssh_kex_dh_gex.c.

◆ sshParseKexDhGexReply()

error_t sshParseKexDhGexReply ( SshConnection connection,
const uint8_t *  message,
size_t  length 
)

Parse SSH_MSG_KEX_DH_GEX_REPLY message.

Parameters
[in]connectionPointer to the SSH connection
[in]messagePointer to message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 864 of file ssh_kex_dh_gex.c.

◆ sshParseKexDhGexRequest()

error_t sshParseKexDhGexRequest ( SshConnection connection,
const uint8_t *  message,
size_t  length 
)

Parse SSH_MSG_KEX_DH_GEX_REQUEST message.

Parameters
[in]connectionPointer to the SSH connection
[in]messagePointer to message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 537 of file ssh_kex_dh_gex.c.

◆ sshParseKexDhGexRequestOld()

error_t sshParseKexDhGexRequestOld ( SshConnection connection,
const uint8_t *  message,
size_t  length 
)

Parse SSH_MSG_KEX_DH_GEX_REQUEST_OLD message.

Parameters
[in]connectionPointer to the SSH connection
[in]messagePointer to message
[in]lengthLength of the message, in bytes
Returns
Error code

Definition at line 616 of file ssh_kex_dh_gex.c.

◆ sshSelectDhGexGroup()

int_t sshSelectDhGexGroup ( SshContext context,
uint32_t  minDhModulusSize,
uint32_t  preferredDhModulusSize,
uint32_t  maxDhModulusSize 
)

Select a Diffie-Hellman group that best matches client's request.

Parameters
[in]contextPointer to the SSH context
[in]minDhModulusSizeMinimum acceptable size for Diffie-Hellman prime modulus
[in]preferredDhModulusSizePreferred size for Diffie-Hellman prime modulus
[in]maxDhModulusSizeMaximum acceptable size for Diffie-Hellman prime modulus
Returns
Index of the selected Diffie-Hellman group, if any

Definition at line 1103 of file ssh_kex_dh_gex.c.

◆ sshSendKexDhGexGroup()

error_t sshSendKexDhGexGroup ( SshConnection connection)

Send SSH_MSG_KEX_DH_GEX_GROUP message.

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

Definition at line 105 of file ssh_kex_dh_gex.c.

◆ sshSendKexDhGexInit()

error_t sshSendKexDhGexInit ( SshConnection connection)

Send SSH_MSG_KEX_DH_GEX_INIT message.

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

Definition at line 176 of file ssh_kex_dh_gex.c.

◆ sshSendKexDhGexReply()

error_t sshSendKexDhGexReply ( SshConnection connection)

Send SSH_MSG_KEX_DH_GEX_REPLY message.

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

Definition at line 234 of file ssh_kex_dh_gex.c.

◆ sshSendKexDhGexRequest()

error_t sshSendKexDhGexRequest ( SshConnection connection)

Send SSH_MSG_KEX_DH_GEX_REQUEST message.

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

Definition at line 59 of file ssh_kex_dh_gex.c.