implement the new gss_*_iov interfaces
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24055 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		
							
								
								
									
										103
									
								
								lib/gssapi/mech/gss_aeap.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								lib/gssapi/mech/gss_aeap.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| /* | ||||
|  * AEAD support | ||||
|  */  | ||||
|  | ||||
| #include "mech_locl.h" | ||||
| RCSID("$Id$"); | ||||
|  | ||||
| OM_uint32 GSSAPI_LIB_FUNCTION | ||||
| gss_wrap_iov(OM_uint32 * minor_status, | ||||
| 	     gss_ctx_id_t  context_handle, | ||||
| 	     int conf_req_flag, | ||||
| 	     gss_qop_t qop_req, | ||||
| 	     int * conf_state, | ||||
| 	     size_t iov_count, | ||||
| 	     gss_iov_buffer_desc *iov) | ||||
| { | ||||
| 	struct _gss_context *ctx = (struct _gss_context *) context_handle; | ||||
| 	gssapi_mech_interface m = ctx->gc_mech; | ||||
|  | ||||
| 	if (conf_state) | ||||
| 	    *conf_state = 0; | ||||
| 	if (ctx == NULL) { | ||||
| 	    *minor_status = 0; | ||||
| 	    return GSS_S_NO_CONTEXT; | ||||
| 	} | ||||
| 	if (m->gm_wrap_iov == NULL) { | ||||
| 	    *minor_status = 0; | ||||
| 	    return GSS_S_UNAVAILABLE; | ||||
| 	} | ||||
|  | ||||
| 	return (m->gm_wrap_iov)(minor_status, ctx->gc_ctx, | ||||
| 				conf_req_flag, qop_req, conf_state, iov_count, iov); | ||||
| } | ||||
|  | ||||
| OM_uint32 GSSAPI_LIB_FUNCTION | ||||
| gss_unwrap_iov(OM_uint32 *minor_status, | ||||
| 	       gss_ctx_id_t context_handle, | ||||
| 	       int *conf_state, | ||||
| 	       gss_qop_t *qop_state, | ||||
| 	       size_t iov_count, | ||||
| 	       gss_iov_buffer_desc *iov) | ||||
| { | ||||
| 	struct _gss_context *ctx = (struct _gss_context *) context_handle; | ||||
| 	gssapi_mech_interface m = ctx->gc_mech; | ||||
|  | ||||
| 	if (conf_state) | ||||
| 	    *conf_state = 0; | ||||
| 	if (qop_state) | ||||
| 	    *qop_state = 0; | ||||
| 	if (ctx == NULL) { | ||||
| 	    *minor_status = 0; | ||||
| 	    return GSS_S_NO_CONTEXT; | ||||
| 	} | ||||
| 	if (m->gm_unwrap_iov == NULL) { | ||||
| 	    *minor_status = 0; | ||||
| 	    return GSS_S_UNAVAILABLE; | ||||
| 	} | ||||
|  | ||||
| 	return (m->gm_unwrap_iov)(minor_status, ctx->gc_ctx, | ||||
| 				conf_state, qop_state, iov_count, iov); | ||||
| } | ||||
|  | ||||
| OM_uint32  GSSAPI_LIB_FUNCTION | ||||
| gss_wrap_iov_length(OM_uint32 * minor_status, | ||||
| 		    gss_ctx_id_t context_handle, | ||||
| 		    int conf_req_flag, | ||||
| 		    gss_qop_t qop_req, | ||||
| 		    size_t iov_count, | ||||
| 		    gss_iov_buffer_desc *iov) | ||||
| { | ||||
| 	struct _gss_context *ctx = (struct _gss_context *) context_handle; | ||||
| 	gssapi_mech_interface m = ctx->gc_mech; | ||||
|  | ||||
| 	if (ctx == NULL) { | ||||
| 	    *minor_status = 0; | ||||
| 	    return GSS_S_NO_CONTEXT; | ||||
| 	} | ||||
| 	if (m->gm_wrap_iov == NULL) { | ||||
| 	    *minor_status = 0; | ||||
| 	    return GSS_S_UNAVAILABLE; | ||||
| 	} | ||||
|  | ||||
| 	return (m->gm_wrap_iov_length)(minor_status, ctx->gc_ctx, | ||||
| 				       conf_req_flag, qop_req, iov_count, iov); | ||||
| } | ||||
|  | ||||
| OM_uint32 GSSAPI_LIB_FUNCTION | ||||
| gss_release_iov_buffer(OM_uint32 *minor_status, | ||||
| 		       size_t  iov_count, | ||||
| 		       gss_iov_buffer_desc *iov) | ||||
| { | ||||
|     OM_uint32 junk; | ||||
|     size_t i; | ||||
|  | ||||
|     for (i = 0; i < iov_count; i++) { | ||||
| 	if ((iov[i].flags & GSS_IOV_BUFFER_FLAG_ALLOCATED) == 0) | ||||
| 	    continue; | ||||
| 	gss_release_buffer(&junk, &iov[i].buffer); | ||||
|     } | ||||
|     *minor_status = 0; | ||||
|     return GSS_S_COMPLETE; | ||||
| } | ||||
|  | ||||
| @@ -317,6 +317,9 @@ _gss_load_mech(void) | ||||
| 		OPTSYM(set_sec_context_option); | ||||
| 		OPTSYM(set_cred_option); | ||||
| 		OPTSYM(pseudo_random); | ||||
| 		OPTSYM(wrap_iov); | ||||
| 		OPTSYM(unwrap_iov); | ||||
| 		OPTSYM(wrap_iov_length); | ||||
|  | ||||
| 		SLIST_INSERT_HEAD(&_gss_mechs, m, gm_link); | ||||
| 		continue; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand