Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/crypto/openssl/ossl.h
39536 views
1
/*
2
* Copyright (c) 2020 Netflix, Inc
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer,
9
* without modification.
10
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
11
* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
12
* redistribution must be conditioned upon including a substantially
13
* similar Disclaimer requirement for further binary redistribution.
14
*
15
* NO WARRANTY
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
19
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20
* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
21
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26
* THE POSSIBILITY OF SUCH DAMAGES.
27
*/
28
29
#ifndef __OSSL_H__
30
#define __OSSL_H__
31
32
/* Compatibility shims. */
33
#define OPENSSL_cleanse explicit_bzero
34
35
struct cryptop;
36
struct crypto_session_params;
37
struct ossl_softc;
38
struct ossl_session;
39
40
int ossl_chacha20_poly1305_decrypt(struct cryptop *crp,
41
const struct crypto_session_params *csp);
42
int ossl_chacha20_poly1305_encrypt(struct cryptop *crp,
43
const struct crypto_session_params *csp);
44
void ossl_cpuid(struct ossl_softc *sc);
45
46
struct ossl_softc {
47
int32_t sc_cid;
48
bool has_aes;
49
bool has_aes_gcm;
50
};
51
52
/* Needs to be big enough to hold any hash context. */
53
struct ossl_hash_context {
54
uint32_t dummy[196];
55
} __aligned(32);
56
57
struct ossl_cipher_context {
58
uint32_t dummy[196];
59
} __aligned(32);
60
61
struct ossl_session_hash {
62
struct ossl_hash_context ictx;
63
struct ossl_hash_context octx;
64
struct auth_hash *axf;
65
u_int mlen;
66
};
67
68
struct ossl_session_cipher {
69
struct ossl_cipher_context dec_ctx;
70
struct ossl_cipher_context enc_ctx;
71
struct ossl_cipher *cipher;
72
};
73
74
struct ossl_session {
75
struct ossl_session_cipher cipher;
76
struct ossl_session_hash hash;
77
};
78
79
extern struct auth_hash ossl_hash_poly1305;
80
extern struct auth_hash ossl_hash_sha1;
81
extern struct auth_hash ossl_hash_sha224;
82
extern struct auth_hash ossl_hash_sha256;
83
extern struct auth_hash ossl_hash_sha384;
84
extern struct auth_hash ossl_hash_sha512;
85
86
extern struct ossl_cipher ossl_cipher_aes_cbc;
87
extern struct ossl_cipher ossl_cipher_aes_gcm;
88
extern struct ossl_cipher ossl_cipher_chacha20;
89
90
#endif /* !__OSSL_H__ */
91
92