Coverage Report

Created: 2026-08-12 06:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl/include/openssl/comp.h
Line
Count
Source
1
/*
2
 * Copyright 2015-2024 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
/* clang-format off */
11
12
/* clang-format on */
13
14
#ifndef OPENSSL_COMP_H
15
#define OPENSSL_COMP_H
16
#pragma once
17
18
#include <openssl/macros.h>
19
#ifndef OPENSSL_NO_DEPRECATED_3_0
20
#define HEADER_COMP_H
21
#endif
22
23
#include <openssl/opensslconf.h>
24
25
#include <openssl/crypto.h>
26
#include <openssl/comperr.h>
27
#ifdef __cplusplus
28
extern "C" {
29
#endif
30
31
#ifndef OPENSSL_NO_COMP
32
33
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
34
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
35
int COMP_CTX_get_type(const COMP_CTX *comp);
36
int COMP_get_type(const COMP_METHOD *meth);
37
const char *COMP_get_name(const COMP_METHOD *meth);
38
void COMP_CTX_free(COMP_CTX *ctx);
39
40
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
41
    unsigned char *in, int ilen);
42
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
43
    unsigned char *in, int ilen);
44
45
COMP_METHOD *COMP_zlib(void);
46
COMP_METHOD *COMP_zlib_oneshot(void);
47
COMP_METHOD *COMP_brotli(void);
48
COMP_METHOD *COMP_brotli_oneshot(void);
49
COMP_METHOD *COMP_zstd(void);
50
COMP_METHOD *COMP_zstd_oneshot(void);
51
52
#ifndef OPENSSL_NO_DEPRECATED_1_1_0
53
#define COMP_zlib_cleanup() \
54
    while (0)               \
55
    continue
56
#endif
57
58
#ifdef OPENSSL_BIO_H
59
const BIO_METHOD *BIO_f_zlib(void);
60
const BIO_METHOD *BIO_f_brotli(void);
61
const BIO_METHOD *BIO_f_zstd(void);
62
#endif
63
64
#endif
65
66
typedef struct ssl_comp_st SSL_COMP;
67
68
/* clang-format off */
69
SKM_DEFINE_STACK_OF_INTERNAL(SSL_COMP, SSL_COMP, SSL_COMP)
70
#define sk_SSL_COMP_num(sk) OPENSSL_sk_num(ossl_check_const_SSL_COMP_sk_type(sk))
71
#define sk_SSL_COMP_value(sk, idx) ((SSL_COMP *)OPENSSL_sk_value(ossl_check_const_SSL_COMP_sk_type(sk), (idx)))
72
#define sk_SSL_COMP_new(cmp) \
73
3
    ((STACK_OF(SSL_COMP) *)OPENSSL_sk_set_thunks( \
74
3
        OPENSSL_sk_set_copy_thunks( \
75
3
            OPENSSL_sk_set_cmp_thunks( \
76
3
                OPENSSL_sk_new(ossl_check_SSL_COMP_compfunc_type(cmp)), \
77
3
                sk_SSL_COMP_cmpfunc_thunk), \
78
3
            sk_SSL_COMP_copyfunc_thunk), \
79
3
        sk_SSL_COMP_freefunc_thunk))
80
#define sk_SSL_COMP_new_null() \
81
    ((STACK_OF(SSL_COMP) *)OPENSSL_sk_set_thunks( \
82
        OPENSSL_sk_set_copy_thunks( \
83
            OPENSSL_sk_set_cmp_thunks( \
84
                OPENSSL_sk_new_null(), \
85
                sk_SSL_COMP_cmpfunc_thunk), \
86
            sk_SSL_COMP_copyfunc_thunk), \
87
        sk_SSL_COMP_freefunc_thunk))
88
#define sk_SSL_COMP_new_reserve(cmp, n) \
89
    ((STACK_OF(SSL_COMP) *)OPENSSL_sk_set_thunks( \
90
        OPENSSL_sk_set_copy_thunks( \
91
            OPENSSL_sk_set_cmp_thunks( \
92
                OPENSSL_sk_new_reserve(ossl_check_SSL_COMP_compfunc_type(cmp), (n)), \
93
                sk_SSL_COMP_cmpfunc_thunk), \
94
            sk_SSL_COMP_copyfunc_thunk), \
95
        sk_SSL_COMP_freefunc_thunk))
