From: Matt Caswell Date: Thu, 7 Apr 2022 13:09:25 +0000 (+0100) Subject: Add a skeleton TLS record method X-Git-Tag: openssl-3.2.0-alpha1~2257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34a4068cc402c38e2134a6b46d9633ad3112bfa5;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18132) --- diff --git a/ssl/build.info b/ssl/build.info index 2ecf5ccd225..70b22954d31 100644 --- a/ssl/build.info +++ b/ssl/build.info @@ -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. diff --git a/ssl/record/tlsrecord.c b/ssl/record/tlsrecord.c new file mode 100644 index 00000000000..51fb5687a8d --- /dev/null +++ b/ssl/record/tlsrecord.c @@ -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 +#include +#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 +};