xref: /illumos-gate/usr/src/uts/common/gssapi/mechs/krb5/mech/verify.c (revision c61a1653a4d73dbc950dac7d96350fd6cb517486)
1 /*
2  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright 1993 by OpenVision Technologies, Inc.
8  *
9  * Permission to use, copy, modify, distribute, and sell this software
10  * and its documentation for any purpose is hereby granted without fee,
11  * provided that the above copyright notice appears in all copies and
12  * that both that copyright notice and this permission notice appear in
13  * supporting documentation, and that the name of OpenVision not be used
14  * in advertising or publicity pertaining to distribution of the software
15  * without specific, written prior permission. OpenVision makes no
16  * representations about the suitability of this software for any
17  * purpose.  It is provided "as is" without express or implied warranty.
18  *
19  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
20  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
21  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
22  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
23  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25  * PERFORMANCE OF THIS SOFTWARE.
26  */
27 
28 #include "gssapiP_krb5.h"
29 
30 /*
31  * $Id: verify.c 16171 2004-03-15 17:45:01Z raeburn $
32  */
33 
34 /*ARGSUSED*/
35 OM_uint32
36 krb5_gss_verify(minor_status, context_handle,
37 		message_buffer, token_buffer,
38 		qop_state
39 #ifdef	 _KERNEL
40 		, gssd_ctx_verifier
41 #endif
42 		)
43      OM_uint32 *minor_status;
44      gss_ctx_id_t context_handle;
45      gss_buffer_t message_buffer;
46      gss_buffer_t token_buffer;
47      int *qop_state;
48 #ifdef	 _KERNEL
49      OM_uint32 gssd_ctx_verifier;
50 #endif
51 {
52      return(kg_unseal(minor_status, context_handle,
53 		      token_buffer, message_buffer,
54 		      NULL, qop_state, KG_TOK_SIGN_MSG));
55 }
56 
57 /* V2 interface */
58 OM_uint32
59 krb5_gss_verify_mic(minor_status, context_handle,
60 		    message_buffer, token_buffer,
61 		    qop_state)
62     OM_uint32		*minor_status;
63     gss_ctx_id_t	context_handle;
64     gss_buffer_t	message_buffer;
65     gss_buffer_t	token_buffer;
66     gss_qop_t		*qop_state;
67 {
68     OM_uint32		rstat;
69     int			qstate;
70 
71     rstat = kg_unseal(minor_status, context_handle,
72 		      token_buffer, message_buffer,
73 		      NULL, &qstate, KG_TOK_MIC_MSG);
74     if (!rstat && qop_state)
75 	*qop_state = (gss_qop_t) qstate;
76     return(rstat);
77 }
78