2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License, Version 1.0 only
2N/A * (the "License"). You may not use this file except in compliance
2N/A * with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * ident "%Z%%M% %I% %E% SMI"
2N/A *
2N/A * Copyright (c) 1997, by Sun Microsystems, Inc.
2N/A * All rights reserved.
2N/A *
2N/A * Diffie-Hellman GSS protocol descriptions
2N/A */
2N/A
2N/A#ifdef RPC_HDR
2N/A%/*
2N/A% * dhmech_prot.h
2N/A% *
2N/A% * Copyright (c) 1997, by Sun Microsystems, Inc.
2N/A% * All rights reserved.
2N/A% *
2N/A% * Diffie-Hellman GSS protocol descriptions
2N/A% */
2N/A%
2N/A%#pragma ident "%Z%%M% %I% %E% SMI"
2N/A%#include <rpc/key_prot.h>
2N/A#endif
2N/A
2N/A/* Token types */
2N/A
2N/Aenum dh_token_type {
2N/A DH_INIT_CNTX = 1,
2N/A DH_ACCEPT_CNTX = 2,
2N/A DH_MIC = 3,
2N/A DH_WRAP = 4,
2N/A DH_DESTROY_CNTX = 5
2N/A};
2N/A
2N/Aconst DH_MAX_CHECKSUM_SIZE = 128;
2N/Aconst DH_PROTO_VERSION = 1;
2N/Aconst DH_MAX_SESSION_KEYS = 64;
2N/A
2N/Atypedef opaque dh_buffer_desc<>;
2N/Atypedef dh_buffer_desc *dh_buffer_t;
2N/Atypedef opaque dh_signature<DH_MAX_CHECKSUM_SIZE>; /* Encrypted checksum */
2N/Atypedef dh_signature *dh_signature_t;
2N/Atypedef des_block dh_key_set<DH_MAX_SESSION_KEYS>;
2N/Atypedef dh_key_set *dh_key_set_t;
2N/Atypedef unsigned int dh_qop_t;
2N/A
2N/Astruct dh_channel_binding_desc {
2N/A unsigned initiator_addrtype;
2N/A dh_buffer_desc initiator_address;
2N/A unsigned acceptor_addrtype;
2N/A dh_buffer_desc acceptor_address;
2N/A dh_buffer_desc application_data;
2N/A};
2N/Atypedef dh_channel_binding_desc *dh_channel_binding_t;
2N/A
2N/Astruct dh_cntx_desc {
2N/A netnamestr remote;
2N/A netnamestr local;
2N/A unsigned flags; /* Supported flag values from
2N/A * gss_init_sec_context/gss_accept_sec_context
2N/A */
2N/A unsigned expire;
2N/A dh_channel_binding_t channel;
2N/A};
2N/Atypedef dh_cntx_desc *dh_cntx_t;
2N/A
2N/Astruct dh_init_context_desc {
2N/A dh_cntx_desc cntx;
2N/A dh_key_set keys; /* Session keys encrypted
2N/A * with the common key
2N/A */
2N/A};
2N/Atypedef dh_init_context_desc *dh_init_context_t;
2N/A
2N/Astruct dh_accept_context_desc {
2N/A dh_cntx_desc cntx;
2N/A};
2N/Atypedef dh_accept_context_desc *dh_accept_context_t;
2N/A
2N/Astruct dh_mic_desc {
2N/A dh_qop_t qop;
2N/A unsigned seqnum;
2N/A bool client_flag; /* True if from client (context initator). */
2N/A};
2N/Atypedef dh_mic_desc *dh_mic_t;
2N/A
2N/Astruct dh_wrap_desc {
2N/A dh_mic_desc mic;
2N/A bool conf_flag;
2N/A opaque body<>; /*
2N/A * If conf_flag, then body is an encrypted
2N/A * serialize opaque msg<>
2N/A */
2N/A};
2N/Atypedef dh_wrap_desc *dh_wrap_t;
2N/A
2N/Aunion dh_token_body_desc switch (dh_token_type type) {
2N/A case DH_INIT_CNTX:
2N/A dh_init_context_desc init_context;
2N/A case DH_ACCEPT_CNTX:
2N/A dh_accept_context_desc accept_context;
2N/A case DH_MIC:
2N/A dh_mic_desc sign;
2N/A case DH_WRAP:
2N/A dh_wrap_desc seal;
2N/A case DH_DESTROY_CNTX:
2N/A void;
2N/A};
2N/Atypedef dh_token_body_desc *dh_token_body_t;
2N/A
2N/A/*
2N/A * We define a discriminated union to handle different versions of the
2N/A * protocal. We will always have a verifier follow this versioned body
2N/A * as the last member of the token.
2N/A *
2N/A * Currently there is only one version, DH_PROTO_VERSION (1).
2N/A */
2N/Aunion dh_version switch (unsigned verno) {
2N/A case DH_PROTO_VERSION:
2N/A dh_token_body_desc body;
2N/A};
2N/A
2N/A/*
2N/A * Note: All versions of the Diffie-Hellman protocol will provide a
2N/A * verifier as the last part of a token. In this way we will always
2N/A * be able to calucate the signature over the entire versioned body of the
2N/A * the token.
2N/A */
2N/A
2N/Astruct dh_token_desc {
2N/A dh_version ver;
2N/A dh_signature verifier;
2N/A};
2N/Atypedef dh_token_desc *dh_token_t;
2N/A
2N/A/*
2N/A * The token return from gss_init_sec_context will be as follows:
2N/A *
2N/A * 0x60 tag for APPLICATION 0, SEQUENCE (constructed, definite length)
2N/A * <length> DER encoded
2N/A * 0x06 tag for OID, the mech type.
2N/A * <mech type> DER encoded
2N/A * token_desc XDR encoded
2N/A */