1b4d0d230SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 246c6f177SDavid Howells /* Asymmetric public-key cryptography data parser 346c6f177SDavid Howells * 40efaaa86SMauro Carvalho Chehab * See Documentation/crypto/asymmetric-keys.rst 546c6f177SDavid Howells * 646c6f177SDavid Howells * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved. 746c6f177SDavid Howells * Written by David Howells (dhowells@redhat.com) 846c6f177SDavid Howells */ 946c6f177SDavid Howells 1046c6f177SDavid Howells #ifndef _KEYS_ASYMMETRIC_PARSER_H 1146c6f177SDavid Howells #define _KEYS_ASYMMETRIC_PARSER_H 1246c6f177SDavid Howells 13*b6d0695bSHerbert Xu struct key_preparsed_payload; 14*b6d0695bSHerbert Xu 1546c6f177SDavid Howells /* 1646c6f177SDavid Howells * Key data parser. Called during key instantiation. 1746c6f177SDavid Howells */ 1846c6f177SDavid Howells struct asymmetric_key_parser { 1946c6f177SDavid Howells struct list_head link; 2046c6f177SDavid Howells struct module *owner; 2146c6f177SDavid Howells const char *name; 2246c6f177SDavid Howells 2346c6f177SDavid Howells /* Attempt to parse a key from the data blob passed to add_key() or 2446c6f177SDavid Howells * keyctl_instantiate(). Should also generate a proposed description 2546c6f177SDavid Howells * that the caller can optionally use for the key. 2646c6f177SDavid Howells * 2746c6f177SDavid Howells * Return EBADMSG if not recognised. 2846c6f177SDavid Howells */ 2946c6f177SDavid Howells int (*parse)(struct key_preparsed_payload *prep); 3046c6f177SDavid Howells }; 3146c6f177SDavid Howells 3246c6f177SDavid Howells extern int register_asymmetric_key_parser(struct asymmetric_key_parser *); 3346c6f177SDavid Howells extern void unregister_asymmetric_key_parser(struct asymmetric_key_parser *); 3446c6f177SDavid Howells 3546c6f177SDavid Howells #endif /* _KEYS_ASYMMETRIC_PARSER_H */ 36