xref: /titanic_51/usr/src/lib/libgss/README.spi (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate
2*7c478bd9Sstevel@tonic-gate CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate
4*7c478bd9Sstevel@tonic-gate The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate with the License.
8*7c478bd9Sstevel@tonic-gate
9*7c478bd9Sstevel@tonic-gate You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate and limitations under the License.
13*7c478bd9Sstevel@tonic-gate
14*7c478bd9Sstevel@tonic-gate When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate
20*7c478bd9Sstevel@tonic-gate CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate
22*7c478bd9Sstevel@tonic-gate Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
23*7c478bd9Sstevel@tonic-gate Use is subject to license terms.
24*7c478bd9Sstevel@tonic-gate
25*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
26*7c478bd9Sstevel@tonic-gate
27*7c478bd9Sstevel@tonic-gate
28*7c478bd9Sstevel@tonic-gate	The Service Provider Interface for libgss and its Mechanisms
29*7c478bd9Sstevel@tonic-gate	------------------------------------------------------------
30*7c478bd9Sstevel@tonic-gate
31*7c478bd9Sstevel@tonic-gate/* CRYPT DELETE START */
32*7c478bd9Sstevel@tonic-gate
33*7c478bd9Sstevel@tonic-gate1.  The libgss SPI upto 11/2004
34*7c478bd9Sstevel@tonic-gate
35*7c478bd9Sstevel@tonic-gate    Prior to PSARC 2004/810 the libgss SPI consisted of a function
36*7c478bd9Sstevel@tonic-gate    provided by each mechanism whose return value is a pointer to a
37*7c478bd9Sstevel@tonic-gate    structure full of references to the mechanism's entry points
38*7c478bd9Sstevel@tonic-gate    (hereinafter: methods).
39*7c478bd9Sstevel@tonic-gate
40*7c478bd9Sstevel@tonic-gate    This structure does not include any hooks for versioning, which
41*7c478bd9Sstevel@tonic-gate    means that additions of any mechanism methods at micro/patch
42*7c478bd9Sstevel@tonic-gate    releases require patching libgss.so.1 and all the GSS mechanisms
43*7c478bd9Sstevel@tonic-gate    shipped with Solaris (Kerberos V, DH, SPNEGO).
44*7c478bd9Sstevel@tonic-gate
45*7c478bd9Sstevel@tonic-gate2.  The libgss SPI after PSARC 2004/810
46*7c478bd9Sstevel@tonic-gate
47*7c478bd9Sstevel@tonic-gate    In order to avoid changing the gss_config struct and patching all
48*7c478bd9Sstevel@tonic-gate    three mechanisms (four, if the dummy mech counts) and libgss
49*7c478bd9Sstevel@tonic-gate    together and in anticipation of a cleaner SPI in the future (see
50*7c478bd9Sstevel@tonic-gate    next section) the SPI after PSARC 2004/810 will be as before but
51*7c478bd9Sstevel@tonic-gate    supplemented as follows:
52*7c478bd9Sstevel@tonic-gate
53*7c478bd9Sstevel@tonic-gate     - any new SPI mechanism methods will NOT be placed in gss_config,
54*7c478bd9Sstevel@tonic-gate       instead there is a new gss_config_ext structure, which is to be
55*7c478bd9Sstevel@tonic-gate       used _only_ by libgss (to avoid struct versioning and/or patch
56*7c478bd9Sstevel@tonic-gate       issues), which should be extended to have a pointer to the new
57*7c478bd9Sstevel@tonic-gate       method;
58*7c478bd9Sstevel@tonic-gate
59*7c478bd9Sstevel@tonic-gate     - there is a new libgss function, __gss_get_mechanism_ext(), which
60*7c478bd9Sstevel@tonic-gate       is used to get at the gss_config_ext for a mechanism;
61*7c478bd9Sstevel@tonic-gate
62*7c478bd9Sstevel@tonic-gate     - __gss_get_mechanism_ext() uses dlsym() to build the
63*7c478bd9Sstevel@tonic-gate       gss_config_ext struct for the mech by individually loading each
64*7c478bd9Sstevel@tonic-gate       and every mechanism method that isn't part of the old gss_config
65*7c478bd9Sstevel@tonic-gate       struct -- this happens only once per-method, of course; the
66*7c478bd9Sstevel@tonic-gate       result is cached.
67*7c478bd9Sstevel@tonic-gate
68*7c478bd9Sstevel@tonic-gate       The symbol names that are dlsym()ed are of the form gssspi_* and
69*7c478bd9Sstevel@tonic-gate       correspond to gss_*; e.g., gssspi_acquire_cred_with_password().
70*7c478bd9Sstevel@tonic-gate
71*7c478bd9Sstevel@tonic-gate       New methods also have a corresponding typedef named
72*7c478bd9Sstevel@tonic-gate       <gss_func>_sfct -- the 's' in 'sfct' is for "SPI" and the 'fct'
73*7c478bd9Sstevel@tonic-gate       is for "function."  This is used to keep cast expressions short.
74*7c478bd9Sstevel@tonic-gate
75*7c478bd9Sstevel@tonic-gate3.  The Future libgss SPI
76*7c478bd9Sstevel@tonic-gate
77*7c478bd9Sstevel@tonic-gate    Once the Solaris krb5 source is resync'ed with MIT krb5 1.4 there
78*7c478bd9Sstevel@tonic-gate    will be no further need for the 'void *context' argument to all the
79*7c478bd9Sstevel@tonic-gate    libgss mechanisms' methods.
80*7c478bd9Sstevel@tonic-gate
81*7c478bd9Sstevel@tonic-gate    At that point it will be possible to remove this 'void *context'
82*7c478bd9Sstevel@tonic-gate    argument from all the libgss SPI function prototypes, the main
83*7c478bd9Sstevel@tonic-gate    result of which will be that the mechanisms' methods will then have
84*7c478bd9Sstevel@tonic-gate    the same function signature as the corresponding GSS-API functions.
85*7c478bd9Sstevel@tonic-gate
86*7c478bd9Sstevel@tonic-gate    We can then rename all mechanisms' methods from <mech>_<gss-func> to
87*7c478bd9Sstevel@tonic-gate    <gss-func>.  The corresponding typedefs will be renamed to
88*7c478bd9Sstevel@tonic-gate    <gss-func>_fct.
89*7c478bd9Sstevel@tonic-gate
90*7c478bd9Sstevel@tonic-gate    The SPI, then, will be almost exactly the same as the API.
91*7c478bd9Sstevel@tonic-gate
92*7c478bd9Sstevel@tonic-gate    There will be some minor differences, primarily that some API
93*7c478bd9Sstevel@tonic-gate    functions won't have a corresponding SPI method, such as
94*7c478bd9Sstevel@tonic-gate    gss_release_buffer(3GSS), for example.
95*7c478bd9Sstevel@tonic-gate
96*7c478bd9Sstevel@tonic-gate    Some time later we may open the SPI to third party implementors;
97*7c478bd9Sstevel@tonic-gate    this could be particularly useful as a way to get access to 3rd
98*7c478bd9Sstevel@tonic-gate    party implementations of SPKM and LIPKEY (assuming any ever exist --
99*7c478bd9Sstevel@tonic-gate    SPKM's is a very problematic specification).
100*7c478bd9Sstevel@tonic-gate
101*7c478bd9Sstevel@tonic-gate    Third party mechanisms should just export all the symbols for the
102*7c478bd9Sstevel@tonic-gate    GSS-API functions, like MIT krb5 does, but functions which libgss
103*7c478bd9Sstevel@tonic-gate    won't call (e.g., gss_release_buffer(3GSS)) should either not be
104*7c478bd9Sstevel@tonic-gate    implemented or should be weak symbols.
105*7c478bd9Sstevel@tonic-gate
106*7c478bd9Sstevel@tonic-gate    Solaris native mechanisms may still provide the mechanism method
107*7c478bd9Sstevel@tonic-gate    registration function as usual for optimization purposes -- to
108*7c478bd9Sstevel@tonic-gate    reduce the number of calls to dlsym().
109*7c478bd9Sstevel@tonic-gate
110*7c478bd9Sstevel@tonic-gate    Mechanisms that do not provide the old method registration function
111*7c478bd9Sstevel@tonic-gate    will be loaded as follows:
112*7c478bd9Sstevel@tonic-gate
113*7c478bd9Sstevel@tonic-gate     - libgss will look for and find the mechanism's
114*7c478bd9Sstevel@tonic-gate       GSS_Indicate_mechs() method and will call it to discover the
115*7c478bd9Sstevel@tonic-gate       mechanism provider's mechanism OIDs.
116*7c478bd9Sstevel@tonic-gate
117*7c478bd9Sstevel@tonic-gate     - libgss will dlsym() each mechanism provider SPI method.
118*7c478bd9Sstevel@tonic-gate
119*7c478bd9Sstevel@tonic-gate/* CRYPT DELETE END */
120