diff options
author | Tomas Mraz <tomas@openssl.org> | 2022-05-13 16:45:07 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-06-03 12:07:18 +1000 |
commit | e44795bd5db081260ef05c7be6fd17c080ed9437 (patch) | |
tree | 77c7073c3ae0edc4b704a9521ee64c9f51320678 /ssl/quic | |
parent | 99e1cc7bcae2e3707913881d7108c92b7a9bf7a1 (diff) | |
download | openssl-new-e44795bd5db081260ef05c7be6fd17c080ed9437.tar.gz |
First working empty protocol test
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18307)
Diffstat (limited to 'ssl/quic')
-rw-r--r-- | ssl/quic/quic_impl.c | 60 | ||||
-rw-r--r-- | ssl/quic/quic_local.h | 12 |
2 files changed, 54 insertions, 18 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index bc10a4b615..1c673d23b6 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -11,7 +11,7 @@ #include <openssl/objects.h> #include "quic_local.h" -__owur int ossl_quic_new(SSL *s) +int ossl_quic_new(SSL *s) { return s->method->ssl_clear(s); } @@ -26,57 +26,89 @@ int ossl_quic_clear(SSL *s) return 1; } -__owur int ossl_quic_accept(SSL *s) +int ossl_quic_accept(SSL *s) { return 1; } -__owur int ossl_quic_connect(SSL *s) +int ossl_quic_connect(SSL *s) { return 1; } -__owur int ossl_quic_read(SSL *s, void *buf, size_t len, size_t *readbytes) +int ossl_quic_read(SSL *s, void *buf, size_t len, size_t *readbytes) { - return 1; + BIO *rbio = SSL_get_rbio(s); + + if (rbio == NULL) + return 0; + + return BIO_read_ex(rbio, buf, len, readbytes); } -__owur int ossl_quic_peek(SSL *s, void *buf, size_t len, size_t *readbytes) +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) +int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written) { - return 1; + BIO *wbio = SSL_get_wbio(s); + + if (wbio == NULL) + return 0; + + return BIO_write_ex(wbio, buf, len, written); } -__owur int ossl_quic_shutdown(SSL *s) +int ossl_quic_shutdown(SSL *s) { return 1; } -__owur long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg) +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) +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)) +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)) +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) +size_t ossl_quic_pending(const SSL *s) { return 0; } + +long ossl_quic_default_timeout(void) +{ + return 0; +} + +int ossl_quic_num_ciphers(void) +{ + return 1; +} + +const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u) +{ + static const SSL_CIPHER ciph = { 0 }; + + return &ciph; +} + +int ossl_quic_renegotiate_check(SSL *ssl, int initok) +{ + return 1; +} diff --git a/ssl/quic/quic_local.h b/ssl/quic/quic_local.h index ffb617184f..3b738e541b 100644 --- a/ssl/quic/quic_local.h +++ b/ssl/quic/quic_local.h @@ -33,7 +33,7 @@ const SSL_METHOD *func_name(void) \ ossl_quic_write, \ ossl_quic_shutdown, \ NULL /* renegotiate */, \ - NULL /* renegotiate_check */, \ + ossl_quic_renegotiate_check, \ NULL /* read_bytes */, \ NULL /* write_bytes */, \ NULL /* dispatch_alert */, \ @@ -42,9 +42,9 @@ const SSL_METHOD *func_name(void) \ NULL /* get_cipher_by_char */, \ NULL /* put_cipher_by_char */, \ ossl_quic_pending, \ - NULL /* num_ciphers */, \ - NULL /* get_cipher */, \ - NULL /* default_timeout */, \ + ossl_quic_num_ciphers, \ + ossl_quic_get_cipher, \ + ossl_quic_default_timeout, \ &enc_data, \ ssl_undefined_void_function, \ ossl_quic_callback_ctrl, \ @@ -67,5 +67,9 @@ __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); +__owur long ossl_quic_default_timeout(void); +__owur int ossl_quic_num_ciphers(void); +__owur const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u); +int ossl_quic_renegotiate_check(SSL *ssl, int initok); #endif |