ssh_auth.h
Go to the documentation of this file.
1 /**
2  * @file ssh_auth.h
3  * @brief SSH user authentication protocol
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSH Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _SSH_AUTH_H
32 #define _SSH_AUTH_H
33 
34 //Dependencies
35 #include "ssh/ssh.h"
36 
37 //C++ guard
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 
43 /**
44  * @brief Authentication methods
45  **/
46 
47 typedef enum
48 {
54 
55 
56 //SSH related functions
58  const char_t *banner);
59 
63 
66 
68  const char_t *banner, uint8_t *p, size_t *length);
69 
71  size_t *length);
72 
73 error_t sshFormatNoneAuthParams(SshConnection *connection, uint8_t *p,
74  size_t *written);
75 
76 error_t sshFormatUserAuthSuccess(SshConnection *connection, uint8_t *p,
77  size_t *length);
78 
79 error_t sshFormatUserAuthFailure(SshConnection *connection, uint8_t *p,
80  size_t *length);
81 
82 error_t sshFormatUserAuthMethods(SshConnection *connection, uint8_t *p,
83  size_t *written);
84 
86  const uint8_t *message, size_t length);
87 
89  const uint8_t *message, size_t length);
90 
92  const SshString *userName, const uint8_t *p, size_t length);
93 
95  const uint8_t *message, size_t length);
96 
98  const uint8_t *message, size_t length);
99 
101  const uint8_t *message, size_t length);
102 
104 
105 //C++ guard
106 #ifdef __cplusplus
107 }
108 #endif
109 
110 #endif
error_t sshFormatUserAuthMethods(SshConnection *connection, uint8_t *p, size_t *written)
Format the list of allowed authentication methods.
Definition: ssh_auth.c:563
error_t sshFormatUserAuthSuccess(SshConnection *connection, uint8_t *p, size_t *length)
Format SSH_MSG_USERAUTH_SUCCESS message.
Definition: ssh_auth.c:494
@ SSH_AUTH_METHOD_PASSWORD
Definition: ssh_auth.h:50
uint8_t p
Definition: ndp.h:300
uint8_t message[]
Definition: chap.h:154
error_t sshAcceptAuthRequest(SshConnection *connection)
Accept client's authentication request.
Definition: ssh_auth.c:263
error_t sshRejectAuthRequest(SshConnection *connection)
Reject client's authentication request.
Definition: ssh_auth.c:293
@ SSH_AUTH_METHOD_PUBLIC_KEY
Definition: ssh_auth.h:51
error_t sshFormatUserAuthFailure(SshConnection *connection, uint8_t *p, size_t *length)
Format SSH_MSG_USERAUTH_FAILURE message.
Definition: ssh_auth.c:516
error_t sshParseUserAuthRequest(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_USERAUTH_REQUEST message.
Definition: ssh_auth.c:717
uint8_t type
Definition: coap_common.h:176
SshAuthMethod sshGetAuthMethod(SshConnection *connection)
Get current authentication method.
Definition: ssh_auth.c:1147
error_t sshFormatUserAuthBanner(SshConnection *connection, const char_t *banner, uint8_t *p, size_t *length)
Format SSH_MSG_USERAUTH_BANNER message.
Definition: ssh_auth.c:327
error_t sshParseUserAuthSuccess(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_USERAUTH_SUCCESS message.
Definition: ssh_auth.c:929
error_t
Error codes.
Definition: error.h:43
error_t sshParseUserAuthMessage(SshConnection *connection, uint8_t type, const uint8_t *message, size_t length)
Parse authentication method specific method messages.
Definition: ssh_auth.c:1076
error_t sshParseUserAuthFailure(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_USERAUTH_FAILURE message.
Definition: ssh_auth.c:980
error_t sshSendUserAuthBanner(SshConnection *connection, const char_t *banner)
Send SSH_MSG_USERAUTH_BANNER message.
Definition: ssh_auth.c:67
uint8_t length
Definition: tcp.h:368
SshAuthMethod
Authentication methods.
Definition: ssh_auth.h:48
String.
Definition: ssh_types.h:56
char char_t
Definition: compiler_port.h:48
error_t sshSendUserAuthSuccess(SshConnection *connection)
Send SSH_MSG_USERAUTH_SUCCESS message.
Definition: ssh_auth.c:171
#define SshConnection
Definition: ssh.h:874
@ SSH_AUTH_METHOD_NONE
Definition: ssh_auth.h:49
@ SSH_AUTH_METHOD_HOST_BASED
Definition: ssh_auth.h:52
error_t sshParseNoneAuthParams(SshConnection *connection, const SshString *userName, const uint8_t *p, size_t length)
Parse "none" method specific fields.
Definition: ssh_auth.c:858
error_t sshSendUserAuthFailure(SshConnection *connection)
Send SSH_MSG_USERAUTH_FAILURE message.
Definition: ssh_auth.c:219
error_t sshFormatUserAuthRequest(SshConnection *connection, uint8_t *message, size_t *length)
Format SSH_MSG_USERAUTH_REQUEST message.
Definition: ssh_auth.c:376
error_t sshParseUserAuthBanner(SshConnection *connection, const uint8_t *message, size_t length)
Parse SSH_MSG_USERAUTH_BANNER message.
Definition: ssh_auth.c:640
error_t sshSendUserAuthRequest(SshConnection *connection)
Send SSH_MSG_USERAUTH_REQUEST message.
Definition: ssh_auth.c:109
Secure Shell (SSH)
error_t sshFormatNoneAuthParams(SshConnection *connection, uint8_t *p, size_t *written)
Format "none" method specific fields.
Definition: ssh_auth.c:470