libtommath: Fix possible integer overflow CVE-2023-36328
[heimdal.git] / kdc / token_validator_plugin.h
blob8ff00149aefb47bf90563dbb7a06defd0782e277
1 /*
2 * Copyright (c) 2019 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #ifndef HEIMDAL_KDC_BEARER_TOKEN_PLUGIN_H
35 #define HEIMDAL_KDC_BEARER_TOKEN_PLUGIN_H 1
37 #define KDC_PLUGIN_BEARER "kdc_token_validator"
38 #define KDC_PLUGIN_BEARER_VERSION_0 0
41 * @param init Plugin initialization function (see krb5-plugin(7))
42 * @param minor_version The plugin minor version number (0)
43 * @param fini Plugin finalization function
44 * @param validate Plugin token validation function
46 * The validate field is the plugin entry point that performs the bearer token
47 * validation operation however the plugin desires. It is invoked in no
48 * particular order relative to other bearer token validator plugins. The
49 * plugin validate function must return KRB5_PLUGIN_NO_HANDLE if the rule is
50 * not applicable to it.
52 * The plugin validate function has the following arguments, in this
53 * order:
55 * -# plug_ctx, the context value output by the plugin's init function
56 * -# context, a krb5_context
57 * -# realm, a const char *
58 * -# token_type, a const char *
59 * -# token, a krb5_data *
60 * -# audiences, a const pointer to an array of const char * containing
61 * expected audiences of the token (aka, acceptor names)
62 * -# naudiences, a size_t count of audiences
63 * -# requested_principal, a krb5_const_principal
64 * -# validation result, a pointer to a krb5_boolean
65 * -# actual principal, a krb5_principal * output parameter (optional)
67 * @ingroup krb5_support
69 typedef struct krb5plugin_token_validator_ftable_desc {
70 HEIM_PLUGIN_FTABLE_COMMON_ELEMENTS(krb5_context);
71 krb5_error_code (KRB5_LIB_CALL *validate)(void *, /*plug_ctx*/
72 krb5_context,
73 const char *, /*realm*/
74 const char *, /*token_type*/
75 krb5_data *, /*token*/
76 const char * const *, /*audiences*/
77 size_t, /*naudiences*/
78 krb5_boolean *, /*valid*/
79 krb5_principal *, /*actual_principal*/
80 krb5_times *); /*token_times*/
81 } krb5plugin_token_validator_ftable;
83 #endif /* HEIMDAL_KDC_BEARER_TOKEN_PLUGIN_H */