Add a skeleton TLS record method

It doesn't yet do anything. This is a placeholder which will be filled in
by susbsequent commits.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18132)
This commit is contained in:
Matt Caswell 2022-04-07 14:09:25 +01:00
parent 11653dcd6e
commit 34a4068cc4
2 changed files with 115 additions and 1 deletions

View File

@ -32,7 +32,7 @@ SOURCE[../libssl]=\
ssl_asn1.c ssl_txt.c ssl_init.c ssl_conf.c ssl_mcnf.c \
bio_ssl.c ssl_err.c ssl_err_legacy.c tls_srp.c t1_trce.c ssl_utst.c \
record/ssl3_buffer.c record/ssl3_record.c record/dtls1_bitmap.c \
statem/statem.c record/ssl3_record_tls13.c \
statem/statem.c record/ssl3_record_tls13.c record/tlsrecord.c\
tls_depr.c $KTLSSRC
# For shared builds we need to include the libcrypto packet.c and sources
# needed in providers (s3_cbc.c and record/tls_pad.c) in libssl as well.

114
ssl/record/tlsrecord.c Normal file
View File

@ -0,0 +1,114 @@
/*
* Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include "recordmethod.h"
struct ossl_record_layer_st
{
/* Placeholder until we have real data to store */
int dummy;
};
static OSSL_RECORD_LAYER *tls_new_record_layer(int vers, int role, int direction,
int level, unsigned char *secret,
size_t secretlen, SSL_CIPHER *c,
BIO *transport, BIO_ADDR *local,
BIO_ADDR *peer,
OSSL_PARAM *settings,
OSSL_PARAM *options)
{
OSSL_RECORD_LAYER *rl = OPENSSL_zalloc(sizeof(*rl));
return rl;
}
static void tls_free(OSSL_RECORD_LAYER *rl)
{
OPENSSL_free(rl);
}
static int tls_reset(OSSL_RECORD_LAYER *rl)
{
memset(rl, 0, sizeof(*rl));
return 1;
}
static int tls_unprocessed_read_pending(OSSL_RECORD_LAYER *rl)
{
return 0;
}
static int tls_processed_read_pending(OSSL_RECORD_LAYER *rl)
{
return 0;
}
static size_t tls_app_data_pending(OSSL_RECORD_LAYER *rl)
{
return 0;
}
static int tls_write_pending(OSSL_RECORD_LAYER *rl)
{
return 0;
}
static size_t tls_get_max_record_len(OSSL_RECORD_LAYER *rl)
{
return 0;
}
static size_t tls_get_max_records(OSSL_RECORD_LAYER *rl)
{
return 0;
}
static int tls_write_records(OSSL_RECORD_LAYER *rl,
OSSL_RECORD_TEMPLATE **templates, size_t numtempl,
size_t allowance, size_t *sent)
{
return 0;
}
static int tls_retry_write_records(OSSL_RECORD_LAYER *rl, size_t allowance,
size_t *sent)
{
return 0;
}
static int tls_read_record(OSSL_RECORD_LAYER *rl, void **rechandle,
int *rversion, int *type, unsigned char **data,
size_t *datalen, uint16_t *epoch,
unsigned char *seq_num)
{
return 0;
}
static void tls_release_record(OSSL_RECORD_LAYER *rl, void *rechandle)
{
return;
}
const OSSL_RECORD_METHOD ossl_tls_record_method = {
tls_new_record_layer,
tls_free,
tls_reset,
tls_unprocessed_read_pending,
tls_processed_read_pending,
tls_app_data_pending,
tls_write_pending,
tls_get_max_record_len,
tls_get_max_records,
tls_write_records,
tls_retry_write_records,
tls_read_record,
tls_release_record
};