Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (C) 2010-2016 Free Software Foundation, Inc. |
3 | | * Copyright (C) 2016 Red Hat, Inc. |
4 | | * |
5 | | * Author: Nikos Mavrogiannopoulos |
6 | | * |
7 | | * This file is part of GnuTLS. |
8 | | * |
9 | | * The GnuTLS is free software; you can redistribute it and/or |
10 | | * modify it under the terms of the GNU Lesser General Public License |
11 | | * as published by the Free Software Foundation; either version 2.1 of |
12 | | * the License, or (at your option) any later version. |
13 | | * |
14 | | * This library is distributed in the hope that it will be useful, but |
15 | | * WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 | | * Lesser General Public License for more details. |
18 | | * |
19 | | * You should have received a copy of the GNU Lesser General Public License |
20 | | * along with this program. If not, see <https://www.gnu.org/licenses/> |
21 | | * |
22 | | */ |
23 | | |
24 | | #ifndef GNUTLS_LIB_SYSTEM_H |
25 | | # define GNUTLS_LIB_SYSTEM_H |
26 | | |
27 | | # include "gnutls_int.h" |
28 | | # include <time.h> |
29 | | # include <sys/time.h> |
30 | | |
31 | | # ifdef _WIN32 |
32 | | # if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20 |
33 | | # define NEED_CERT_ENUM_CRLS |
34 | | typedef PCCRL_CONTEXT WINAPI(*CertEnumCRLsInStoreFunc) (HCERTSTORE |
35 | | hCertStore, |
36 | | PCCRL_CONTEXT |
37 | | pPrevCrlContext); |
38 | | extern CertEnumCRLsInStoreFunc pCertEnumCRLsInStore; |
39 | | # else |
40 | | # define pCertEnumCRLsInStore CertEnumCRLsInStore |
41 | | # endif |
42 | | # include <windows.h> /* for Sleep */ |
43 | | # else |
44 | | # include <sys/uio.h> /* for writev */ |
45 | | # endif |
46 | | |
47 | | # include "pathbuf.h" |
48 | | |
49 | | int system_errno(gnutls_transport_ptr_t); |
50 | | |
51 | | ssize_t system_write(gnutls_transport_ptr_t ptr, const void *data, |
52 | | size_t data_size); |
53 | | # define HAVE_WRITEV |
54 | | ssize_t system_writev(gnutls_transport_ptr_t ptr, const giovec_t * iovec, |
55 | | int iovec_cnt); |
56 | | ssize_t system_writev_nosignal(gnutls_transport_ptr_t ptr, |
57 | | const giovec_t * iovec, int iovec_cnt); |
58 | | ssize_t system_writev_tfo(gnutls_session_t ptr, const giovec_t * iovec, |
59 | | int iovec_cnt); |
60 | | ssize_t system_writev_nosignal_tfo(gnutls_session_t ptr, const giovec_t * iovec, |
61 | | int iovec_cnt); |
62 | | ssize_t system_read(gnutls_transport_ptr_t ptr, void *data, size_t data_size); |
63 | | |
64 | | # if defined(_WIN32) |
65 | | # define HAVE_WIN32_LOCKS |
66 | | # elif defined(HAVE_LIBPTHREAD) || defined(HAVE_PTHREAD_MUTEX_LOCK) |
67 | | # define HAVE_PTHREAD_LOCKS |
68 | | # else |
69 | | # define HAVE_NO_LOCKS |
70 | | # endif |
71 | | |
72 | | typedef void (*gnutls_gettime_func)(struct timespec *); |
73 | | |
74 | | extern gnutls_time_func gnutls_time; |
75 | | extern gnutls_gettime_func gnutls_gettime; |
76 | | |
77 | | static inline void millisleep(unsigned int ms) |
78 | 0 | { |
79 | 0 | # ifdef _WIN32 |
80 | 0 | Sleep(ms); |
81 | 0 | # else |
82 | 0 | struct timespec ts; |
83 | 0 |
|
84 | 0 | ts.tv_sec = 0; |
85 | 0 | ts.tv_nsec = ms * 1000 * 1000; |
86 | 0 |
|
87 | 0 | nanosleep(&ts, NULL); |
88 | 0 | # endif |
89 | 0 | } Unexecuted instantiation: common.c:millisleep Unexecuted instantiation: crl.c:millisleep Unexecuted instantiation: crq.c:millisleep Unexecuted instantiation: dn.c:millisleep Unexecuted instantiation: extensions.c:millisleep Unexecuted instantiation: hostname-verify.c:millisleep Unexecuted instantiation: key_decode.c:millisleep Unexecuted instantiation: key_encode.c:millisleep Unexecuted instantiation: mpi.c:millisleep Unexecuted instantiation: ocsp.c:millisleep Unexecuted instantiation: output.c:millisleep Unexecuted instantiation: pkcs12.c:millisleep Unexecuted instantiation: pkcs12_bag.c:millisleep Unexecuted instantiation: pkcs12_encr.c:millisleep Unexecuted instantiation: pkcs7-crypt.c:millisleep Unexecuted instantiation: privkey_openssl.c:millisleep Unexecuted instantiation: privkey_pkcs8.c:millisleep Unexecuted instantiation: privkey_pkcs8_pbes1.c:millisleep Unexecuted instantiation: prov-seed.c:millisleep Unexecuted instantiation: sign.c:millisleep Unexecuted instantiation: time.c:millisleep Unexecuted instantiation: tls_features.c:millisleep Unexecuted instantiation: verify-high.c:millisleep Unexecuted instantiation: verify-high2.c:millisleep Unexecuted instantiation: verify.c:millisleep Unexecuted instantiation: virt-san.c:millisleep Unexecuted instantiation: x509.c:millisleep Unexecuted instantiation: x509_dn.c:millisleep Unexecuted instantiation: x509_ext.c:millisleep Unexecuted instantiation: x509_write.c:millisleep Unexecuted instantiation: attributes.c:millisleep Unexecuted instantiation: email-verify.c:millisleep Unexecuted instantiation: ip.c:millisleep Unexecuted instantiation: krb5.c:millisleep Unexecuted instantiation: name_constraints.c:millisleep |
90 | | |
91 | | int _gnutls_find_config_path(char *path, size_t max_size); |
92 | | int _gnutls_ucs2_to_utf8(const void *data, size_t size, |
93 | | gnutls_datum_t * output, unsigned bigendian); |
94 | | int _gnutls_utf8_to_ucs2(const void *data, size_t size, |
95 | | gnutls_datum_t * output, unsigned be); |
96 | | |
97 | | void _gnutls_global_set_gettime_function(gnutls_gettime_func gettime_func); |
98 | | |
99 | | int gnutls_system_global_init(void); |
100 | | void gnutls_system_global_deinit(void); |
101 | | |
102 | | #endif /* GNUTLS_LIB_SYSTEM_H */ |