| 1 |
|
| 2 | |
| 3 | * Generic netlink HANDSHAKE service.
|
| 4 | *
|
| 5 | * Author: Chuck Lever <[email protected]>
|
| 6 | *
|
| 7 | * Copyright (c) 2023, Oracle and/or its affiliates.
|
| 8 |
|
| 9 |
|
| 10 | #ifndef _NET_HANDSHAKE_H
|
| 11 | #define _NET_HANDSHAKE_H
|
| 12 |
|
| 13 | enum {
|
| 14 | TLS_NO_KEYRING = 0,
|
| 15 | TLS_NO_PEERID = 0,
|
| 16 | TLS_NO_CERT = 0,
|
| 17 | TLS_NO_PRIVKEY = 0,
|
| 18 | };
|
| 19 |
|
| 20 | typedef void (*tls_done_func_t)(void *data, int status,
|
| 21 | key_serial_t peerid);
|
| 22 |
|
| 23 | struct tls_handshake_args {
|
| 24 | struct socket *ta_sock;
|
| 25 | tls_done_func_t ta_done;
|
| 26 | void *ta_data;
|
| 27 | const char *ta_peername;
|
| 28 | unsigned int ta_timeout_ms;
|
| 29 | key_serial_t ta_keyring;
|
| 30 | key_serial_t ta_my_cert;
|
| 31 | key_serial_t ta_my_privkey;
|
| 32 | unsigned int ta_num_peerids;
|
| 33 | key_serial_t ta_my_peerids[5];
|
| 34 | };
|
| 35 |
|
| 36 | int tls_client_hello_anon(const struct tls_handshake_args *args, gfp_t flags);
|
| 37 | int tls_client_hello_x509(const struct tls_handshake_args *args, gfp_t flags);
|
| 38 | int tls_client_hello_psk(const struct tls_handshake_args *args, gfp_t flags);
|
| 39 | int tls_server_hello_x509(const struct tls_handshake_args *args, gfp_t flags);
|
| 40 | int tls_server_hello_psk(const struct tls_handshake_args *args, gfp_t flags);
|
| 41 |
|
| 42 | bool tls_handshake_cancel(struct sock *sk);
|
| 43 | void tls_handshake_close(struct socket *sock);
|
| 44 |
|
| 45 | u8 tls_get_record_type(const struct sock *sk, const struct cmsghdr *msg);
|
| 46 | void tls_alert_recv(const struct sock *sk, const struct msghdr *msg,
|
| 47 | u8 *level, u8 *description);
|
| 48 |
|
| 49 | #endif
|