Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
311d839d
Commit
311d839d
authored
Mar 15, 2010
by
Juan Lang
Committed by
Alexandre Julliard
Mar 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rsaenh: Add support for SHA-256, SHA-384, and SHA-512.
parent
693c9916
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
4 deletions
+134
-4
Makefile.in
dlls/rsaenh/Makefile.in
+2
-1
implglue.c
dlls/rsaenh/implglue.c
+36
-0
implglue.h
dlls/rsaenh/implglue.h
+4
-0
rsaenh.c
dlls/rsaenh/rsaenh.c
+3
-0
sha2.c
dlls/rsaenh/sha2.c
+0
-0
sha2.h
dlls/rsaenh/sha2.h
+89
-0
rsaenh.c
dlls/rsaenh/tests/rsaenh.c
+0
-3
No files found.
dlls/rsaenh/Makefile.in
View file @
311d839d
...
...
@@ -17,7 +17,8 @@ C_SRCS = \
rc2.c
\
rc4.c
\
rsa.c
\
rsaenh.c
rsaenh.c
\
sha2.c
RC_SRCS
=
version.rc
...
...
dlls/rsaenh/implglue.c
View file @
311d839d
...
...
@@ -67,6 +67,18 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
case
CALG_SHA
:
A_SHAInit
(
&
pHashContext
->
sha
);
break
;
case
CALG_SHA_256
:
SHA256_Init
(
&
pHashContext
->
sha256
);
break
;
case
CALG_SHA_384
:
SHA384_Init
(
&
pHashContext
->
sha384
);
break
;
case
CALG_SHA_512
:
SHA512_Init
(
&
pHashContext
->
sha512
);
break
;
}
return
TRUE
;
...
...
@@ -93,6 +105,18 @@ BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, CONST BYTE *pb
A_SHAUpdate
(
&
pHashContext
->
sha
,
pbData
,
dwDataLen
);
break
;
case
CALG_SHA_256
:
SHA256_Update
(
&
pHashContext
->
sha256
,
pbData
,
dwDataLen
);
break
;
case
CALG_SHA_384
:
SHA384_Update
(
&
pHashContext
->
sha384
,
pbData
,
dwDataLen
);
break
;
case
CALG_SHA_512
:
SHA512_Update
(
&
pHashContext
->
sha512
,
pbData
,
dwDataLen
);
break
;
default:
SetLastError
(
NTE_BAD_ALGID
);
return
FALSE
;
...
...
@@ -123,6 +147,18 @@ BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHash
A_SHAFinal
(
&
pHashContext
->
sha
,
(
PULONG
)
pbHashValue
);
break
;
case
CALG_SHA_256
:
SHA256_Final
(
pbHashValue
,
&
pHashContext
->
sha256
);
break
;
case
CALG_SHA_384
:
SHA384_Final
(
pbHashValue
,
&
pHashContext
->
sha384
);
break
;
case
CALG_SHA_512
:
SHA512_Final
(
pbHashValue
,
&
pHashContext
->
sha512
);
break
;
default:
SetLastError
(
NTE_BAD_ALGID
);
return
FALSE
;
...
...
dlls/rsaenh/implglue.h
View file @
311d839d
...
...
@@ -25,6 +25,7 @@
#define __WINE_IMPLGLUE_H
#include "tomcrypt.h"
#include "sha2.h"
/* Next typedef copied from dlls/advapi32/crypt_md4.c */
typedef
struct
tagMD4_CTX
{
...
...
@@ -57,6 +58,9 @@ typedef union tagHASH_CONTEXT {
MD4_CTX
md4
;
MD5_CTX
md5
;
SHA_CTX
sha
;
SHA256_CTX
sha256
;
SHA384_CTX
sha384
;
SHA512_CTX
sha512
;
}
HASH_CONTEXT
;
typedef
union
tagKEY_CONTEXT
{
...
...
dlls/rsaenh/rsaenh.c
View file @
311d839d
...
...
@@ -241,6 +241,9 @@ static const PROV_ENUMALGS_EX aProvEnumAlgsEx[5][RSAENH_MAX_ENUMALGS+1] =
{
CALG_AES_192
,
192
,
192
,
192
,
0
,
8
,
"AES-192"
,
39
,
"Advanced Encryption Standard (AES-192)"
},
{
CALG_AES_256
,
256
,
256
,
256
,
0
,
8
,
"AES-256"
,
39
,
"Advanced Encryption Standard (AES-256)"
},
{
CALG_SHA
,
160
,
160
,
160
,
CRYPT_FLAG_SIGNING
,
6
,
"SHA-1"
,
30
,
"Secure Hash Algorithm (SHA-1)"
},
{
CALG_SHA_256
,
256
,
256
,
256
,
CRYPT_FLAG_SIGNING
,
6
,
"SHA-256"
,
30
,
"Secure Hash Algorithm (SHA-256)"
},
{
CALG_SHA_384
,
384
,
384
,
384
,
CRYPT_FLAG_SIGNING
,
6
,
"SHA-384"
,
30
,
"Secure Hash Algorithm (SHA-284)"
},
{
CALG_SHA_512
,
512
,
512
,
512
,
CRYPT_FLAG_SIGNING
,
6
,
"SHA-512"
,
30
,
"Secure Hash Algorithm (SHA-512)"
},
{
CALG_MD2
,
128
,
128
,
128
,
CRYPT_FLAG_SIGNING
,
4
,
"MD2"
,
23
,
"Message Digest 2 (MD2)"
},
{
CALG_MD4
,
128
,
128
,
128
,
CRYPT_FLAG_SIGNING
,
4
,
"MD4"
,
23
,
"Message Digest 4 (MD4)"
},
{
CALG_MD5
,
128
,
128
,
128
,
CRYPT_FLAG_SIGNING
,
4
,
"MD5"
,
23
,
"Message Digest 5 (MD5)"
},
...
...
dlls/rsaenh/sha2.c
0 → 100644
View file @
311d839d
This diff is collapsed.
Click to expand it.
dlls/rsaenh/sha2.h
0 → 100644
View file @
311d839d
/*
* FILE: sha2.h
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
*
* Copyright (c) 2000-2001, Aaron D. Gifford
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTOR(S) BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef __SHA2_H__
#define __SHA2_H__
#include <basetsd.h>
/*** SHA-256/384/512 Various Length Definitions ***********************/
#define SHA256_BLOCK_LENGTH 64
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
#define SHA384_BLOCK_LENGTH 128
#define SHA384_DIGEST_LENGTH 48
#define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1)
#define SHA512_BLOCK_LENGTH 128
#define SHA512_DIGEST_LENGTH 64
#define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1)
/*** SHA-256/384/512 Context Structures *******************************/
typedef
UINT8
sha2_byte
;
/* Exactly 1 byte */
typedef
UINT32
sha2_word32
;
/* Exactly 4 bytes */
typedef
UINT64
sha2_word64
;
/* Exactly 8 bytes */
typedef
struct
_SHA256_CTX
{
sha2_word32
state
[
8
];
sha2_word64
bitcount
;
sha2_byte
buffer
[
SHA256_BLOCK_LENGTH
];
}
SHA256_CTX
;
typedef
struct
_SHA512_CTX
{
sha2_word64
state
[
8
];
sha2_word64
bitcount
[
2
];
sha2_byte
buffer
[
SHA512_BLOCK_LENGTH
];
}
SHA512_CTX
;
typedef
SHA512_CTX
SHA384_CTX
;
/*** SHA-256/384/512 Function Prototypes ******************************/
void
SHA256_Init
(
SHA256_CTX
*
);
void
SHA256_Update
(
SHA256_CTX
*
,
const
sha2_byte
*
,
size_t
);
void
SHA256_Final
(
sha2_byte
[
SHA256_DIGEST_LENGTH
],
SHA256_CTX
*
);
char
*
SHA256_End
(
SHA256_CTX
*
,
char
[
SHA256_DIGEST_STRING_LENGTH
]);
char
*
SHA256_Data
(
const
sha2_byte
*
,
size_t
,
char
[
SHA256_DIGEST_STRING_LENGTH
]);
void
SHA384_Init
(
SHA384_CTX
*
);
void
SHA384_Update
(
SHA384_CTX
*
,
const
sha2_byte
*
,
size_t
);
void
SHA384_Final
(
sha2_byte
[
SHA384_DIGEST_LENGTH
],
SHA384_CTX
*
);
char
*
SHA384_End
(
SHA384_CTX
*
,
char
[
SHA384_DIGEST_STRING_LENGTH
]);
char
*
SHA384_Data
(
const
sha2_byte
*
,
size_t
,
char
[
SHA384_DIGEST_STRING_LENGTH
]);
void
SHA512_Init
(
SHA512_CTX
*
);
void
SHA512_Update
(
SHA512_CTX
*
,
const
sha2_byte
*
,
size_t
);
void
SHA512_Final
(
sha2_byte
[
SHA512_DIGEST_LENGTH
],
SHA512_CTX
*
);
char
*
SHA512_End
(
SHA512_CTX
*
,
char
[
SHA512_DIGEST_STRING_LENGTH
]);
char
*
SHA512_Data
(
const
sha2_byte
*
,
size_t
,
char
[
SHA512_DIGEST_STRING_LENGTH
]);
#endif
/* __SHA2_H__ */
dlls/rsaenh/tests/rsaenh.c
View file @
311d839d
...
...
@@ -804,7 +804,6 @@ static void test_sha2(void)
/* SHA-256 hash */
result
=
CryptCreateHash
(
hProv
,
CALG_SHA_256
,
0
,
0
,
&
hHash
);
todo_wine
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
if
(
result
)
{
len
=
sizeof
(
DWORD
);
...
...
@@ -826,7 +825,6 @@ static void test_sha2(void)
/* SHA-384 hash */
result
=
CryptCreateHash
(
hProv
,
CALG_SHA_384
,
0
,
0
,
&
hHash
);
todo_wine
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
if
(
result
)
{
len
=
sizeof
(
DWORD
);
...
...
@@ -848,7 +846,6 @@ static void test_sha2(void)
/* SHA-512 hash */
result
=
CryptCreateHash
(
hProv
,
CALG_SHA_512
,
0
,
0
,
&
hHash
);
todo_wine
ok
(
result
,
"%08x
\n
"
,
GetLastError
());
if
(
result
)
{
len
=
sizeof
(
DWORD
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment