ssh_auth.h File Reference

SSH user authentication protocol. More...

#include "ssh/ssh.h"

Go to the source code of this file.

Enumerations

enum  SshAuthMethod { SSH_AUTH_METHOD_NONE = 0, SSH_AUTH_METHOD_PASSWORD = 1, SSH_AUTH_METHOD_PUBLIC_KEY = 2, SSH_AUTH_METHOD_HOST_BASED = 3 }
 Authentication methods. More...
 

Functions

error_t sshSendUserAuthBanner (SshConnection *connection, const char_t *banner)
 Send SSH_MSG_USERAUTH_BANNER message. More...
 
error_t sshSendUserAuthRequest (SshConnection *connection)
 Send SSH_MSG_USERAUTH_REQUEST message. More...
 
error_t sshSendUserAuthSuccess (SshConnection *connection)
 Send SSH_MSG_USERAUTH_SUCCESS message. More...
 
error_t sshSendUserAuthFailure (SshConnection *connection)
 Send SSH_MSG_USERAUTH_FAILURE message. More...
 
error_t sshAcceptAuthRequest (SshConnection *connection)
 Accept client's authentication request. More...
 
error_t sshRejectAuthRequest (SshConnection *connection)
 Reject client's authentication request. More...
 
error_t sshFormatUserAuthBanner (SshConnection *connection, const char_t *banner, uint8_t *p, size_t *length)
 Format SSH_MSG_USERAUTH_BANNER message. More...
 
error_t sshFormatUserAuthRequest (SshConnection *connection, uint8_t *message, size_t *length)
 Format SSH_MSG_USERAUTH_REQUEST message. More...
 
error_t sshFormatNoneAuthParams (SshConnection *connection, uint8_t *p, size_t *written)
 Format "none" method specific fields. More...
 
error_t sshFormatUserAuthSuccess (SshConnection *connection, uint8_t *p, size_t *length)
 Format SSH_MSG_USERAUTH_SUCCESS message. More...
 
error_t sshFormatUserAuthFailure (SshConnection *connection, uint8_t *p, size_t *length)
 Format SSH_MSG_USERAUTH_FAILURE message. More...
 
error_t sshFormatUserAuthMethods (SshConnection *connection, uint8_t *p, size_t *written)
 Format the list of allowed authentication methods. More...
 
