TianoCore EDK2 master
Loading...
Searching...
No Matches
TlsProcessNull.c File Reference
#include "InternalTlsLib.h"

Go to the source code of this file.

Functions

BOOLEAN EFIAPI TlsInHandshake (IN VOID *Tls)
 
EFI_STATUS EFIAPI TlsDoHandshake (IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OPTIONAL, IN OUT UINTN *BufferOutSize)
 
EFI_STATUS EFIAPI TlsHandleAlert (IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OPTIONAL, IN OUT UINTN *BufferOutSize)
 
EFI_STATUS EFIAPI TlsCloseNotify (IN VOID *Tls, IN OUT UINT8 *Buffer, IN OUT UINTN *BufferSize)
 
INTN EFIAPI TlsCtrlTrafficOut (IN VOID *Tls, IN OUT VOID *Buffer, IN UINTN BufferSize)
 
INTN EFIAPI TlsCtrlTrafficIn (IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize)
 
INTN EFIAPI TlsRead (IN VOID *Tls, IN OUT VOID *Buffer, IN UINTN BufferSize)
 
INTN EFIAPI TlsWrite (IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize)
 
EFI_STATUS EFIAPI TlsShutdown (IN VOID *Tls)
 

Detailed Description

SSL/TLS Process Null Library Wrapper Implementation. The process includes the TLS handshake and packet I/O.

Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file TlsProcessNull.c.

Function Documentation

◆ TlsCloseNotify()

EFI_STATUS EFIAPI TlsCloseNotify ( IN VOID *  Tls,
IN OUT UINT8 *  Buffer,
IN OUT UINTN BufferSize 
)

Build the CloseNotify packet.

Parameters
[in]TlsPointer to the TLS object for state checking.
[in,out]BufferPointer to the buffer to hold the built packet.
[in,out]BufferSizePointer to the buffer size in bytes. On input, it is the buffer size provided by the caller. On output, it is the buffer size in fact needed to contain the packet.
Return values
EFI_SUCCESSThe required TLS packet is built successfully.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: Tls is NULL. BufferSize is NULL. Buffer is NULL if *BufferSize is not zero.
EFI_BUFFER_TOO_SMALLBufferSize is too small to hold the response packet.

Definition at line 133 of file TlsProcessNull.c.

◆ TlsCtrlTrafficIn()

INTN EFIAPI TlsCtrlTrafficIn ( IN VOID *  Tls,
IN VOID *  Buffer,
IN UINTN  BufferSize 
)

Attempts to write data from the buffer to TLS object.

This function will attempt to write BufferSize bytes data from the Buffer to the TLS object.

Parameters
[in]TlsPointer to the TLS object.
[in]BufferPointer to the data buffer.
[in]BufferSizeThe size of Buffer in bytes.
Return values
>0The amount of data successfully written to the TLS object.
<=0No data was successfully written.

Definition at line 185 of file TlsProcessNull.c.

◆ TlsCtrlTrafficOut()

INTN EFIAPI TlsCtrlTrafficOut ( IN VOID *  Tls,
IN OUT VOID *  Buffer,
IN UINTN  BufferSize 
)

Attempts to read bytes from one TLS object and places the data in Buffer.

This function will attempt to read BufferSize bytes from the TLS object and places the data in Buffer.

Parameters
[in]TlsPointer to the TLS object.
[in,out]BufferPointer to the buffer to store the data.
[in]BufferSizeThe size of Buffer in bytes.
Return values
>0The amount of data successfully read from the TLS object.
<=0No data was successfully read.

Definition at line 159 of file TlsProcessNull.c.

◆ TlsDoHandshake()

EFI_STATUS EFIAPI TlsDoHandshake ( IN VOID *  Tls,
IN UINT8 *BufferIn  OPTIONAL,
IN UINTN BufferInSize  OPTIONAL,
OUT UINT8 *BufferOut  OPTIONAL,
IN OUT UINTN BufferOutSize 
)

Perform a TLS/SSL handshake.

This function will perform a TLS/SSL handshake.

