^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* Null security operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <net/af_rxrpc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "ar-internal.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) static int none_init_connection_security(struct rxrpc_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) static int none_prime_packet_security(struct rxrpc_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static int none_secure_packet(struct rxrpc_call *call,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) size_t data_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) void *sechdr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static int none_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) unsigned int offset, unsigned int len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) rxrpc_seq_t seq, u16 expected_cksum)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static void none_free_call_crypto(struct rxrpc_call *call)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static void none_locate_data(struct rxrpc_call *call, struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) unsigned int *_offset, unsigned int *_len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static int none_respond_to_challenge(struct rxrpc_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) u32 *_abort_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) tracepoint_string("chall_none"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) return -EPROTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static int none_verify_response(struct rxrpc_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct sk_buff *skb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) u32 *_abort_code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) tracepoint_string("resp_none"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) return -EPROTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static void none_clear(struct rxrpc_connection *conn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static int none_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) static void none_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * RxRPC Kerberos-based security
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) const struct rxrpc_security rxrpc_no_security = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) .name = "none",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .security_index = RXRPC_SECURITY_NONE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .init = none_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) .exit = none_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) .init_connection_security = none_init_connection_security,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) .prime_packet_security = none_prime_packet_security,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) .free_call_crypto = none_free_call_crypto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) .secure_packet = none_secure_packet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) .verify_packet = none_verify_packet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) .locate_data = none_locate_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) .respond_to_challenge = none_respond_to_challenge,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) .verify_response = none_verify_response,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) .clear = none_clear,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) };