Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /* Null security operations.
0003  *
0004  * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
0005  * Written by David Howells (dhowells@redhat.com)
0006  */
0007 
0008 #include <net/af_rxrpc.h>
0009 #include "ar-internal.h"
0010 
0011 static int none_init_connection_security(struct rxrpc_connection *conn,
0012                      struct rxrpc_key_token *token)
0013 {
0014     return 0;
0015 }
0016 
0017 /*
0018  * Work out how much data we can put in an unsecured packet.
0019  */
0020 static int none_how_much_data(struct rxrpc_call *call, size_t remain,
0021                    size_t *_buf_size, size_t *_data_size, size_t *_offset)
0022 {
0023     *_buf_size = *_data_size = min_t(size_t, remain, RXRPC_JUMBO_DATALEN);
0024     *_offset = 0;
0025     return 0;
0026 }
0027 
0028 static int none_secure_packet(struct rxrpc_call *call, struct sk_buff *skb,
0029                   size_t data_size)
0030 {
0031     return 0;
0032 }
0033 
0034 static int none_verify_packet(struct rxrpc_call *call, struct sk_buff *skb,
0035                   unsigned int offset, unsigned int len,
0036                   rxrpc_seq_t seq, u16 expected_cksum)
0037 {
0038     return 0;
0039 }
0040 
0041 static void none_free_call_crypto(struct rxrpc_call *call)
0042 {
0043 }
0044 
0045 static void none_locate_data(struct rxrpc_call *call, struct sk_buff *skb,
0046                  unsigned int *_offset, unsigned int *_len)
0047 {
0048 }
0049 
0050 static int none_respond_to_challenge(struct rxrpc_connection *conn,
0051                      struct sk_buff *skb,
0052                      u32 *_abort_code)
0053 {
0054     struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
0055 
0056     trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
0057                   tracepoint_string("chall_none"));
0058     return -EPROTO;
0059 }
0060 
0061 static int none_verify_response(struct rxrpc_connection *conn,
0062                 struct sk_buff *skb,
0063                 u32 *_abort_code)
0064 {
0065     struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
0066 
0067     trace_rxrpc_rx_eproto(NULL, sp->hdr.serial,
0068                   tracepoint_string("resp_none"));
0069     return -EPROTO;
0070 }
0071 
0072 static void none_clear(struct rxrpc_connection *conn)
0073 {
0074 }
0075 
0076 static int none_init(void)
0077 {
0078     return 0;
0079 }
0080 
0081 static void none_exit(void)
0082 {
0083 }
0084 
0085 /*
0086  * RxRPC Kerberos-based security
0087  */
0088 const struct rxrpc_security rxrpc_no_security = {
0089     .name               = "none",
0090     .security_index         = RXRPC_SECURITY_NONE,
0091     .init               = none_init,
0092     .exit               = none_exit,
0093     .init_connection_security   = none_init_connection_security,
0094     .free_call_crypto       = none_free_call_crypto,
0095     .how_much_data          = none_how_much_data,
0096     .secure_packet          = none_secure_packet,
0097     .verify_packet          = none_verify_packet,
0098     .locate_data            = none_locate_data,
0099     .respond_to_challenge       = none_respond_to_challenge,
0100     .verify_response        = none_verify_response,
0101     .clear              = none_clear,
0102 };