Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
b629b6de
Commit
b629b6de
authored
18 years ago
by
Kai Blin
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
secur32: Implement RFC2104 (HMAC) with MD5 for NTLMv2.
parent
eb676fff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/secur32/Makefile.in
+1
-0
1 addition, 0 deletions
dlls/secur32/Makefile.in
dlls/secur32/hmac_md5.c
+77
-0
77 additions, 0 deletions
dlls/secur32/hmac_md5.c
dlls/secur32/hmac_md5.h
+43
-0
43 additions, 0 deletions
dlls/secur32/hmac_md5.h
with
121 additions
and
0 deletions
dlls/secur32/Makefile.in
+
1
−
0
View file @
b629b6de
...
...
@@ -10,6 +10,7 @@ DELAYIMPORTS = crypt32
C_SRCS
=
\
base64_codec.c
\
dispatcher.c
\
hmac_md5.c
\
negotiate.c
\
ntlm.c
\
schannel.c
\
...
...
This diff is collapsed.
Click to expand it.
dlls/secur32/hmac_md5.c
0 → 100644
+
77
−
0
View file @
b629b6de
/*
* Copyright 2006 Kai Blin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* This file implements RFC 2104 (HMAC) for the MD5 provider.
* It is needed for NTLMv2 signing and sealing.
*/
#include
"hmac_md5.h"
void
HMACMD5Init
(
HMAC_MD5_CTX
*
ctx
,
unsigned
char
*
key
,
unsigned
int
key_len
)
{
int
i
;
unsigned
char
inner_padding
[
64
];
unsigned
char
temp_key
[
16
];
if
(
key_len
>
64
)
{
MD5_CTX
temp_ctx
;
MD5Init
(
&
temp_ctx
);
MD5Update
(
&
temp_ctx
,
key
,
key_len
);
MD5Final
(
&
temp_ctx
);
memcpy
(
temp_key
,
temp_ctx
.
digest
,
16
);
key
=
temp_key
;
key_len
=
16
;
}
memset
(
inner_padding
,
0
,
64
);
memset
(
ctx
->
outer_padding
,
0
,
64
);
memcpy
(
inner_padding
,
key
,
key_len
);
memcpy
(
ctx
->
outer_padding
,
key
,
key_len
);
for
(
i
=
0
;
i
<
64
;
++
i
)
{
inner_padding
[
i
]
^=
0x36
;
ctx
->
outer_padding
[
i
]
^=
0x5c
;
}
MD5Init
(
&
(
ctx
->
ctx
));
MD5Update
(
&
(
ctx
->
ctx
),
inner_padding
,
64
);
}
void
HMACMD5Update
(
HMAC_MD5_CTX
*
ctx
,
unsigned
char
*
data
,
unsigned
int
data_len
)
{
MD5Update
(
&
(
ctx
->
ctx
),
data
,
data_len
);
}
void
HMACMD5Final
(
HMAC_MD5_CTX
*
ctx
,
unsigned
char
*
digest
)
{
MD5_CTX
outer_ctx
;
unsigned
char
inner_digest
[
16
];
MD5Final
(
&
(
ctx
->
ctx
));
memcpy
(
inner_digest
,
ctx
->
ctx
.
digest
,
16
);
MD5Init
(
&
outer_ctx
);
MD5Update
(
&
outer_ctx
,
ctx
->
outer_padding
,
64
);
MD5Update
(
&
outer_ctx
,
inner_digest
,
16
);
MD5Final
(
&
outer_ctx
);
memcpy
(
digest
,
outer_ctx
.
digest
,
16
);
}
This diff is collapsed.
Click to expand it.
dlls/secur32/hmac_md5.h
0 → 100644
+
43
−
0
View file @
b629b6de
/*
* Copyright 2006 Kai Blin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* This file holds the declarations needed for HMAC-MD5.
*/
#include
<string.h>
typedef
struct
{
unsigned
int
i
[
2
];
unsigned
int
buf
[
4
];
unsigned
char
in
[
64
];
unsigned
char
digest
[
16
];
}
MD5_CTX
;
typedef
struct
{
MD5_CTX
ctx
;
unsigned
char
outer_padding
[
64
];
}
HMAC_MD5_CTX
;
void
MD5Init
(
MD5_CTX
*
ctx
);
void
MD5Update
(
MD5_CTX
*
ctx
,
const
unsigned
char
*
buf
,
unsigned
int
len
);
void
MD5Final
(
MD5_CTX
*
ctx
);
void
HMACMD5Init
(
HMAC_MD5_CTX
*
ctx
,
unsigned
char
*
key
,
unsigned
int
key_len
);
void
HMACMD5Update
(
HMAC_MD5_CTX
*
ctx
,
unsigned
char
*
data
,
unsigned
int
data_len
);
void
HMACMD5Final
(
HMAC_MD5_CTX
*
ctx
,
unsigned
char
*
digest
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment