linux/security/keys/user_defined.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* user_defined.c: user defined key type
 *
 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells ([email protected])
 */

#include <linux/export.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
#include <linux/err.h>
#include <keys/user-type.h>
#include <linux/uaccess.h>
#include "internal.h"

static int logon_vet_description(const char *desc);

/*
 * user defined keys take an arbitrary string as the description and an
 * arbitrary blob of data as the payload
 */
struct key_type key_type_user =;

EXPORT_SYMBOL_GPL();

/*
 * This key type is essentially the same as key_type_user, but it does
 * not define a .read op. This is suitable for storing username and
 * password pairs in the keyring that you do not want to be readable
 * from userspace.
 */
struct key_type key_type_logon =;
EXPORT_SYMBOL_GPL();

/*
 * Preparse a user defined key payload
 */
int user_preparse(struct key_preparsed_payload *prep)
{}
EXPORT_SYMBOL_GPL();

/*
 * Free a preparse of a user defined key payload
 */
void user_free_preparse(struct key_preparsed_payload *prep)
{}
EXPORT_SYMBOL_GPL();

static void user_free_payload_rcu(struct rcu_head *head)
{}

/*
 * update a user defined key
 * - the key's semaphore is write-locked
 */
int user_update(struct key *key, struct key_preparsed_payload *prep)
{}
EXPORT_SYMBOL_GPL();

/*
 * dispose of the links from a revoked keyring
 * - called with the key sem write-locked
 */
void user_revoke(struct key *key)
{}

EXPORT_SYMBOL();

/*
 * dispose of the data dangling from the corpse of a user key
 */
void user_destroy(struct key *key)
{}

EXPORT_SYMBOL_GPL();

/*
 * describe the user key
 */
void user_describe(const struct key *key, struct seq_file *m)
{}

EXPORT_SYMBOL_GPL();

/*
 * read the key data
 * - the key's semaphore is read-locked
 */
long user_read(const struct key *key, char *buffer, size_t buflen)
{}

EXPORT_SYMBOL_GPL();

/* Vet the description for a "logon" key */
static int logon_vet_description(const char *desc)
{}