96
#define sk_SSL_COMP_reserve(sk, n) OPENSSL_sk_reserve(ossl_check_SSL_COMP_sk_type(sk), (n))
97
#define sk_SSL_COMP_free(sk) OPENSSL_sk_free(ossl_check_SSL_COMP_sk_type(sk))
98
#define sk_SSL_COMP_zero(sk) OPENSSL_sk_zero(ossl_check_SSL_COMP_sk_type(sk))
99
#define sk_SSL_COMP_delete(sk, i) ((SSL_COMP *)OPENSSL_sk_delete(ossl_check_SSL_COMP_sk_type(sk), (i)))
100
#define sk_SSL_COMP_delete_ptr(sk, ptr) ((SSL_COMP *)OPENSSL_sk_delete_ptr(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr)))
101
0
#define sk_SSL_COMP_push(sk, ptr) OPENSSL_sk_push(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
102
#define sk_SSL_COMP_unshift(sk, ptr) OPENSSL_sk_unshift(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
103
#define sk_SSL_COMP_pop(sk) ((SSL_COMP *)OPENSSL_sk_pop(ossl_check_SSL_COMP_sk_type(sk)))
104
#define sk_SSL_COMP_shift(sk) ((SSL_COMP *)OPENSSL_sk_shift(ossl_check_SSL_COMP_sk_type(sk)))
105
0
#define sk_SSL_COMP_pop_free(sk, freefunc) OPENSSL_sk_pop_free(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_freefunc_type(freefunc))
106
#define sk_SSL_COMP_insert(sk, ptr, idx) OPENSSL_sk_insert(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), (idx))
107
#define sk_SSL_COMP_set(sk, idx, ptr) ((SSL_COMP *)OPENSSL_sk_set(ossl_check_SSL_COMP_sk_type(sk), (idx), ossl_check_SSL_COMP_type(ptr)))
108
#define sk_SSL_COMP_find(sk, ptr) OPENSSL_sk_find(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
109
#define sk_SSL_COMP_find_ex(sk, ptr) OPENSSL_sk_find_ex(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr))
110
#define sk_SSL_COMP_find_all(sk, ptr, pnum) OPENSSL_sk_find_all(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_type(ptr), pnum)
111
#define sk_SSL_COMP_sort(sk) OPENSSL_sk_sort(ossl_check_SSL_COMP_sk_type(sk))
112
#define sk_SSL_COMP_is_sorted(sk) OPENSSL_sk_is_sorted(ossl_check_const_SSL_COMP_sk_type(sk))
113
#define sk_SSL_COMP_dup(sk) \
114
    ((STACK_OF(SSL_COMP) *)OPENSSL_sk_set_thunks( \
115
        OPENSSL_sk_set_copy_thunks( \
116
            OPENSSL_sk_set_cmp_thunks( \
117
                OPENSSL_sk_dup(ossl_check_const_SSL_COMP_sk_type(sk)), \
118
                sk_SSL_COMP_cmpfunc_thunk), \
119
            sk_SSL_COMP_copyfunc_thunk), \
120
        sk_SSL_COMP_freefunc_thunk))
121
#define sk_SSL_COMP_deep_copy(sk, copyfunc, freefunc) \
122
    ((STACK_OF(SSL_COMP) *)OPENSSL_sk_set_thunks( \
123
        OPENSSL_sk_set_copy_thunks( \
124
            OPENSSL_sk_set_cmp_thunks( \
125
                OPENSSL_sk_deep_copy( \
126
                    ossl_check_const_SSL_COMP_sk_type(sk), \
127
                    ossl_check_SSL_COMP_copyfunc_type(copyfunc), \
128
                    ossl_check_SSL_COMP_freefunc_type(freefunc)), \
129
                sk_SSL_COMP_cmpfunc_thunk), \
130
            sk_SSL_COMP_copyfunc_thunk), \
131
        sk_SSL_COMP_freefunc_thunk))
132
#define sk_SSL_COMP_set_cmp_func(sk, cmp) ((sk_SSL_COMP_compfunc)OPENSSL_sk_set_cmp_func(ossl_check_SSL_COMP_sk_type(sk), ossl_check_SSL_COMP_compfunc_type(cmp)))
133
134
/* clang-format on */
135
136
#ifdef __cplusplus
137
}
138
#endif
139
#endif