1 /* $NetBSD: netlogon.h,v 1.1.1.1 2011/04/13 18:14:47 elric Exp $ */
4 * Copyright (c) 2010 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Portions Copyright (c) 2010 Apple Inc. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * 3. Neither the name of the Institute nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 #ifndef NETLOGON_NETLOGON_H
39 #define NETLOGON_NETLOGON_H
49 #include <gssapi/gssapi.h>
50 #include <gssapi_mech.h>
51 #include <gssapi_netlogon.h>
53 #include <krb5/krb5.h>
55 #include <krb5/roken.h>
56 #include <heim_threads.h>
58 #define HC_DEPRECATED_CRYPTO
59 #include "crypto-headers.h"
66 #define NL_NEGOTIATE_REQUEST_MESSAGE 0x00000000
67 #define NL_NEGOTIATE_RESPONSE_MESSAGE 0x00000001
69 #define NL_FLAG_NETBIOS_DOMAIN_NAME 0x00000001
70 #define NL_FLAG_NETBIOS_COMPUTER_NAME 0x00000002
71 #define NL_FLAG_DNS_DOMAIN_NAME 0x00000004
72 #define NL_FLAG_DNS_HOST_NAME 0x00000008 /* not used */
73 #define NL_FLAG_UTF8_COMPUTER_NAME 0x00000010
78 #define NL_AUTH_MESSAGE_LENGTH 8
80 /* SignatureAlgorithm */
81 #define NL_SIGN_ALG_HMAC_MD5 0x0077
82 #define NL_SIGN_ALG_SHA256 0x0013
85 #define NL_SEAL_ALG_RC4 0x007A
86 #define NL_SEAL_ALG_AES128 0x001A
87 #define NL_SEAL_ALG_NONE 0xFFFF
90 uint16_t SignatureAlgorithm
;
91 uint16_t SealAlgorithm
;
94 uint8_t SequenceNumber
[8];
96 uint8_t Confounder
[8];
99 #define NL_AUTH_SIGNATURE_HEADER_LENGTH 8
100 #define NL_AUTH_SIGNATURE_COMMON_LENGTH 16
101 #define NL_AUTH_SIGNATURE_LENGTH 32
104 uint16_t SignatureAlgorithm
;
105 uint16_t SealAlgorithm
;
108 uint8_t SequenceNumber
[8];
109 uint8_t Checksum
[32];
110 uint8_t Confounder
[8];
111 } NL_AUTH_SHA2_SIGNATURE
;
113 #define NL_AUTH_SHA2_SIGNATURE_LENGTH 56
116 NL_AUTH_SIGNATURE Signature
;
117 NL_AUTH_SHA2_SIGNATURE SHA2Signature
;
118 } NL_AUTH_SIGNATURE_U
;
120 #define NL_AUTH_SIGNATURE_P(_u) (&(_u)->Signature)
122 typedef struct gssnetlogon_name
{
123 gss_buffer_desc NetbiosName
;
124 gss_buffer_desc DnsName
;
127 typedef struct gssnetlogon_cred
{
128 gssnetlogon_name
*Name
;
129 uint16_t SignatureAlgorithm
;
130 uint16_t SealAlgorithm
;
131 uint8_t SessionKey
[16];
134 typedef struct gssnetlogon_ctx
{
136 enum { NL_AUTH_NEGOTIATE
, NL_AUTH_ESTABLISHED
} State
;
138 uint8_t LocallyInitiated
;
139 uint32_t MessageBlockSize
;
140 uint16_t SignatureAlgorithm
;
141 uint16_t SealAlgorithm
;
142 uint64_t SequenceNumber
;
143 gssnetlogon_name SourceName
;
144 gssnetlogon_name TargetName
;
145 uint8_t SessionKey
[16];
148 #include <netlogon-private.h>
150 #endif /* NETLOGON_NETLOGON_H */