Hello everybody,
I'm looking to implement dssenh for wine. I think more than 65% of
code from rsaenh can be reused. So I am trying to figure out how to do
it.
My idea goes as follows: move the functions from rsaenh.c that can be
reused into rsaenh/cryptoprovutils.c, and keep the functions specific
to rsaenh.dll in rsaenh.c. When implementing dssenh.dll, link dssenh.c
together with rsaenh/cryptoprovutils.c. create
rsaenh/cryptoprovconfig.h and dssenh/cryptoprovconfig.h, put the
rsa/dss specific constant/struct definitions in them, and
cryptoprovconfig.h is included in cryptoprovutils.c. In this way, we
can reuse the functions from rsaenh.c. Patch 2/2 illustrated how I
implemented DSSENH_CPAcquireContext and DSSENH_CPReleaseContext.
These patches passes rsaenh/tests and test_acquire_context in
dssenh/tests. Other functions are to be implemented.
Looking forward to any suggestions.
---
dlls/dssenh/Makefile.in | 6 +-
dlls/dssenh/dssenh.c | 706 ++++++++++++++++++++++++++++++++++++++++
dlls/dssenh/dssenh.rgs | 32 ++
dlls/dssenh/dssenh.spec | 50 +--
dlls/dssenh/main.c | 59 ----
dlls/dssenh/rsrc.rc | 31 ++
6 files changed, 799 insertions(+), 85 deletions(-)
create mode 100644 dlls/dssenh/dssenh.c
create mode 100644 dlls/dssenh/dssenh.rgs
delete mode 100644 dlls/dssenh/main.c
create mode 100644 dlls/dssenh/rsrc.rc
diff --git a/dlls/dssenh/Makefile.in b/dlls/dssenh/Makefile.in
index 4f05beee51..54295f99ba 100644
--- a/dlls/dssenh/Makefile.in
+++ b/dlls/dssenh/Makefile.in
@@ -1,6 +1,10 @@
MODULE = dssenh.dll
+IMPORTLIB = dssenh
+IMPORTS = bcrypt crypt32 advapi32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
- main.c
+ dssenh.c
+
+RC_SRCS = rsrc.rc
diff --git a/dlls/dssenh/dssenh.c b/dlls/dssenh/dssenh.c
new file mode 100644
index 0000000000..5dc5464724
--- /dev/null
+++ b/dlls/dssenh/dssenh.c
@@ -0,0 +1,706 @@
+/*
+ * Copyright 2008 Maarten Lankhorst
+ *
+ * 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
+ */
+
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wincrypt.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dssenh);
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
+
+ switch (fdwReason)
+ {
+ case DLL_WINE_PREATTACH:
+ return FALSE; /* prefer native version */
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ break;
+ }
+ return TRUE;
+}
+
+/*****************************************************
+ * DllRegisterServer (DSSENH.@)
+ */
+HRESULT WINAPI DllRegisterServer(void)
+{
+ FIXME("Not implemented.\n");
+ return E_UNEXPECTED;
+}
+
+/*****************************************************
+ * DllUnregisterServer (DSSENH.@)
+ */
+HRESULT WINAPI DllUnregisterServer(void)
+{
+ FIXME("Not implemented.\n");
+ return E_UNEXPECTED;
+}
+
+/******************************************************************************
+ * CPAcquireContext (DSSENH.@)
+ *
+ * Acquire a handle to the key container specified by pszContainer
+ *
+ * PARAMS
+ * phProv [O] Pointer to the location the acquired handle will
be written to.
+ * pszContainer [I] Name of the desired key container. See Notes
+ * dwFlags [I] Flags. See Notes.
+ * pVTable [I] Pointer to a VTableProvStruc containing callbacks.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * If pszContainer is NULL or points to a zero length string the user's login
+ * name will be used as the key container name.
+ *
+ * If the CRYPT_NEW_KEYSET flag is set in dwFlags a new keyset will
be created.
+ * If a keyset with the given name already exists, the function fails and sets
+ * last error to NTE_EXISTS. If CRYPT_NEW_KEYSET is not set and the specified
+ * key container does not exist, function fails and sets last error to
+ * NTE_BAD_KEYSET.
+ */
+BOOL WINAPI DSSENH_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer,
+ DWORD dwFlags, PVTableProvStruc pVTable)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPCreateHash (DSSENH.@)
+ *
+ * CPCreateHash creates and initializes a new hash object.
+ *
+ * PARAMS
+ * hProv [I] Handle to the key container to which the new hash will belong.
+ * Algid [I] Identifies the hash algorithm, which will be used for the hash.
+ * hKey [I] Handle to a session key applied for keyed hashes.
+ * dwFlags [I] Currently no flags defined. Must be zero.
+ * phHash [O] Points to the location where a handle to the new hash
will be stored.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * hKey is a handle to a session key applied in keyed hashes like
MAC and HMAC.
+ * If a normal hash object is to be created (like e.g. MD2 or SHA1)
hKey must be zero.
+ */
+BOOL WINAPI DSSENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid,
HCRYPTKEY hKey, DWORD dwFlags,
+ HCRYPTHASH *phHash)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPDecrypt (DSSENH.@)
+ *
+ * Decrypt data.
+ *
+ * PARAMS
+ * hProv [I] The key container hKey and hHash belong to.
+ * hKey [I] The key used to decrypt the data.
+ * hHash [I] An optional hash object for parallel hashing. See notes.
+ * Final [I] Indicates if this is the last block of data to decrypt.
+ * dwFlags [I] Must be zero or CRYPT_OAEP
+ * pbData [I/O] Pointer to the data to decrypt. Plaintext will
also be stored there.
+ * pdwDataLen [I/O] I: Length of ciphertext, O: Length of plaintext.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES
+ * If a hash object handle is provided in hHash, it will be updated
with the plaintext.
+ * This is useful for message signatures.
+ *
+ * This function uses the standard WINAPI protocol for querying data
of dynamic length.
+ */
+BOOL WINAPI DSSENH_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey,
HCRYPTHASH hHash, BOOL Final,
+ DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPDeriveKey (DSSENH.@)
+ *
+ * Derives a key from a hash value.
+ *
+ * PARAMS
+ * hProv [I] Key container for which a key is to be generated.
+ * Algid [I] Crypto algorithm identifier for the key to be generated.
+ * hBaseData [I] Hash from whose value the key will be derived.
+ * dwFlags [I] See Notes.
+ * phKey [O] The generated key.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * Defined flags:
+ * - CRYPT_EXPORTABLE: Key can be exported.
+ * - CRYPT_NO_SALT: No salt is used for 40 bit keys.
+ * - CRYPT_CREATE_SALT: Use remaining bits as salt value.
+ */
+BOOL WINAPI DSSENH_CPDeriveKey(HCRYPTPROV hProv, ALG_ID Algid,
HCRYPTHASH hBaseData,
+ DWORD dwFlags, HCRYPTKEY *phKey)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPDestroyHash (DSSENH.@)
+ *
+ * Releases the handle to a hash object. The object is destroyed if
its reference
+ * count reaches zero.
+ *
+ * PARAMS
+ * hProv [I] Handle to the key container to which the hash object belongs.
+ * hHash [I] Handle to the hash object to be released.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI DSSENH_CPDestroyHash(HCRYPTPROV hProv, HCRYPTHASH hHash)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPDestroyKey (DSSENH.@)
+ *
+ * Releases the handle to a key object. The object is destroyed if
its reference
+ * count reaches zero.
+ *
+ * PARAMS
+ * hProv [I] Handle to the key container to which the key object belongs.
+ * hKey [I] Handle to the key object to be released.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI DSSENH_CPDestroyKey(HCRYPTPROV hProv, HCRYPTKEY hKey)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPDuplicateHash (DSSENH.@)
+ *
+ * Clones a hash object including its current state.
+ *
+ * PARAMS
+ * hUID [I] Handle to the key container the hash belongs to.
+ * hHash [I] Handle to the hash object to be cloned.
+ * pdwReserved [I] Reserved. Must be NULL.
+ * dwFlags [I] No flags are currently defined. Must be 0.
+ * phHash [O] Handle to the cloned hash object.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ */
+BOOL WINAPI DSSENH_CPDuplicateHash(HCRYPTPROV hUID, HCRYPTHASH hHash,
DWORD *pdwReserved,
+ DWORD dwFlags, HCRYPTHASH *phHash)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPDuplicateKey (DSSENH.@)
+ *
+ * Clones a key object including its current state.
+ *
+ * PARAMS
+ * hUID [I] Handle to the key container the hash belongs to.
+ * hKey [I] Handle to the key object to be cloned.
+ * pdwReserved [I] Reserved. Must be NULL.
+ * dwFlags [I] No flags are currently defined. Must be 0.
+ * phHash [O] Handle to the cloned key object.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ */
+BOOL WINAPI DSSENH_CPDuplicateKey(HCRYPTPROV hUID, HCRYPTKEY hKey,
DWORD *pdwReserved,
+ DWORD dwFlags, HCRYPTKEY *phKey)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPEncrypt (DSSENH.@)
+ *
+ * Encrypt data.
+ *
+ * PARAMS
+ * hProv [I] The key container hKey and hHash belong to.
+ * hKey [I] The key used to encrypt the data.
+ * hHash [I] An optional hash object for parallel hashing. See notes.
+ * Final [I] Indicates if this is the last block of data to encrypt.
+ * dwFlags [I] Must be zero or CRYPT_OAEP
+ * pbData [I/O] Pointer to the data to encrypt. Encrypted data
will also be stored there.
+ * pdwDataLen [I/O] I: Length of data to encrypt, O: Length of encrypted data.
+ * dwBufLen [I] Size of the buffer at pbData.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES
+ * If a hash object handle is provided in hHash, it will be updated
with the plaintext.
+ * This is useful for message signatures.
+ *
+ * This function uses the standard WINAPI protocol for querying data
of dynamic length.
+ */
+BOOL WINAPI DSSENH_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey,
HCRYPTHASH hHash, BOOL Final,
+ DWORD dwFlags, BYTE *pbData, DWORD
*pdwDataLen, DWORD dwBufLen)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPExportKey (DSSENH.@)
+ *
+ * Export a key into a binary large object (BLOB).
+ *
+ * PARAMS
+ * hProv [I] Key container from which a key is to be exported.
+ * hKey [I] Key to be exported.
+ * hPubKey [I] Key used to encrypt sensitive BLOB data.
+ * dwBlobType [I] SIMPLEBLOB, PUBLICKEYBLOB or PRIVATEKEYBLOB.
+ * dwFlags [I] Currently none defined.
+ * pbData [O] Pointer to a buffer where the BLOB will be written to.
+ * pdwDataLen [I/O] I: Size of buffer at pbData, O: Size of BLOB
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ */
+BOOL WINAPI DSSENH_CPExportKey(HCRYPTPROV hProv, HCRYPTKEY hKey,
HCRYPTKEY hPubKey,
+ DWORD dwBlobType, DWORD dwFlags, BYTE
*pbData, DWORD *pdwDataLen)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPGenKey (DSSENH.@)
+ *
+ * Generate a key in the key container
+ *
+ * PARAMS
+ * hProv [I] Key container for which a key is to be generated.
+ * Algid [I] Crypto algorithm identifier for the key to be generated.
+ * dwFlags [I] Upper 16 bits: Binary length of key. Lower 16 bits:
Flags. See Notes
+ * phKey [O] Handle to the generated key.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES
+ * Private key-exchange- and signature-keys can be generated with
Algid AT_KEYEXCHANGE
+ * and AT_SIGNATURE values.
+ */
+BOOL WINAPI DSSENH_CPGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD
dwFlags, HCRYPTKEY *phKey)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPGenRandom (DSSENH.@)
+ *
+ * Generate a random byte stream.
+ *
+ * PARAMS
+ * hProv [I] Key container that is used to generate random bytes.
+ * dwLen [I] Specifies the number of requested random data bytes.
+ * pbBuffer [O] Random bytes will be stored here.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI DSSENH_CPGenRandom(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPGetHashParam (DSSENH.@)
+ *
+ * Query parameters of an hash object.
+ *
+ * PARAMS
+ * hProv [I] The key container, which the hash belongs to.
+ * hHash [I] The hash object that is to be queried.
+ * dwParam [I] Specifies the parameter that is to be queried.
+ * pbData [I] Pointer to the buffer where the parameter value
will be stored.
+ * pdwDataLen [I/O] I: Buffer length at pbData, O: Length of the
parameter value.
+ * dwFlags [I] None currently defined.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * Valid dwParams are: HP_ALGID, HP_HASHSIZE, HP_HASHVALUE. The hash will be
+ * finalized if HP_HASHVALUE is queried.
+ */
+BOOL WINAPI DSSENH_CPGetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash,
DWORD dwParam, BYTE *pbData,
+ DWORD *pdwDataLen, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPGetKeyParam (DSSENH.@)
+ *
+ * Query a key parameter.
+ *
+ * PARAMS
+ * hProv [I] The key container, which the key belongs to.
+ * hHash [I] The key object that is to be queried.
+ * dwParam [I] Specifies the parameter that is to be queried.
+ * pbData [I] Pointer to the buffer where the parameter value
will be stored.
+ * pdwDataLen [I/O] I: Buffer length at pbData, O: Length of the
parameter value.
+ * dwFlags [I] None currently defined.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ *
+ * NOTES
+ * Defined dwParam types are:
+ * - KP_MODE: Values MODE_CBC, MODE_ECB, MODE_CFB.
+ * - KP_MODE_BITS: Shift width for cipher feedback mode.
+ * (Currently ignored by MS CSP's - always eight)
+ * - KP_PERMISSIONS: Or'ed combination of CRYPT_ENCRYPT, CRYPT_DECRYPT,
+ * CRYPT_EXPORT, CRYPT_READ, CRYPT_WRITE, CRYPT_MAC
+ * - KP_IV: Initialization vector.
+ * - KP_KEYLEN: Bitwidth of the key.
+ * - KP_BLOCKLEN: Size of a block cipher block.
+ * - KP_SALT: Salt value.
+ */
+BOOL WINAPI DSSENH_CPGetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey,
DWORD dwParam, BYTE *pbData,
+ DWORD *pdwDataLen, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPGetProvParam (DSSENH.@)
+ *
+ * Query a CSP parameter.
+ *
+ * PARAMS
+ * hProv [I] The key container that is to be queried.
+ * dwParam [I] Specifies the parameter that is to be queried.
+ * pbData [I] Pointer to the buffer where the parameter value
will be stored.
+ * pdwDataLen [I/O] I: Buffer length at pbData, O: Length of the
parameter value.
+ * dwFlags [I] CRYPT_FIRST: Start enumeration (for PP_ENUMALGS{_EX}).
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ * NOTES:
+ * Defined dwParam types:
+ * - PP_CONTAINER: Name of the key container.
+ * - PP_NAME: Name of the cryptographic service provider.
+ * - PP_SIG_KEYSIZE_INC: RSA signature keywidth granularity in bits.
+ * - PP_KEYX_KEYSIZE_INC: RSA key-exchange keywidth granularity in bits.
+ * - PP_ENUMALGS{_EX}: Query provider capabilities.
+ * - PP_KEYSET_SEC_DESCR: Retrieve security descriptor on container.
+ */
+BOOL WINAPI DSSENH_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam,
BYTE *pbData,
+ DWORD *pdwDataLen, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPGetUserKey (DSSENH.@)
+ *
+ * Returns a handle to the user's private key-exchange- or signature-key.
+ *
+ * PARAMS
+ * hProv [I] The key container from which a user key is requested.
+ * dwKeySpec [I] AT_KEYEXCHANGE or AT_SIGNATURE
+ * phUserKey [O] Handle to the requested key or INVALID_HANDLE_VALUE
in case of failure.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTE
+ * A newly created key container does not contain private user key.
Create them with CPGenKey.
+ */
+BOOL WINAPI DSSENH_CPGetUserKey(HCRYPTPROV hProv, DWORD dwKeySpec,
HCRYPTKEY *phUserKey)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPHashData (DSSENH.@)
+ *
+ * Updates a hash object with the given data.
+ *
+ * PARAMS
+ * hProv [I] Key container to which the hash object belongs.
+ * hHash [I] Hash object which is to be updated.
+ * pbData [I] Pointer to data with which the hash object is to be updated.
+ * dwDataLen [I] Length of the data.
+ * dwFlags [I] Currently none defined.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES
+ * The actual hash value is queried with CPGetHashParam, which will finalize
+ * the hash. Updating a finalized hash will fail with a last error
NTE_BAD_HASH_STATE.
+ */
+BOOL WINAPI DSSENH_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash,
const BYTE *pbData,
+ DWORD dwDataLen, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPHashSessionKey (DSSENH.@)
+ *
+ * Updates a hash object with the binary representation of a symmetric key.
+ *
+ * PARAMS
+ * hProv [I] Key container to which the hash object belongs.
+ * hHash [I] Hash object which is to be updated.
+ * hKey [I] The symmetric key, whose binary value will be added
to the hash.
+ * dwFlags [I] CRYPT_LITTLE_ENDIAN, if the binary key value shall
be interpreted as little endian.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ */
+BOOL WINAPI DSSENH_CPHashSessionKey(HCRYPTPROV hProv, HCRYPTHASH
hHash, HCRYPTKEY hKey,
+ DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPImportKey (DSSENH.@)
+ *
+ * Import a BLOB'ed key into a key container.
+ *
+ * PARAMS
+ * hProv [I] Key container into which the key is to be imported.
+ * pbData [I] Pointer to a buffer which holds the BLOB.
+ * dwDataLen [I] Length of data in buffer at pbData.
+ * hPubKey [I] Key used to decrypt sensitive BLOB data.
+ * dwFlags [I] One of:
+ * CRYPT_EXPORTABLE: the imported key is marked exportable
+ * phKey [O] Handle to the imported key.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ */
+BOOL WINAPI DSSENH_CPImportKey(HCRYPTPROV hProv, const BYTE *pbData,
DWORD dwDataLen,
+ HCRYPTKEY hPubKey, DWORD dwFlags,
HCRYPTKEY *phKey)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPReleaseContext (DSSENH.@)
+ *
+ * Release a key container.
+ *
+ * PARAMS
+ * hProv [I] Key container to be released.
+ * dwFlags [I] Currently none defined.
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI DSSENH_CPReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPSetHashParam (DSSENH.@)
+ *
+ * Set a parameter of a hash object.
+ *
+ * PARAMS
+ * hProv [I] The key container to which the key belongs.
+ * hHash [I] The hash object for which a parameter is to be set.
+ * dwParam [I] Parameter type. See Notes.
+ * pbData [I] Pointer to the parameter value.
+ * dwFlags [I] Currently none defined.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES
+ * Currently only the HP_HMAC_INFO dwParam type is defined.
+ * The HMAC_INFO struct will be deep copied into the hash object.
+ * See Internet RFC 2104 for details on the HMAC algorithm.
+ */
+BOOL WINAPI DSSENH_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash,
DWORD dwParam,
+ BYTE *pbData, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPSetKeyParam (DSSENH.@)
+ *
+ * Set a parameter of a key object.
+ *
+ * PARAMS
+ * hProv [I] The key container to which the key belongs.
+ * hKey [I] The key for which a parameter is to be set.
+ * dwParam [I] Parameter type. See Notes.
+ * pbData [I] Pointer to the parameter value.
+ * dwFlags [I] Currently none defined.
+ *
+ * RETURNS
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES:
+ */
+BOOL WINAPI DSSENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey,
DWORD dwParam, BYTE *pbData,
+ DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPSetProvParam (DSSENH.@)
+ *
+ * Set a parameter of a provider.
+ *
+ * PARAMS
+ * hProv [I] The key container for which to set parameters.
+ * dwParam [I] Parameter type. See Notes.
+ * pbData [I] Pointer to the parameter value
+ * dwFlags [I] Currently none defined.
+ *
+ * RETURNS:
+ * Success: TRUE.
+ * Failure: FALSE.
+ *
+ * NOTES:
+ */
+BOOL WINAPI DSSENH_CPSetProvParam(HCRYPTPROV hProv, DWORD dwParam,
BYTE *pbData, DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPSignHash (DSSENH.@)
+ *
+ * Sign a hash object
+ *
+ * PARAMS
+ * hProv [I] The key container, to which the hash object belongs.
+ * hHash [I] The hash object to be signed.
+ * dwKeySpec [I] AT_SIGNATURE or AT_KEYEXCHANGE: Key used to
generate the signature.
+ * sDescription [I] Should be NULL for security reasons.
+ * dwFlags [I] 0, CRYPT_NOHASHOID or CRYPT_X931_FORMAT:
Format of the signature.
+ * pbSignature [O] Buffer, to which the signature will be stored.
May be NULL to query SigLen.
+ * pdwSigLen [I/O] Size of the buffer (in), Length of the signature (out)
+ *
+ * RETURNS
+ * Success: TRUE
+ * Failure: FALSE
+ */
+BOOL WINAPI DSSENH_CPSignHash(HCRYPTPROV hProv, HCRYPTHASH hHash,
DWORD dwKeySpec,
+ LPCWSTR sDescription, DWORD dwFlags,
BYTE *pbSignature,
+ DWORD *pdwSigLen)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
+
+/******************************************************************************
+ * CPVerifySignature (DSSENH.@)
+ *
+ * Verify the signature of a hash object.
+ *
+ * PARAMS
+ * hProv [I] The key container, to which the hash belongs.
+ * hHash [I] The hash for which the signature is verified.
+ * pbSignature [I] The binary signature.
+ * dwSigLen [I] Length of the signature BLOB.
+ * hPubKey [I] Public key used to verify the signature.
+ * sDescription [I] Should be NULL for security reasons.
+ * dwFlags [I] 0, CRYPT_NOHASHOID or CRYPT_X931_FORMAT: Format
of the signature.
+ *
+ * RETURNS
+ * Success: TRUE (Signature is valid)
+ * Failure: FALSE (GetLastError() == NTE_BAD_SIGNATURE, if signature
is invalid)
+ */
+BOOL WINAPI DSSENH_CPVerifySignature(HCRYPTPROV hProv, HCRYPTHASH
hHash, const BYTE *pbSignature,
+ DWORD dwSigLen, HCRYPTKEY
hPubKey, LPCWSTR sDescription,
+ DWORD dwFlags)
+{
+ FIXME("stub\n");
+ return FALSE;
+}
diff --git a/dlls/dssenh/dssenh.rgs b/dlls/dssenh/dssenh.rgs
new file mode 100644
index 0000000000..19899cb516
--- /dev/null
+++ b/dlls/dssenh/dssenh.rgs
@@ -0,0 +1,32 @@
+HKLM
+{
+ NoRemove Software
+ {
+ NoRemove Microsoft
+ {
+ NoRemove Cryptography
+ {
+ NoRemove Defaults
+ {
+ NoRemove Provider
+ {
+ ForceRemove 'Microsoft Enhanced DSS and
Diffie-Hellman Cryptographic Provider'
+ {
+ val 'Image Path' = s '%MODULE%'
+ val 'Signature' = b deadbeef
+ val 'Type' = d 13
+ }
+ }
+ NoRemove 'Provider Types'
+ {
+ ForceRemove 'Type 013'
+ {
+ val 'Name' = s 'Microsoft Enhanced DSS
and Diffie-Hellman Cryptographic Provider'
+ val 'TypeName' = s 'DSS Signature with
Diffe-zhellman Key Exchange'
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/dlls/dssenh/dssenh.spec b/dlls/dssenh/dssenh.spec
index c5c2545281..330b8914b3 100644
--- a/dlls/dssenh/dssenh.spec
+++ b/dlls/dssenh/dssenh.spec
@@ -1,27 +1,27 @@
-@ stub CPAcquireContext
-@ stub CPCreateHash
-@ stub CPDecrypt
-@ stub CPDeriveKey
-@ stub CPDestroyHash
-@ stub CPDestroyKey
-@ stub CPDuplicateHash
-@ stub CPDuplicateKey
-@ stub CPEncrypt
-@ stub CPExportKey
-@ stub CPGenKey
-@ stub CPGenRandom
-@ stub CPGetHashParam
-@ stub CPGetKeyParam
-@ stub CPGetProvParam
-@ stub CPGetUserKey
-@ stub CPHashData
-@ stub CPHashSessionKey
-@ stub CPImportKey
-@ stub CPReleaseContext
-@ stub CPSetHashParam
-@ stub CPSetKeyParam
-@ stub CPSetProvParam
-@ stub CPSignHash
-@ stub CPVerifySignature
+@ stdcall CPAcquireContext(ptr str long ptr) DSSENH_CPAcquireContext
+@ stdcall CPCreateHash(long long ptr long ptr) DSSENH_CPCreateHash
+@ stdcall CPDecrypt(long long long long long ptr ptr) DSSENH_CPDecrypt
+@ stdcall CPDeriveKey(long long long long ptr) DSSENH_CPDeriveKey
+@ stdcall CPDestroyHash(long long) DSSENH_CPDestroyHash
+@ stdcall CPDestroyKey(long long) DSSENH_CPDestroyKey
+@ stdcall CPDuplicateHash(long long ptr long ptr) DSSENH_CPDuplicateHash
+@ stdcall CPDuplicateKey(long long ptr long ptr) DSSENH_CPDuplicateKey
+@ stdcall CPEncrypt(long long long long long ptr ptr long) DSSENH_CPEncrypt
+@ stdcall CPExportKey(long long long long long ptr ptr) DSSENH_CPExportKey
+@ stdcall CPGenKey(long long long ptr) DSSENH_CPGenKey
+@ stdcall CPGenRandom(long long ptr) DSSENH_CPGenRandom
+@ stdcall CPGetHashParam(long long long ptr ptr long) DSSENH_CPGetHashParam
+@ stdcall CPGetKeyParam(long long long ptr ptr long) DSSENH_CPGetKeyParam
+@ stdcall CPGetProvParam(long long ptr ptr long) DSSENH_CPGetProvParam
+@ stdcall CPGetUserKey(long long ptr) DSSENH_CPGetUserKey
+@ stdcall CPHashData(long long ptr long long) DSSENH_CPHashData
+@ stdcall CPHashSessionKey(long long long long) DSSENH_CPHashSessionKey
+@ stdcall CPImportKey(long ptr long long long ptr) DSSENH_CPImportKey
+@ stdcall CPReleaseContext(long long) DSSENH_CPReleaseContext
+@ stdcall CPSetHashParam(long long long ptr long) DSSENH_CPSetHashParam
+@ stdcall CPSetKeyParam(long long long ptr long) DSSENH_CPSetKeyParam
+@ stdcall CPSetProvParam(long long ptr long) DSSENH_CPSetProvParam
+@ stdcall CPSignHash(long long long wstr long ptr ptr) DSSENH_CPSignHash
+@ stdcall CPVerifySignature(long long ptr long long wstr long)
DSSENH_CPVerifySignature
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()
diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c
deleted file mode 100644
index b60b3447a3..0000000000
--- a/dlls/dssenh/main.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2008 Maarten Lankhorst
- *
- * 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
- */
-
-
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(dssenh);
-
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
-
- switch (fdwReason)
- {
- case DLL_WINE_PREATTACH:
- return FALSE; /* prefer native version */
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hinstDLL);
- break;
- }
- return TRUE;
-}
-
-/*****************************************************
- * DllRegisterServer (DSSENH.@)
- */
-HRESULT WINAPI DllRegisterServer(void)
-{
- FIXME("Not implemented.\n");
- return E_UNEXPECTED;
-}
-
-/*****************************************************
- * DllUnregisterServer (DSSENH.@)
- */
-HRESULT WINAPI DllUnregisterServer(void)
-{
- FIXME("Not implemented.\n");
- return E_UNEXPECTED;
-}
diff --git a/dlls/dssenh/rsrc.rc b/dlls/dssenh/rsrc.rc
new file mode 100644
index 0000000000..3ec4fc17f1
--- /dev/null
+++ b/dlls/dssenh/rsrc.rc
@@ -0,0 +1,31 @@
+/*
+ * Resources for dssenh
+ *
+ * Copyright (c) 2007 Alexandre Julliard
+ *
+ * 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
+ */
+
+/* @makedep: dssenh.rgs */
+1 WINE_REGISTRY dssenh.rgs
+
+#define WINE_FILEDESCRIPTION_STR "Wine dssenh"
+#define WINE_FILENAME_STR "dssenh.dll"
+#define WINE_FILEVERSION 5,1,2600,2180
+#define WINE_FILEVERSION_STR "5.1.2600.2180"
+#define WINE_PRODUCTVERSION 5,1,2600,2180
+#define WINE_PRODUCTVERSION_STR "5.1.2600.2180"
+
+#include "wine/wine_common_ver.rc"
--
2.21.0