Path: blob/main/crypto/krb5/src/plugins/preauth/pkinit/pkinit_accessor.c
34923 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/*2* COPYRIGHT (C) 2006,20073* THE REGENTS OF THE UNIVERSITY OF MICHIGAN4* ALL RIGHTS RESERVED5*6* Permission is granted to use, copy, create derivative works7* and redistribute this software and such derivative works8* for any purpose, so long as the name of The University of9* Michigan is not used in any advertising or publicity10* pertaining to the use of distribution of this software11* without specific, written prior authorization. If the12* above copyright notice or any other identification of the13* University of Michigan is included in any copy of any14* portion of this software, then the disclaimer below must15* also be included.16*17* THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION18* FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY19* PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY OF20* MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING21* WITHOUT LIMITATION THE IMPLIED WARRANTIES OF22* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE23* REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE24* FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR25* CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING26* OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN27* IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF28* SUCH DAMAGES.29*/3031#include <k5-int.h>32#include "pkinit_accessor.h"3334#define DEF_FUNC_PTRS(type) \35krb5_error_code (*k5int_encode_##type)(const type *, krb5_data **); \36krb5_error_code (*k5int_decode_##type)(const krb5_data *, type **)3738#define DEF_FUNC_PTRS_ARRAY(type) \39krb5_error_code (*k5int_encode_##type)(const type **, krb5_data **); \40krb5_error_code (*k5int_decode_##type)(const krb5_data *, type ***)4142DEF_FUNC_PTRS(krb5_auth_pack);43DEF_FUNC_PTRS(krb5_kdc_dh_key_info);44DEF_FUNC_PTRS(krb5_pa_pk_as_rep);45DEF_FUNC_PTRS(krb5_pa_pk_as_req);46DEF_FUNC_PTRS(krb5_reply_key_pack);4748/* special cases... */49krb5_error_code50(*k5int_decode_krb5_principal_name)(const krb5_data *, krb5_principal_data **);5152krb5_error_code53(*k5int_encode_krb5_td_dh_parameters)(krb5_algorithm_identifier *const *,54krb5_data **code);55krb5_error_code56(*k5int_decode_krb5_td_dh_parameters)(const krb5_data *,57krb5_algorithm_identifier ***);5859krb5_error_code60(*k5int_encode_krb5_td_trusted_certifiers)61(krb5_external_principal_identifier *const *, krb5_data **code);6263krb5_error_code64(*k5int_decode_krb5_td_trusted_certifiers)65(const krb5_data *,66krb5_external_principal_identifier ***);6768krb5_error_code69(*k5int_encode_krb5_kdc_req_body)(const krb5_kdc_req *rep, krb5_data **code);7071void72(KRB5_CALLCONV *k5int_krb5_free_kdc_req)(krb5_context, krb5_kdc_req * );7374void75(*k5int_set_prompt_types)(krb5_context, krb5_prompt_type *);767778/*79* Grab internal function pointers from the krb5int_accessor80* structure and make them available81*/82krb5_error_code83pkinit_accessor_init(void)84{85krb5_error_code retval;86krb5int_access k5int;8788retval = krb5int_accessor(&k5int, KRB5INT_ACCESS_VERSION);89if (retval)90return retval;91#define SET_PTRS(type) \92k5int_encode_##type = k5int.encode_##type; \93k5int_decode_##type = k5int.decode_##type;9495SET_PTRS(krb5_auth_pack);96SET_PTRS(krb5_kdc_dh_key_info);97SET_PTRS(krb5_pa_pk_as_rep);98SET_PTRS(krb5_pa_pk_as_req);99SET_PTRS(krb5_reply_key_pack);100SET_PTRS(krb5_td_dh_parameters);101SET_PTRS(krb5_td_trusted_certifiers);102103/* special cases... */104k5int_decode_krb5_principal_name = k5int.decode_krb5_principal_name;105k5int_encode_krb5_kdc_req_body = k5int.encode_krb5_kdc_req_body;106k5int_krb5_free_kdc_req = k5int.free_kdc_req;107k5int_set_prompt_types = k5int.set_prompt_types;108return 0;109}110111112