From 99e1cc7bcae2e3707913881d7108c92b7a9bf7a1 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Fri, 13 May 2022 15:34:22 +0200 Subject: [PATCH] Add empty implementations of quic method functions Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/18307) --- ssl/build.info | 4 +++ ssl/quic/build.info | 3 ++ ssl/quic/quic_impl.c | 82 ++++++++++++++++++++++++++++++++++++++++++ ssl/quic/quic_local.h | 71 ++++++++++++++++++++++++++++++++++++ ssl/quic/quic_method.c | 27 ++++++++++++++ 5 files changed, 187 insertions(+) create mode 100644 ssl/quic/build.info create mode 100644 ssl/quic/quic_impl.c create mode 100644 ssl/quic/quic_local.h create mode 100644 ssl/quic/quic_method.c diff --git a/ssl/build.info b/ssl/build.info index fd13ede5e8..31355f00e0 100644 --- a/ssl/build.info +++ b/ssl/build.info @@ -1,5 +1,9 @@ LIBS=../libssl +IF[{- !$disabled{quic} -}] + SUBDIRS=quic +ENDIF + #Needed for the multiblock code in rec_layer_s3.c IF[{- !$disabled{asm} -}] $AESDEF_x86=AES_ASM diff --git a/ssl/quic/build.info b/ssl/quic/build.info new file mode 100644 index 0000000000..f9578454e8 --- /dev/null +++ b/ssl/quic/build.info @@ -0,0 +1,3 @@ +$LIBSSL=../../libssl + +SOURCE[$LIBSSL]=quic_method.c quic_impl.c diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c new file mode 100644 index 0000000000..bc10a4b615 --- /dev/null +++ b/ssl/quic/quic_impl.c @@ -0,0 +1,82 @@ +/* + * 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 "quic_local.h" + +__owur int ossl_quic_new(SSL *s) +{ + return s->method->ssl_clear(s); +} + +void ossl_quic_free(SSL *s) +{ + return; +} + +int ossl_quic_clear(SSL *s) +{ + return 1; +} + +__owur int ossl_quic_accept(SSL *s) +{ + return 1; +} + +__owur int ossl_quic_connect(SSL *s) +{ + return 1; +} + +__owur int ossl_quic_read(SSL *s, void *buf, size_t len, size_t *readbytes) +{ + return 1; +} + +__owur int ossl_quic_peek(SSL *s, void *buf, size_t len, size_t *readbytes) +{ + return 1; +} + +__owur int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written) +{ + return 1; +} + +__owur int ossl_quic_shutdown(SSL *s) +{ + return 1; +} + +__owur long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg) +{ + return 0; +} + +__owur long ossl_quic_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg) +{ + return 0; +} + +__owur long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void)) +{ + return 0; +} + +__owur long ossl_quic_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp) (void)) +{ + return 0; +} + +__owur size_t ossl_quic_pending(const SSL *s) +{ + return 0; +} diff --git a/ssl/quic/quic_local.h b/ssl/quic/quic_local.h new file mode 100644 index 0000000000..ffb617184f --- /dev/null +++ b/ssl/quic/quic_local.h @@ -0,0 +1,71 @@ +/* + * 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 + */ + +#ifndef OSSL_QUIC_LOCAL_H +# define OSSL_QUIC_LOCAL_H + +# include +# include "../ssl_local.h" + +# define OSSL_QUIC_ANY_VERSION 0xFFFFF + +# define IMPLEMENT_quic_meth_func(version, func_name, s_accept, \ + s_connect, enc_data) \ +const SSL_METHOD *func_name(void) \ + { \ + static const SSL_METHOD func_name##_data= { \ + version, \ + 0, \ + 0, \ + ossl_quic_new, \ + ossl_quic_clear, \ + ossl_quic_free, \ + s_accept, \ + s_connect, \ + ossl_quic_read, \ + ossl_quic_peek, \ + ossl_quic_write, \ + ossl_quic_shutdown, \ + NULL /* renegotiate */, \ + NULL /* renegotiate_check */, \ + NULL /* read_bytes */, \ + NULL /* write_bytes */, \ + NULL /* dispatch_alert */, \ + ossl_quic_ctrl, \ + ossl_quic_ctx_ctrl, \ + NULL /* get_cipher_by_char */, \ + NULL /* put_cipher_by_char */, \ + ossl_quic_pending, \ + NULL /* num_ciphers */, \ + NULL /* get_cipher */, \ + NULL /* default_timeout */, \ + &enc_data, \ + ssl_undefined_void_function, \ + ossl_quic_callback_ctrl, \ + ossl_quic_ctx_callback_ctrl, \ + }; \ + return &func_name##_data; \ + } + +__owur int ossl_quic_new(SSL *s); +void ossl_quic_free(SSL *s); +int ossl_quic_clear(SSL *s); +__owur int ossl_quic_accept(SSL *s); +__owur int ossl_quic_connect(SSL *s); +__owur int ossl_quic_read(SSL *s, void *buf, size_t len, size_t *readbytes); +__owur int ossl_quic_peek(SSL *s, void *buf, size_t len, size_t *readbytes); +__owur int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written); +__owur int ossl_quic_shutdown(SSL *s); +__owur long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg); +__owur long ossl_quic_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg); +__owur long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void)); +__owur long ossl_quic_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp) (void)); +__owur size_t ossl_quic_pending(const SSL *s); + +#endif diff --git a/ssl/quic/quic_method.c b/ssl/quic/quic_method.c new file mode 100644 index 0000000000..2c769f1340 --- /dev/null +++ b/ssl/quic/quic_method.c @@ -0,0 +1,27 @@ +/* + * 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 "quic_local.h" + +IMPLEMENT_quic_meth_func(OSSL_QUIC_ANY_VERSION, + OSSL_QUIC_client_method, + ssl_undefined_function, + ossl_quic_connect, ssl3_undef_enc_method) + +IMPLEMENT_quic_meth_func(OSSL_QUIC_ANY_VERSION, + OSSL_QUIC_client_thread_method, + ssl_undefined_function, + ossl_quic_connect, ssl3_undef_enc_method) + +IMPLEMENT_quic_meth_func(OSSL_QUIC_ANY_VERSION, + OSSL_QUIC_server_method, + ossl_quic_accept, + ssl_undefined_function, ssl3_undef_enc_method) -- 2.39.2