error_t sshParseUserAuthBanner (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_USERAUTH_BANNER message. More...
 
error_t sshParseUserAuthRequest (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_USERAUTH_REQUEST message. More...
 
error_t sshParseNoneAuthParams (SshConnection *connection, const SshString *userName, const uint8_t *p, size_t length)
 Parse "none" method specific fields. More...
 
error_t sshParseUserAuthSuccess (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_USERAUTH_SUCCESS message. More...
 
error_t sshParseUserAuthFailure (SshConnection *connection, const uint8_t *message, size_t length)
 Parse SSH_MSG_USERAUTH_FAILURE message. More...
 
error_t sshParseUserAuthMessage (SshConnection *connection, uint8_t type, const uint8_t *message, size_t length)
 Parse authentication method specific method messages. More...
 
SshAuthMethod sshGetAuthMethod (SshConnection *connection)
 Get current authentication method. More...
 

Detailed Description

SSH user authentication protocol.

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

Enumeration Type Documentation

◆ SshAuthMethod

Authentication methods.

Enumerator
SSH_AUTH_METHOD_NONE 
SSH_AUTH_METHOD_PASSWORD 
SSH_AUTH_METHOD_PUBLIC_KEY 
SSH_AUTH_METHOD_HOST_BASED 

Definition at line 47 of file ssh_auth.h.

Function Documentation

◆ sshAcceptAuthRequest()

error_t sshAcceptAuthRequest ( SshConnection connection)

Accept client's authentication request.

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

Definition at line 263 of file ssh_auth.c.

◆ sshFormatNoneAuthParams()

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

Format "none" method specific fields.

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

Definition at line 470 of file ssh_auth.c.

◆ sshFormatUserAuthBanner()

error_t sshFormatUserAuthBanner ( SshConnection connection,
const char_t banner,
uint8_t *  p,
size_t *  length 
)

Format SSH_MSG_USERAUTH_BANNER message.

Parameters
[in]connectionPointer to the SSH connection
[in]bannerNULL-terminated string containing the banner message
[out]pBuffer where to format the message
[out]lengthLength of the resulting message, in bytes
Returns
Error code

Definition at line 327 of file ssh_auth.c.

◆ sshFormatUserAuthFailure()

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

Format SSH_MSG_USERAUTH_FAILURE 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 516 of file ssh_auth.c.

◆ sshFormatUserAuthMethods()

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

Format the list of allowed authentication methods.

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

Definition at line 563 of file ssh_auth.c.

◆ sshFormatUserAuthRequest()

error_t sshFormatUserAuthRequest ( SshConnection connection,
uint8_t *  message,
size_t *  length 
)

Format SSH_MSG_USERAUTH_REQUEST message.

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

Definition at line 376 of file ssh_auth.c.

◆ sshFormatUserAuthSuccess()

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

Format SSH_MSG_USERAUTH_SUCCESS 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 494 of file ssh_auth.c.

◆ sshGetAuthMethod()

SshAuthMethod sshGetAuthMethod ( SshConnection connection)

Get current authentication method.

Returns
Authentication method (password or public key authentication)

Definition at line 1147 of file ssh_auth.c.

◆ sshParseNoneAuthParams()

error_t sshParseNoneAuthParams ( SshConnection connection,
const SshString userName,
const uint8_t *  p,
size_t  length 
)

Parse "none" method specific fields.

Parameters
[in]connectionPointer to the SSH connection
[in]userNamePointer to the user name
[in]pPointer to method specific fields
[in]lengthLength of the method specific fields, in bytes
Returns
Error code

Definition at line 858 of file ssh_auth.c.

◆ sshParseUserAuthBanner()

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

Parse SSH_MSG_USERAUTH_BANNER 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 640 of file ssh_auth.c.

◆ sshParseUserAuthFailure()

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

Parse SSH_MSG_USERAUTH_FAILURE 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 980 of file ssh_auth.c.

◆ sshParseUserAuthMessage()

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

Parse authentication method specific method 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 1076 of file ssh_auth.c.

◆ sshParseUserAuthRequest()

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

Parse SSH_MSG_USERAUTH_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 717 of file ssh_auth.c.

◆ sshParseUserAuthSuccess()

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

Parse SSH_MSG_USERAUTH_SUCCESS 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 929 of file ssh_auth.c.

◆ sshRejectAuthRequest()

error_t sshRejectAuthRequest ( SshConnection connection)

Reject client's authentication request.

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

Definition at line 293 of file ssh_auth.c.

◆ sshSendUserAuthBanner()

error_t sshSendUserAuthBanner ( SshConnection connection,
const char_t banner 
)

Send SSH_MSG_USERAUTH_BANNER message.

Parameters
[in]connectionPointer to the SSH connection
[in]bannerNULL-terminated string containing the banner message
Returns
Error code

Definition at line 67 of file ssh_auth.c.

◆ sshSendUserAuthFailure()

error_t sshSendUserAuthFailure ( SshConnection connection)

Send SSH_MSG_USERAUTH_FAILURE message.

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

Definition at line 219 of file ssh_auth.c.

◆ sshSendUserAuthRequest()

error_t sshSendUserAuthRequest ( SshConnection connection)

Send SSH_MSG_USERAUTH_REQUEST message.

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

Definition at line 109 of file ssh_auth.c.

◆ sshSendUserAuthSuccess()

error_t sshSendUserAuthSuccess ( SshConnection connection)

Send SSH_MSG_USERAUTH_SUCCESS message.

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

Definition at line 171 of file ssh_auth.c.