146c6f177SDavid Howells /* Asymmetric public-key cryptography data parser
246c6f177SDavid Howells  *
346c6f177SDavid Howells  * See Documentation/crypto/asymmetric-keys.txt
446c6f177SDavid Howells  *
546c6f177SDavid Howells  * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
646c6f177SDavid Howells  * Written by David Howells (dhowells@redhat.com)
746c6f177SDavid Howells  *
846c6f177SDavid Howells  * This program is free software; you can redistribute it and/or
946c6f177SDavid Howells  * modify it under the terms of the GNU General Public Licence
1046c6f177SDavid Howells  * as published by the Free Software Foundation; either version
1146c6f177SDavid Howells  * 2 of the Licence, or (at your option) any later version.
1246c6f177SDavid Howells  */
1346c6f177SDavid Howells 
1446c6f177SDavid Howells #ifndef _KEYS_ASYMMETRIC_PARSER_H
1546c6f177SDavid Howells #define _KEYS_ASYMMETRIC_PARSER_H
1646c6f177SDavid Howells 
1746c6f177SDavid Howells /*
1846c6f177SDavid Howells  * Key data parser.  Called during key instantiation.
1946c6f177SDavid Howells  */
2046c6f177SDavid Howells struct asymmetric_key_parser {
2146c6f177SDavid Howells 	struct list_head	link;
2246c6f177SDavid Howells 	struct module		*owner;
2346c6f177SDavid Howells 	const char		*name;
2446c6f177SDavid Howells 
2546c6f177SDavid Howells 	/* Attempt to parse a key from the data blob passed to add_key() or
2646c6f177SDavid Howells 	 * keyctl_instantiate().  Should also generate a proposed description
2746c6f177SDavid Howells 	 * that the caller can optionally use for the key.
2846c6f177SDavid Howells 	 *
2946c6f177SDavid Howells 	 * Return EBADMSG if not recognised.
3046c6f177SDavid Howells 	 */
3146c6f177SDavid Howells 	int (*parse)(struct key_preparsed_payload *prep);
3246c6f177SDavid Howells };
3346c6f177SDavid Howells 
3446c6f177SDavid Howells extern int register_asymmetric_key_parser(struct asymmetric_key_parser *);
3546c6f177SDavid Howells extern void unregister_asymmetric_key_parser(struct asymmetric_key_parser *);
3646c6f177SDavid Howells 
3746c6f177SDavid Howells #endif /* _KEYS_ASYMMETRIC_PARSER_H */
38