Parameters
[in]TlsPointer to the TLS object for handshake operation.
[in]BufferInPointer to the most recently received TLS Handshake packet.
[in]BufferInSizePacket size in bytes for the most recently received TLS Handshake packet.
[out]BufferOutPointer to the buffer to hold the built packet.
[in,out]BufferOutSizePointer to the buffer size in bytes. On input, it is the buffer size provided by the caller. On output, it is the buffer size in fact needed to contain the packet.
Return values
EFI_SUCCESSThe required TLS packet is built successfully.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: Tls is NULL. BufferIn is NULL but BufferInSize is NOT 0. BufferInSize is 0 but BufferIn is NOT NULL. BufferOutSize is NULL. BufferOut is NULL if *BufferOutSize is not zero.
EFI_BUFFER_TOO_SMALLBufferOutSize is too small to hold the response packet.
EFI_ABORTEDSomething wrong during handshake.

Definition at line 62 of file TlsProcessNull.c.

◆ TlsHandleAlert()

EFI_STATUS EFIAPI TlsHandleAlert ( IN VOID *  Tls,
IN UINT8 *BufferIn  OPTIONAL,
IN UINTN BufferInSize  OPTIONAL,
OUT UINT8 *BufferOut  OPTIONAL,
IN OUT UINTN BufferOutSize 
)

Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero, TLS session has errors and the response packet needs to be Alert message based on error type.

Parameters
[in]TlsPointer to the TLS object for state checking.
[in]BufferInPointer to the most recently received TLS Alert packet.
[in]BufferInSizePacket size in bytes for the most recently received TLS Alert packet.
[out]BufferOutPointer to the buffer to hold the built packet.
[in,out]BufferOutSizePointer to the buffer size in bytes. On input, it is the buffer size provided by the caller. On output, it is the buffer size in fact needed to contain the packet.
Return values
EFI_SUCCESSThe required TLS packet is built successfully.
EFI_INVALID_PARAMETEROne or more of the following conditions is TRUE: Tls is NULL. BufferIn is NULL but BufferInSize is NOT 0. BufferInSize is 0 but BufferIn is NOT NULL. BufferOutSize is NULL. BufferOut is NULL if *BufferOutSize is not zero.
EFI_ABORTEDAn error occurred.
EFI_BUFFER_TOO_SMALLBufferOutSize is too small to hold the response packet.

Definition at line 101 of file TlsProcessNull.c.

◆ TlsInHandshake()

BOOLEAN EFIAPI TlsInHandshake ( IN VOID *  Tls)

Checks if the TLS handshake was done.

This function will check if the specified TLS handshake was done.

Parameters
[in]TlsPointer to the TLS object for handshake state checking.
Return values
TRUEThe TLS handshake was done.
FALSEThe TLS handshake was not done.

Definition at line 26 of file TlsProcessNull.c.

◆ TlsRead()

INTN EFIAPI TlsRead ( IN VOID *  Tls,
IN OUT VOID *  Buffer,
IN UINTN  BufferSize 
)

Attempts to read bytes from the specified TLS connection into the buffer.

This function tries to read BufferSize bytes data from the specified TLS connection into the Buffer.

Parameters
[in]TlsPointer to the TLS connection for data reading.
[in,out]BufferPointer to the data buffer.
[in]BufferSizeThe size of Buffer in bytes.
Return values
>0The read operation was successful, and return value is the number of bytes actually read from the TLS connection.
<=0The read operation was not successful.

Definition at line 212 of file TlsProcessNull.c.

◆ TlsShutdown()

EFI_STATUS EFIAPI TlsShutdown ( IN VOID *  Tls)

Shutdown a TLS connection.

Shutdown the TLS connection without releasing the resources, meaning a new connection can be started without calling TlsNew() and without setting certificates etc.

Parameters
[in]TlsPointer to the TLS object to shutdown.
Return values
EFI_SUCCESSThe TLS is shutdown successfully.
EFI_INVALID_PARAMETERTls is NULL.
EFI_PROTOCOL_ERRORSome other error occurred.

Definition at line 264 of file TlsProcessNull.c.

◆ TlsWrite()

INTN EFIAPI TlsWrite ( IN VOID *  Tls,
IN VOID *  Buffer,
IN UINTN  BufferSize 
)

Attempts to write data to a TLS connection.

This function tries to write BufferSize bytes data from the Buffer into the specified TLS connection.

Parameters
[in]TlsPointer to the TLS connection for data writing.
[in]BufferPointer to the data buffer.
[in]BufferSizeThe size of Buffer in bytes.
Return values
>0The write operation was successful, and return value is the number of bytes actually written to the TLS connection.
<=0The write operation was not successful.

Definition at line 239 of file TlsProcessNull.c.