SSH packet encryption/decryption. More...
#include "ssh/ssh.h"
#include "ssh/ssh_extensions.h"
#include "ssh/ssh_transport.h"
#include "ssh/ssh_auth.h"
#include "ssh/ssh_kex.h"
#include "ssh/ssh_connection.h"
#include "ssh/ssh_request.h"
#include "ssh/ssh_packet.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL SSH_TRACE_LEVEL |
Functions | |
error_t | sshSendPacket (SshConnection *connection, uint8_t *payload, size_t payloadLen) |
Send SSH packet. More... | |
error_t | sshReceivePacket (SshConnection *connection) |
Receive SSH packet. More... | |
error_t | sshParsePacket (SshConnection *connection, uint8_t *packet, size_t length) |
Parse SSH packet. More... | |
error_t | sshEncryptPacket (SshConnection *connection, uint8_t *packet, size_t *length) |
Encrypt an outgoing SSH packet. More... | |
error_t | sshDecryptPacket (SshConnection *connection, uint8_t *packet, size_t *length) |
Decrypt an incoming SSH packet. More... | |
error_t | sshParsePacketLength (SshConnection *connection, uint8_t *packet) |
Retrieve the length of an incoming SSH packet. More... | |
error_t | sshDecryptPacketLength (SshConnection *connection, uint8_t *packet) |
Decrypt the length field of an incoming SSH packet. More... | |
error_t | sshParseMessage (SshConnection *connection, const uint8_t *message, size_t length) |
Parse SSH message. More... | |
void | sshAppendMessageAuthCode (SshEncryptionEngine *encryptionEngine, uint8_t *packet, size_t length) |
Compute message authentication code. More... | |
error_t | sshVerifyMessageAuthCode (SshEncryptionEngine *decryptionEngine, const uint8_t *packet, size_t length) |
Verify message authentication code. More... | |
void | sshIncSequenceNumber (uint8_t *seqNum) |
Increment sequence number. More... | |
void | sshIncInvocationCounter (uint8_t *iv) |
Increment invocation counter. More... | |
Detailed Description
SSH packet encryption/decryption.
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.
- Version
- 2.4.4
Definition in file ssh_packet.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL SSH_TRACE_LEVEL |
Definition at line 32 of file ssh_packet.c.
Function Documentation
◆ sshAppendMessageAuthCode()
void sshAppendMessageAuthCode | ( | SshEncryptionEngine * | encryptionEngine, |
uint8_t * | packet, | ||
size_t | length | ||
) |
Compute message authentication code.
- Parameters
-
[in] encryptionEngine Pointer to the encryption engine [in] packet Pointer to the packet to be authenticated [in] length of the packet, in bytes
Definition at line 1338 of file ssh_packet.c.
◆ sshDecryptPacket()
error_t sshDecryptPacket | ( | SshConnection * | connection, |
uint8_t * | packet, | ||
size_t * | length | ||
) |
Decrypt an incoming SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection [in,out] packet SSH packet to be decrypted [in,out] length Actual length of the SSH packet
- Returns
- Error code
Definition at line 677 of file ssh_packet.c.
◆ sshDecryptPacketLength()
error_t sshDecryptPacketLength | ( | SshConnection * | connection, |
uint8_t * | packet | ||
) |
Decrypt the length field of an incoming SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection [in,out] packet Pointer to the first block of data
- Returns
- Error code
Definition at line 950 of file ssh_packet.c.
◆ sshEncryptPacket()
error_t sshEncryptPacket | ( | SshConnection * | connection, |
uint8_t * | packet, | ||
size_t * | length | ||
) |
Encrypt an outgoing SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection [in,out] packet SSH packet to be encrypted [in,out] length Actual length of the SSH packet
- Returns
- Error code
Definition at line 467 of file ssh_packet.c.
◆ sshIncInvocationCounter()
void sshIncInvocationCounter | ( | uint8_t * | iv | ) |
Increment invocation counter.
- Parameters
-
[in,out] iv Pointer to the 12-octet initialization vector
Definition at line 1433 of file ssh_packet.c.
◆ sshIncSequenceNumber()
void sshIncSequenceNumber | ( | uint8_t * | seqNum | ) |
Increment sequence number.
- Parameters
-
[in,out] seqNum Pointer to the 32-bit sequence number
Definition at line 1412 of file ssh_packet.c.
◆ sshParseMessage()
error_t sshParseMessage | ( | SshConnection * | connection, |
const uint8_t * | message, | ||
size_t | length | ||
) |
Parse SSH message.
- Parameters
-
[in] connection Pointer to the SSH connection [in] message Pointer to received message [in] length Length of the message, in bytes
- Returns
- Error code
Definition at line 1129 of file ssh_packet.c.
◆ sshParsePacket()
error_t sshParsePacket | ( | SshConnection * | connection, |
uint8_t * | packet, | ||
size_t | length | ||
) |
Parse SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection [in] packet Pointer to the received SSH packet [in] length Length of the packet, in bytes
- Returns
- Error code
Definition at line 332 of file ssh_packet.c.
◆ sshParsePacketLength()
error_t sshParsePacketLength | ( | SshConnection * | connection, |
uint8_t * | packet | ||
) |
Retrieve the length of an incoming SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection [in] packet Pointer to the received SSH packet
- Returns
- Error code
Definition at line 913 of file ssh_packet.c.
◆ sshReceivePacket()
error_t sshReceivePacket | ( | SshConnection * | connection | ) |
Receive SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection
- Returns
- Error code
Definition at line 178 of file ssh_packet.c.
◆ sshSendPacket()
error_t sshSendPacket | ( | SshConnection * | connection, |
uint8_t * | payload, | ||
size_t | payloadLen | ||
) |
Send SSH packet.
- Parameters
-
[in] connection Pointer to the SSH connection [in] payload Pointer to the payload data [in] payloadLen Length of the payload data, in bytes
- Returns
- Error code
Definition at line 57 of file ssh_packet.c.
◆ sshVerifyMessageAuthCode()
error_t sshVerifyMessageAuthCode | ( | SshEncryptionEngine * | decryptionEngine, |
const uint8_t * | packet, | ||
size_t | length | ||
) |
Verify message authentication code.
- Parameters
-
[in] decryptionEngine Pointer to the decryption engine [in] packet Pointer to the packet to be authenticated [in] length of the packet, in bytes
- Returns
- Error code
Definition at line 1368 of file ssh_packet.c.