First working empty protocol test
[openssl.git] / ssl / quic / quic_impl.c
1 /*
2  * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #include <openssl/macros.h>
11 #include <openssl/objects.h>
12 #include "quic_local.h"
13
14 int ossl_quic_new(SSL *s)
15 {
16     return s->method->ssl_clear(s);
17 }
18
19 void ossl_quic_free(SSL *s)
20 {
21     return;
22 }
23
24 int ossl_quic_clear(SSL *s)
25 {
26     return 1;
27 }
28
29 int ossl_quic_accept(SSL *s)
30 {
31     return 1;
32 }
33
34 int ossl_quic_connect(SSL *s)
35 {
36     return 1;
37 }
38
39 int ossl_quic_read(SSL *s, void *buf, size_t len, size_t *readbytes)
40 {
41     BIO *rbio = SSL_get_rbio(s);
42
43     if (rbio == NULL)
44         return 0;
45
46     return BIO_read_ex(rbio, buf, len, readbytes);
47 }
48
49 int ossl_quic_peek(SSL *s, void *buf, size_t len, size_t *readbytes)
50 {
51     return 1;
52 }
53
54 int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written)
55 {
56     BIO *wbio = SSL_get_wbio(s);
57
58     if (wbio == NULL)
59         return 0;
60
61     return BIO_write_ex(wbio, buf, len, written);
62 }
63
64 int ossl_quic_shutdown(SSL *s)
65 {
66     return 1;
67 }
68
69 long ossl_quic_ctrl(SSL *s, int cmd, long larg, void *parg)
70 {
71     return 0;
72 }
73
74 long ossl_quic_ctx_ctrl(SSL_CTX *s, int cmd, long larg, void *parg)
75 {
76     return 0;
77 }
78
79 long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void))
80 {
81     return 0;
82 }
83
84 long ossl_quic_ctx_callback_ctrl(SSL_CTX *s, int cmd, void (*fp) (void))
85 {
86     return 0;
87 }
88
89 size_t ossl_quic_pending(const SSL *s)
90 {
91     return 0;
92 }
93
94 long ossl_quic_default_timeout(void)
95 {
96     return 0;
97 }
98
99 int ossl_quic_num_ciphers(void)
100 {
101     return 1;
102 }
103
104 const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u)
105 {
106     static const SSL_CIPHER ciph = { 0 };
107
108     return &ciph;
109 }
110
111 int ossl_quic_renegotiate_check(SSL *ssl, int initok)
112 {
113     return 1;
114 }