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
df83abb2
Commit
df83abb2
authored
Nov 29, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Add support for generating DH keys.
parent
81d71ee0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
1 deletion
+40
-1
bcrypt_internal.h
dlls/bcrypt/bcrypt_internal.h
+1
-0
bcrypt_main.c
dlls/bcrypt/bcrypt_main.c
+2
-1
gnutls.c
dlls/bcrypt/gnutls.c
+5
-0
bcrypt.c
dlls/bcrypt/tests/bcrypt.c
+17
-0
bcrypt.h
include/bcrypt.h
+15
-0
No files found.
dlls/bcrypt/bcrypt_internal.h
View file @
df83abb2
...
...
@@ -132,6 +132,7 @@ enum alg_id
ALG_ID_RSA
,
/* secret agreement */
ALG_ID_DH
,
ALG_ID_ECDH_P256
,
ALG_ID_ECDH_P384
,
...
...
dlls/bcrypt/bcrypt_main.c
View file @
df83abb2
...
...
@@ -114,6 +114,7 @@ builtin_algorithms[] =
{
BCRYPT_MD4_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
270
,
16
,
512
},
{
BCRYPT_MD2_ALGORITHM
,
BCRYPT_HASH_INTERFACE
,
270
,
16
,
128
},
{
BCRYPT_RSA_ALGORITHM
,
BCRYPT_ASYMMETRIC_ENCRYPTION_INTERFACE
,
0
,
0
,
0
},
{
BCRYPT_DH_ALGORITHM
,
BCRYPT_SECRET_AGREEMENT_INTERFACE
,
0
,
0
,
0
},
{
BCRYPT_ECDH_P256_ALGORITHM
,
BCRYPT_SECRET_AGREEMENT_INTERFACE
,
0
,
0
,
0
},
{
BCRYPT_ECDH_P384_ALGORITHM
,
BCRYPT_SECRET_AGREEMENT_INTERFACE
,
0
,
0
,
0
},
{
BCRYPT_RSA_SIGN_ALGORITHM
,
BCRYPT_SIGNATURE_INTERFACE
,
0
,
0
,
0
},
...
...
@@ -237,7 +238,7 @@ static const struct algorithm pseudo_algorithms[] =
{{
0
}},
/* RC2_CBC */
{{
0
}},
/* RC2_ECB */
{{
0
}},
/* RC2_CFB */
{{
0
}},
/* DH */
{{
MAGIC_ALG
},
ALG_ID_DH
},
{{
0
}},
/* ECDH */
{{
MAGIC_ALG
},
ALG_ID_ECDH_P256
},
{{
MAGIC_ALG
},
ALG_ID_ECDH_P384
},
...
...
dlls/bcrypt/gnutls.c
View file @
df83abb2
...
...
@@ -982,6 +982,11 @@ static NTSTATUS key_asymmetric_generate( void *args )
bitlen
=
key
->
u
.
a
.
bitlen
;
break
;
case
ALG_ID_DH
:
pk_alg
=
GNUTLS_PK_DH
;
bitlen
=
key
->
u
.
a
.
bitlen
;
break
;
case
ALG_ID_DSA
:
pk_alg
=
GNUTLS_PK_DSA
;
bitlen
=
key
->
u
.
a
.
bitlen
;
...
...
dlls/bcrypt/tests/bcrypt.c
View file @
df83abb2
...
...
@@ -3137,6 +3137,22 @@ derive_end:
BCryptCloseAlgorithmProvider
(
alg
,
0
);
}
static
void
test_DH
(
void
)
{
BCRYPT_KEY_HANDLE
key
;
NTSTATUS
status
;
key
=
NULL
;
status
=
BCryptGenerateKeyPair
(
BCRYPT_DH_ALG_HANDLE
,
&
key
,
512
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
ok
(
key
!=
NULL
,
"key not set
\n
"
);
status
=
BCryptFinalizeKeyPair
(
key
,
0
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"got %#lx
\n
"
,
status
);
BCryptDestroyKey
(
key
);
}
static
void
test_BCryptEnumContextFunctions
(
void
)
{
CRYPT_CONTEXT_FUNCTIONS
*
buffer
;
...
...
@@ -3724,6 +3740,7 @@ START_TEST(bcrypt)
test_RSA
();
test_RSA_SIGN
();
test_ECDH
();
test_DH
();
test_BCryptEnumContextFunctions
();
test_BCryptSignHash
();
test_BCryptEnumAlgorithms
();
...
...
include/bcrypt.h
View file @
df83abb2
...
...
@@ -71,6 +71,8 @@ typedef LONG NTSTATUS;
#define BCRYPT_DSA_PRIVATE_BLOB L"DSAPRIVATEBLOB"
#define BCRYPT_PUBLIC_KEY_BLOB L"PUBLICBLOB"
#define BCRYPT_PRIVATE_KEY_BLOB L"PRIVATEBLOB"
#define BCRYPT_DH_PUBLIC_BLOB L"DHPUBLICBLOB"
#define BCRYPT_DH_PRIVATE_BLOB L"DHPRIVATEBLOB"
#define LEGACY_DSA_PUBLIC_BLOB L"CAPIDSAPUBLICBLOB"
#define LEGACY_DSA_PRIVATE_BLOB L"CAPIDSAPRIVATEBLOB"
#define LEGACY_DSA_V2_PUBLIC_BLOB L"V2CAPIDSAPUBLICBLOB"
...
...
@@ -84,6 +86,7 @@ typedef LONG NTSTATUS;
#define BCRYPT_3DES_ALGORITHM L"3DES"
#define BCRYPT_AES_ALGORITHM L"AES"
#define BCRYPT_DES_ALGORITHM L"DES"
#define BCRYPT_DH_ALGORITHM L"DH"
#define BCRYPT_DSA_ALGORITHM L"DSA"
#define BCRYPT_ECDH_P256_ALGORITHM L"ECDH_P256"
#define BCRYPT_ECDH_P384_ALGORITHM L"ECDH_P384"
...
...
@@ -146,6 +149,8 @@ static const WCHAR BCRYPT_DSA_PUBLIC_BLOB[] = {'D','S','A','P','U','B','L','I','
static
const
WCHAR
BCRYPT_DSA_PRIVATE_BLOB
[]
=
{
'D'
,
'S'
,
'A'
,
'P'
,
'R'
,
'I'
,
'V'
,
'A'
,
'T'
,
'E'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
BCRYPT_PUBLIC_KEY_BLOB
[]
=
{
'P'
,
'U'
,
'B'
,
'L'
,
'I'
,
'C'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
BCRYPT_PRIVATE_KEY_BLOB
[]
=
{
'P'
,
'R'
,
'I'
,
'V'
,
'A'
,
'T'
,
'E'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
BCRYPT_DH_PUBLIC_BLOB
[]
=
{
'D'
,
'H'
,
'P'
,
'U'
,
'B'
,
'L'
,
'I'
,
'C'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
BCRYPT_DH_PRIVATE_BLOB
[]
=
{
'D'
,
'H'
,
'P'
,
'R'
,
'I'
,
'V'
,
'A'
,
'T'
,
'E'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
LEGACY_DSA_PUBLIC_BLOB
[]
=
{
'C'
,
'A'
,
'P'
,
'I'
,
'D'
,
'S'
,
'A'
,
'P'
,
'U'
,
'B'
,
'L'
,
'I'
,
'C'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
LEGACY_DSA_PRIVATE_BLOB
[]
=
{
'C'
,
'A'
,
'P'
,
'I'
,
'D'
,
'S'
,
'A'
,
'P'
,
'R'
,
'I'
,
'V'
,
'A'
,
'T'
,
'E'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
static
const
WCHAR
LEGACY_DSA_V2_PUBLIC_BLOB
[]
=
{
'V'
,
'2'
,
'C'
,
'A'
,
'P'
,
'I'
,
'D'
,
'S'
,
'A'
,
'P'
,
'U'
,
'B'
,
'L'
,
'I'
,
'C'
,
'B'
,
'L'
,
'O'
,
'B'
,
0
};
...
...
@@ -161,6 +166,7 @@ static const WCHAR MS_PLATFORM_CRYPTO_PROVIDER[] = \
static
const
WCHAR
BCRYPT_3DES_ALGORITHM
[]
=
{
'3'
,
'D'
,
'E'
,
'S'
,
0
};
static
const
WCHAR
BCRYPT_AES_ALGORITHM
[]
=
{
'A'
,
'E'
,
'S'
,
0
};
static
const
WCHAR
BCRYPT_DES_ALGORITHM
[]
=
{
'D'
,
'E'
,
'S'
,
0
};
static
const
WCHAR
BCRYPT_DH_ALGORITHM
[]
=
{
'D'
,
'H'
,
0
};
static
const
WCHAR
BCRYPT_DSA_ALGORITHM
[]
=
{
'D'
,
'S'
,
'A'
,
0
};
static
const
WCHAR
BCRYPT_ECDH_P256_ALGORITHM
[]
=
{
'E'
,
'C'
,
'D'
,
'H'
,
'_'
,
'P'
,
'2'
,
'5'
,
'6'
,
0
};
static
const
WCHAR
BCRYPT_ECDH_P384_ALGORITHM
[]
=
{
'E'
,
'C'
,
'D'
,
'H'
,
'_'
,
'P'
,
'3'
,
'8'
,
'4'
,
0
};
...
...
@@ -348,6 +354,15 @@ typedef struct _BCRYPT_DSA_KEY_BLOB_V2
UCHAR
Count
[
4
];
}
BCRYPT_DSA_KEY_BLOB_V2
,
*
PBCRYPT_DSA_KEY_BLOB_V2
;
#define BCRYPT_DH_PUBLIC_MAGIC 0x42504844
#define BCRYPT_DH_PRIVATE_MAGIC 0x56504844
typedef
struct
_BCRYPT_DH_KEY_BLOB
{
ULONG
dwMagic
;
ULONG
cbKey
;
}
BCRYPT_DH_KEY_BLOB
,
*
PBCRYPT_DH_KEY_BLOB
;
#define BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION 1
#define BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG 0x00000001
...
...
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