/src/gnutls/lib/constate.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2000-2012 Free Software Foundation, Inc. |
3 | | * |
4 | | * Author: Nikos Mavrogiannopoulos |
5 | | * |
6 | | * This file is part of GnuTLS. |
7 | | * |
8 | | * The GnuTLS is free software; you can redistribute it and/or |
9 | | * modify it under the terms of the GNU Lesser General Public License |
10 | | * as published by the Free Software Foundation; either version 2.1 of |
11 | | * the License, or (at your option) any later version. |
12 | | * |
13 | | * This library is distributed in the hope that it will be useful, but |
14 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | | * Lesser General Public License for more details. |
17 | | * |
18 | | * You should have received a copy of the GNU Lesser General Public License |
19 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
20 | | * |
21 | | */ |
22 | | |
23 | | #ifndef GNUTLS_LIB_CONSTATE_H |
24 | | # define GNUTLS_LIB_CONSTATE_H |
25 | | |
26 | | int _gnutls_set_cipher_suite2(gnutls_session_t session, |
27 | | const gnutls_cipher_suite_entry_st * cs); |
28 | | |
29 | | int _gnutls_epoch_set_keys(gnutls_session_t session, uint16_t epoch, |
30 | | hs_stage_t stage); |
31 | | int _gnutls_connection_state_init(gnutls_session_t session); |
32 | | int _gnutls_read_connection_state_init(gnutls_session_t session); |
33 | | int _gnutls_write_connection_state_init(gnutls_session_t session); |
34 | | |
35 | | # define _gnutls_epoch_bump(session) \ |
36 | | (session)->security_parameters.epoch_next++ |
37 | | |
38 | | int _gnutls_epoch_dup(gnutls_session_t session, unsigned int epoch_rel); |
39 | | |
40 | | int _gnutls_epoch_get(gnutls_session_t session, unsigned int epoch_rel, |
41 | | record_parameters_st ** params_out); |
42 | | int _gnutls_epoch_setup_next(gnutls_session_t session, unsigned null_epoch, |
43 | | record_parameters_st ** newp); |
44 | | void _gnutls_epoch_gc(gnutls_session_t session); |
45 | | void _gnutls_epoch_free(gnutls_session_t session, record_parameters_st * state); |
46 | | |
47 | | void _gnutls_set_resumed_parameters(gnutls_session_t session); |
48 | | |
49 | | int _tls13_connection_state_init(gnutls_session_t session, hs_stage_t stage); |
50 | | int _tls13_read_connection_state_init(gnutls_session_t session, |
51 | | hs_stage_t stage); |
52 | | int _tls13_write_connection_state_init(gnutls_session_t session, |
53 | | hs_stage_t stage); |
54 | | |
55 | | static inline int _gnutls_epoch_is_valid(gnutls_session_t session, int epoch) |
56 | 0 | { |
57 | 0 | record_parameters_st *params; |
58 | 0 | int ret; |
59 | 0 |
|
60 | 0 | ret = _gnutls_epoch_get(session, epoch, ¶ms); |
61 | 0 | if (ret < 0) |
62 | 0 | return 0; |
63 | 0 |
|
64 | 0 | return 1; |
65 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_epoch_is_valid Unexecuted instantiation: key_share.c:_gnutls_epoch_is_valid Unexecuted instantiation: pre_shared_key.c:_gnutls_epoch_is_valid Unexecuted instantiation: status_request.c:_gnutls_epoch_is_valid Unexecuted instantiation: supported_versions.c:_gnutls_epoch_is_valid |
66 | | |
67 | | static inline int _gnutls_epoch_refcount_inc(gnutls_session_t session, |
68 | | int epoch) |
69 | 0 | { |
70 | 0 | record_parameters_st *params; |
71 | 0 | int ret; |
72 | 0 |
|
73 | 0 | ret = _gnutls_epoch_get(session, epoch, ¶ms); |
74 | 0 | if (ret < 0) |
75 | 0 | return ret; |
76 | 0 |
|
77 | 0 | params->usage_cnt++; |
78 | 0 |
|
79 | 0 | return params->epoch; |
80 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_epoch_refcount_inc Unexecuted instantiation: key_share.c:_gnutls_epoch_refcount_inc Unexecuted instantiation: pre_shared_key.c:_gnutls_epoch_refcount_inc Unexecuted instantiation: status_request.c:_gnutls_epoch_refcount_inc Unexecuted instantiation: supported_versions.c:_gnutls_epoch_refcount_inc |
81 | | |
82 | | static inline int _gnutls_epoch_refcount_dec(gnutls_session_t session, |
83 | | uint16_t epoch) |
84 | 0 | { |
85 | 0 | record_parameters_st *params; |
86 | 0 | int ret; |
87 | 0 |
|
88 | 0 | ret = _gnutls_epoch_get(session, epoch, ¶ms); |
89 | 0 | if (ret < 0) |
90 | 0 | return ret; |
91 | 0 |
|
92 | 0 | params->usage_cnt--; |
93 | 0 | if (params->usage_cnt < 0) |
94 | 0 | return GNUTLS_E_INTERNAL_ERROR; |
95 | 0 |
|
96 | 0 | return 0; |
97 | 0 | } Unexecuted instantiation: heartbeat.c:_gnutls_epoch_refcount_dec Unexecuted instantiation: key_share.c:_gnutls_epoch_refcount_dec Unexecuted instantiation: pre_shared_key.c:_gnutls_epoch_refcount_dec Unexecuted instantiation: status_request.c:_gnutls_epoch_refcount_dec Unexecuted instantiation: supported_versions.c:_gnutls_epoch_refcount_dec |
98 | | |
99 | | #endif /* GNUTLS_LIB_CONSTATE_H */ |