TLS record protocol. More...
#include "tls.h"
Go to the source code of this file.
Functions | |
error_t | tlsWriteProtocolData (TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType) |
Write protocol data. More... | |
error_t | tlsReadProtocolData (TlsContext *context, uint8_t **data, size_t *length, TlsContentType *contentType) |
Read protocol data. More... | |
error_t | tlsWriteRecord (TlsContext *context, const uint8_t *data, size_t length, TlsContentType contentType) |
Send a TLS record. More... | |
error_t | tlsReadRecord (TlsContext *context, uint8_t *data, size_t size, size_t *length, TlsContentType *contentType) |
Receive a TLS record. More... | |
error_t | tlsProcessRecord (TlsContext *context, TlsRecord *record) |
Process incoming TLS record. More... | |
void | tlsSetRecordType (TlsContext *context, void *record, uint8_t type) |
Set TLS record type. More... | |
uint8_t | tlsGetRecordType (TlsContext *context, void *record) |
Get TLS record type. More... | |
void | tlsSetRecordLength (TlsContext *context, void *record, size_t length) |
Set TLS record length. More... | |
size_t | tlsGetRecordLength (TlsContext *context, void *record) |
Get TLS record length. More... | |
uint8_t * | tlsGetRecordData (TlsContext *context, void *record) |
Get TLS record payload. More... | |
void | tlsFormatAad (TlsContext *context, TlsEncryptionEngine *encryptionEngine, const void *record, uint8_t *aad, size_t *aadLen) |
Format additional authenticated data (AAD) More... | |
void | tlsFormatNonce (TlsContext *context, TlsEncryptionEngine *encryptionEngine, const void *record, const uint8_t *recordIv, uint8_t *nonce, size_t *nonceLen) |
Format nonce. More... | |
void | tlsIncSequenceNumber (TlsSequenceNumber *seqNum) |
Increment sequence number. More... | |
Detailed Description
TLS record protocol.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneSSL 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 tls_record.h.
Function Documentation
◆ tlsFormatAad()
void tlsFormatAad | ( | TlsContext * | context, |
TlsEncryptionEngine * | encryptionEngine, | ||
const void * | record, | ||
uint8_t * | aad, | ||
size_t * | aadLen | ||
) |
Format additional authenticated data (AAD)
- Parameters
-
[in] context Pointer to the TLS context [in] encryptionEngine Pointer to the encryption engine [in] record Pointer to the TLS record [out] aad Pointer to the buffer where to store the resulting AAD [out] aadLen Length of the AAD, in bytes
Definition at line 905 of file tls_record.c.
◆ tlsFormatNonce()
void tlsFormatNonce | ( | TlsContext * | context, |
TlsEncryptionEngine * | encryptionEngine, | ||
const void * | record, | ||
const uint8_t * | recordIv, | ||
uint8_t * | nonce, | ||
size_t * | nonceLen | ||
) |
Format nonce.
- Parameters
-
[in] context Pointer to the TLS context [in] encryptionEngine Pointer to the encryption engine [in] record Pointer to the TLS record [in] recordIv Explicit part of the nonce [out] nonce Pointer to the buffer where to store the resulting nonce [out] nonceLen Length of the nonce, in bytes
Definition at line 963 of file tls_record.c.
◆ tlsGetRecordData()
uint8_t* tlsGetRecordData | ( | TlsContext * | context, |
void * | record | ||
) |
Get TLS record payload.
- Parameters
-
[in] context Pointer to the TLS context [in] record Pointer to the TLS record
- Returns
- Pointer to the first byte of the payload
Definition at line 872 of file tls_record.c.
◆ tlsGetRecordLength()
size_t tlsGetRecordLength | ( | TlsContext * | context, |
void * | record | ||
) |
Get TLS record length.
- Parameters
-
[in] context Pointer to the TLS context [in] record Pointer to the TLS record
- Returns
- Record length
Definition at line 841 of file tls_record.c.
◆ tlsGetRecordType()
uint8_t tlsGetRecordType | ( | TlsContext * | context, |
void * | record | ||
) |
Get TLS record type.
- Parameters
-
[in] context Pointer to the TLS context [in] record Pointer to the TLS record
- Returns
- Record type
Definition at line 784 of file tls_record.c.
◆ tlsIncSequenceNumber()
void tlsIncSequenceNumber | ( | TlsSequenceNumber * | seqNum | ) |
Increment sequence number.
- Parameters
-
[in,out] seqNum Pointer to the 64-bit sequence number
Definition at line 1030 of file tls_record.c.
◆ tlsProcessRecord()
error_t tlsProcessRecord | ( | TlsContext * | context, |
TlsRecord * | record | ||
) |
Process incoming TLS record.
- Parameters
-
[in] context Pointer to the TLS context [in] record Pointer to the received TLS record
- Returns
- Error code
Definition at line 626 of file tls_record.c.
◆ tlsReadProtocolData()
error_t tlsReadProtocolData | ( | TlsContext * | context, |
uint8_t ** | data, | ||
size_t * | length, | ||
TlsContentType * | contentType | ||
) |
Read protocol data.
- Parameters
-
[in] context Pointer to the TLS context [out] data Pointer to the received data [out] length Number of data bytes that were received [out] contentType Higher level protocol
- Returns
- Error code
Definition at line 157 of file tls_record.c.
◆ tlsReadRecord()
error_t tlsReadRecord | ( | TlsContext * | context, |
uint8_t * | data, | ||
size_t | size, | ||
size_t * | length, | ||
TlsContentType * | contentType | ||
) |
Receive a TLS record.
- Parameters
-
[in] context Pointer to the TLS context [out] data Buffer where to store the record data [in] size Maximum acceptable size for the incoming record [out] length Length of the record data [out] contentType Record type
- Returns
- Error code
Definition at line 455 of file tls_record.c.
◆ tlsSetRecordLength()
void tlsSetRecordLength | ( | TlsContext * | context, |
void * | record, | ||
size_t | length | ||
) |
Set TLS record length.
- Parameters
-
[in] context Pointer to the TLS context [in] record Pointer to the TLS record [in] length Record length
Definition at line 815 of file tls_record.c.
◆ tlsSetRecordType()
void tlsSetRecordType | ( | TlsContext * | context, |
void * | record, | ||
uint8_t | type | ||
) |
Set TLS record type.
- Parameters
-
[in] context Pointer to the TLS context [in] record Pointer to the TLS record [in] type Record type
Definition at line 758 of file tls_record.c.
◆ tlsWriteProtocolData()
error_t tlsWriteProtocolData | ( | TlsContext * | context, |
const uint8_t * | data, | ||
size_t | length, | ||
TlsContentType | contentType | ||
) |
Write protocol data.
- Parameters
-
[in] context Pointer to the TLS context [in] data Pointer to the data buffer [in] length Number of data bytes to be written [in] contentType Higher level protocol
- Returns
- Error code
Definition at line 54 of file tls_record.c.
◆ tlsWriteRecord()
error_t tlsWriteRecord | ( | TlsContext * | context, |
const uint8_t * | data, | ||
size_t | length, | ||
TlsContentType | contentType | ||
) |
Send a TLS record.
- Parameters
-
[in] context Pointer to the TLS context [in] data Pointer to the record data [in] length Length of the record data [in] contentType Record type
- Returns
- Error code
Definition at line 350 of file tls_record.c.