Add empty implementations of quic method functions

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18307)
This commit is contained in:
Tomas Mraz 2022-05-13 15:34:22 +02:00 committed by Pauli
parent 770ea54b58
commit 99e1cc7bca
5 changed files with 187 additions and 0 deletions

View File

@ -1,5 +1,9 @@
LIBS=../libssl LIBS=../libssl
IF[{- !$disabled{quic} -}]
SUBDIRS=quic
ENDIF
#Needed for the multiblock code in rec_layer_s3.c #Needed for the multiblock code in rec_layer_s3.c
IF[{- !$disabled{asm} -}] IF[{- !$disabled{asm} -}]
$AESDEF_x86=AES_ASM $AESDEF_x86=AES_ASM

3
ssl/quic/build.info Normal file
View File

@ -0,0 +1,3 @@
$LIBSSL=../../libssl
SOURCE[$LIBSSL]=quic_method.c quic_impl.c

82
ssl/quic/quic_impl.c Normal file
View File

@ -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 <openssl/macros.h>
#include <openssl/objects.h>
#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;
}

71
ssl/quic/quic_local.h Normal file
View File

@ -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 <openssl/ssl.h>
# 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

27
ssl/quic/quic_method.c Normal file
View File

@ -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 <openssl/macros.h>
#include <openssl/objects.h>
#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)