modbus_server_security.c File Reference

Modbus/TCP security layer. More...

#include "core/net.h"
#include "modbus/modbus_server.h"
#include "modbus/modbus_server_security.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL
 

Functions

error_t modbusServerParseCertificate (TlsContext *tlsContext, const X509CertInfo *certInfo, uint_t pathLen, void *param)
 Parse client's certificate. More...
 
error_t modbusServerParseRoleOid (ModbusClientConnection *connection, const uint8_t *data, size_t length)
 Parse client role OID. More...
 
error_t modbusServerOpenSecureConnection (ModbusServerContext *context, ModbusClientConnection *connection)
 Open secure connection. More...
 
error_t modbusServerEstablishSecureConnection (ModbusClientConnection *connection)
 Establish secure connection. More...
 

Variables

const uint8_t MODBUS_ROLE_OID [11] = {0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x89, 0x0C, 0x86, 0x22, 0x01}
 

Detailed Description

Modbus/TCP security layer.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP 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 modbus_server_security.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   MODBUS_TRACE_LEVEL

Definition at line 32 of file modbus_server_security.c.

Function Documentation

◆ modbusServerEstablishSecureConnection()

error_t modbusServerEstablishSecureConnection ( ModbusClientConnection connection)

Establish secure connection.

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

Definition at line 234 of file modbus_server_security.c.

◆ modbusServerOpenSecureConnection()

error_t modbusServerOpenSecureConnection ( ModbusServerContext context,
ModbusClientConnection connection 
)

Open secure connection.

Parameters
[in]contextPointer to the Modbus/TCP server context
[in]connectionPointer to the client connection
Returns
Error code

Definition at line 159 of file modbus_server_security.c.

◆ modbusServerParseCertificate()

error_t modbusServerParseCertificate ( TlsContext tlsContext,
const X509CertInfo certInfo,
uint_t  pathLen,
void *  param 
)

Parse client's certificate.

Parameters
[in]tlsContextPointer to the TLS context
[in]certInfoPointer to the X.509 certificate
[in]pathLenCertificate path length
[in]paramHandle referencing a Modbus/TCP client connection
Returns
Error code

Definition at line 56 of file modbus_server_security.c.

◆ modbusServerParseRoleOid()

error_t modbusServerParseRoleOid ( ModbusClientConnection connection,
const uint8_t *  data,
size_t  length 
)

Parse client role OID.

Parameters
[in]connectionPointer to the client connection
[in]dataPointer to the ASN.1 structure to parse
[in]lengthLength of the ASN.1 structure
Returns
Error code

Definition at line 119 of file modbus_server_security.c.

Variable Documentation

◆ MODBUS_ROLE_OID

const uint8_t MODBUS_ROLE_OID[11] = {0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0x89, 0x0C, 0x86, 0x22, 0x01}

Definition at line 44 of file modbus_server_security.c.