2 * Unix SMB/CIFS implementation.
4 * NTLMSSP Signing routines
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-2001
6 * Copyright (C) Andrew Bartlett <abartlet@samba.org> 2003-2005
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
23 #include "auth/ntlmssp/ntlmssp.h"
24 #include "auth/gensec/gensec.h"
25 #include "../libcli/auth/ntlmssp_private.h"
27 NTSTATUS
gensec_ntlmssp_sign_packet(struct gensec_security
*gensec_security
,
28 TALLOC_CTX
*sig_mem_ctx
,
29 const uint8_t *data
, size_t length
,
30 const uint8_t *whole_pdu
, size_t pdu_length
,
33 struct gensec_ntlmssp_context
*gensec_ntlmssp
=
34 talloc_get_type_abort(gensec_security
->private_data
,
35 struct gensec_ntlmssp_context
);
38 nt_status
= ntlmssp_sign_packet(gensec_ntlmssp
->ntlmssp_state
,
41 whole_pdu
, pdu_length
,
47 NTSTATUS
gensec_ntlmssp_check_packet(struct gensec_security
*gensec_security
,
48 TALLOC_CTX
*sig_mem_ctx
,
49 const uint8_t *data
, size_t length
,
50 const uint8_t *whole_pdu
, size_t pdu_length
,
53 struct gensec_ntlmssp_context
*gensec_ntlmssp
=
54 talloc_get_type_abort(gensec_security
->private_data
,
55 struct gensec_ntlmssp_context
);
58 nt_status
= ntlmssp_check_packet(gensec_ntlmssp
->ntlmssp_state
,
60 whole_pdu
, pdu_length
,
66 NTSTATUS
gensec_ntlmssp_seal_packet(struct gensec_security
*gensec_security
,
67 TALLOC_CTX
*sig_mem_ctx
,
68 uint8_t *data
, size_t length
,
69 const uint8_t *whole_pdu
, size_t pdu_length
,
72 struct gensec_ntlmssp_context
*gensec_ntlmssp
=
73 talloc_get_type_abort(gensec_security
->private_data
,
74 struct gensec_ntlmssp_context
);
77 nt_status
= ntlmssp_seal_packet(gensec_ntlmssp
->ntlmssp_state
,
80 whole_pdu
, pdu_length
,
87 wrappers for the ntlmssp_*() functions
89 NTSTATUS
gensec_ntlmssp_unseal_packet(struct gensec_security
*gensec_security
,
90 TALLOC_CTX
*sig_mem_ctx
,
91 uint8_t *data
, size_t length
,
92 const uint8_t *whole_pdu
, size_t pdu_length
,
95 struct gensec_ntlmssp_context
*gensec_ntlmssp
=
96 talloc_get_type_abort(gensec_security
->private_data
,
97 struct gensec_ntlmssp_context
);
100 nt_status
= ntlmssp_unseal_packet(gensec_ntlmssp
->ntlmssp_state
,
102 whole_pdu
, pdu_length
,
108 size_t gensec_ntlmssp_sig_size(struct gensec_security
*gensec_security
, size_t data_size
)
110 return NTLMSSP_SIG_SIZE
;
113 NTSTATUS
gensec_ntlmssp_wrap(struct gensec_security
*gensec_security
,
114 TALLOC_CTX
*out_mem_ctx
,
118 struct gensec_ntlmssp_context
*gensec_ntlmssp
=
119 talloc_get_type_abort(gensec_security
->private_data
,
120 struct gensec_ntlmssp_context
);
122 return ntlmssp_wrap(gensec_ntlmssp
->ntlmssp_state
,
128 NTSTATUS
gensec_ntlmssp_unwrap(struct gensec_security
*gensec_security
,
129 TALLOC_CTX
*out_mem_ctx
,
133 struct gensec_ntlmssp_context
*gensec_ntlmssp
=
134 talloc_get_type_abort(gensec_security
->private_data
,
135 struct gensec_ntlmssp_context
);
137 return ntlmssp_unwrap(gensec_ntlmssp
->ntlmssp_state
,