8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / gss_mechs / mech_dh / backend / mech / dhmech.c
blob708c870b74401bd3ed7c5cbc908709e79dcc1f07
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include "dh_gssapi.h"
28 #include <stdlib.h>
31 * gss_config structure for Diffie-Hellman family of mechanisms.
32 * This structure is defined in mechglueP.h and defines the entry points
33 * that libgss uses to call a backend.
35 static struct gss_config dh_mechanism = {
36 {0, 0}, /* OID for mech type. */
38 __dh_gss_acquire_cred,
39 __dh_gss_release_cred,
40 __dh_gss_init_sec_context,
41 __dh_gss_accept_sec_context,
42 __dh_gss_unseal,
43 __dh_gss_process_context_token,
44 __dh_gss_delete_sec_context,
45 __dh_gss_context_time,
46 __dh_gss_display_status,
47 NULL, /* Back ends don't implement this */
48 __dh_gss_compare_name,
49 __dh_gss_display_name,
50 __dh_gss_import_name,
51 __dh_gss_release_name,
52 __dh_gss_inquire_cred,
53 NULL, /* Back ends don't implement this */
54 __dh_gss_seal,
55 __dh_gss_export_sec_context,
56 __dh_gss_import_sec_context,
57 __dh_gss_inquire_cred_by_mech,
58 __dh_gss_inquire_names_for_mech,
59 __dh_gss_inquire_context,
60 __dh_gss_internal_release_oid,
61 __dh_gss_wrap_size_limit,
62 __dh_pname_to_uid,
63 NULL, /* __gss_userok */
64 __dh_gss_export_name,
65 __dh_gss_sign,
66 __dh_gss_verify,
67 NULL, /* gss_store_cred() -- DH lacks this for now */
71 * __dh_gss_initialize:
72 * Each mechanism in the Diffie-Hellman family of mechanisms calls this
73 * routine passing a pointer to a gss_config structure. This routine will
74 * then check that the mech is not already initialized (If so just return
75 * the mech). It will then assign the entry points that are common to the
76 * mechanism family to the uninitialized mech. After which, it allocate space
77 * for that mechanism's context. It will be up to the caller to fill in
78 * its mechanism OID and fill in the corresponding fields in mechanism
79 * specific context.
81 gss_mechanism
82 __dh_gss_initialize(gss_mechanism mech)
84 if (mech->context != NULL)
85 return (mech); /* already initialized */
87 /* Copy the common entry points for this mechcanisms */
88 *mech = dh_mechanism;
90 /* Allocate space for this mechanism's context */
91 mech->context = New(dh_context_desc, 1);
92 if (mech->context == NULL)
93 return (NULL);
95 /* return the mech */
96 return (mech);