+ /* ssh1 needs to exchange the hash of the keys */
+ /* will us this hash to return it */
+ if (!compat20) {
+ if ((maj_status=gss_wrap(&min_status,ctx->context,
+ 0,
+ GSS_C_QOP_DEFAULT,
+ buffer,
+ NULL,
+ hash)))
+ ssh_gssapi_error(ctx->oid,maj_status,min_status);
+ }
+ else
+
+ if ((maj_status=gss_get_mic(&min_status,ctx->context,
+ GSS_C_QOP_DEFAULT, buffer, hash))) {
+ ssh_gssapi_error(ctx->oid,maj_status,min_status);
+ }
+
+ return(maj_status);
+}
+
+OM_uint32
+ssh_gssapi_server_ctx(Gssctxt **ctx,gss_OID oid) {
+ if (*ctx) ssh_gssapi_delete_ctx(ctx);
+ ssh_gssapi_build_ctx(ctx);
+ ssh_gssapi_set_oid(*ctx,oid);
+ return(ssh_gssapi_acquire_cred(*ctx));
+}
+
+OM_uint32
+ssh_gssapi_client_ctx(Gssctxt **ctx,gss_OID oid, char *host) {
+ gss_buffer_desc token = {0,NULL};
+ OM_uint32 major,minor;
+
+ if (*ctx) ssh_gssapi_delete_ctx(ctx);
+ ssh_gssapi_build_ctx(ctx);
+ ssh_gssapi_set_oid(*ctx,oid);
+ ssh_gssapi_import_name(*ctx,host);
+ major=ssh_gssapi_init_ctx(*ctx, 0, GSS_C_NO_BUFFER, &token, NULL);
+ gss_release_buffer(&minor,&token);
+ return(major);
+}
+