Implement enough of rsabase.dll to get Steam to login.

This commit is contained in:
Mike McCormack 2004-02-13 20:47:07 +00:00 committed by Alexandre Julliard
parent b6adacb81c
commit b6de304722
8 changed files with 378 additions and 1 deletions

3
configure vendored

File diff suppressed because one or more lines are too long

View File

@ -1564,6 +1564,7 @@ dlls/rasapi32/Makefile
dlls/richedit/Makefile
dlls/rpcrt4/Makefile
dlls/rpcrt4/tests/Makefile
dlls/rsabase/Makefile
dlls/serialui/Makefile
dlls/setupapi/Makefile
dlls/shdocvw/Makefile

View File

@ -93,6 +93,7 @@ BASEDIRS = \
rasapi32 \
richedit \
rpcrt4 \
rsabase \
serialui \
setupapi \
shdocvw \
@ -299,6 +300,7 @@ SYMLINKS = \
rasapi32.dll$(DLLEXT) \
riched32.dll$(DLLEXT) \
rpcrt4.dll$(DLLEXT) \
rsabase.dll$(DLLEXT) \
serialui.dll$(DLLEXT) \
setupapi.dll$(DLLEXT) \
shdocvw.dll$(DLLEXT) \
@ -662,6 +664,9 @@ riched32.dll$(DLLEXT): richedit/riched32.dll$(DLLEXT)
rpcrt4.dll$(DLLEXT): rpcrt4/rpcrt4.dll$(DLLEXT)
$(RM) $@ && $(LN_S) rpcrt4/rpcrt4.dll$(DLLEXT) $@
rsabase.dll$(DLLEXT): rsabase/rsabase.dll$(DLLEXT)
$(RM) $@ && $(LN_S) rsabase/rsabase.dll$(DLLEXT) $@
serialui.dll$(DLLEXT): serialui/serialui.dll$(DLLEXT)
$(RM) $@ && $(LN_S) serialui/serialui.dll$(DLLEXT) $@
@ -905,6 +910,7 @@ IMPORT_LIBS = \
librasapi32 \
libriched32 \
librpcrt4 \
librsabase \
libserialui \
libsetupapi \
libshdocvw \
@ -1338,6 +1344,11 @@ librpcrt4.def: rpcrt4/rpcrt4.spec.def
librpcrt4.a: rpcrt4/rpcrt4.spec.def
$(DLLTOOL) -k -l $@ -d rpcrt4/rpcrt4.spec.def
librsabase.def: rsabase/rsabase.spec.def
$(RM) $@ && $(LN_S) rsabase/rsabase.spec.def $@
librsabase.a: rsabase/rsabase.spec.def
$(DLLTOOL) -k -l $@ -d rsabase/rsabase.spec.def
libserialui.def: serialui/serialui.spec.def
$(RM) $@ && $(LN_S) serialui/serialui.spec.def $@
libserialui.a: serialui/serialui.spec.def
@ -1577,6 +1588,7 @@ quartz/quartz.spec.def: $(WINEBUILD)
rasapi32/rasapi32.spec.def: $(WINEBUILD)
richedit/riched32.spec.def: $(WINEBUILD)
rpcrt4/rpcrt4.spec.def: $(WINEBUILD)
rsabase/rsabase.spec.def: $(WINEBUILD)
serialui/serialui.spec.def: $(WINEBUILD)
setupapi/setupapi.spec.def: $(WINEBUILD)
shdocvw/shdocvw.spec.def: $(WINEBUILD)
@ -1706,6 +1718,7 @@ quartz/quartz.dll$(DLLEXT): quartz
rasapi32/rasapi32.dll$(DLLEXT): rasapi32
richedit/riched32.dll$(DLLEXT): richedit
rpcrt4/rpcrt4.dll$(DLLEXT): rpcrt4
rsabase/rsabase.dll$(DLLEXT): rsabase
serialui/serialui.dll$(DLLEXT): serialui
setupapi/setupapi.dll$(DLLEXT): setupapi
shdocvw/shdocvw.dll$(DLLEXT): shdocvw

4
dlls/rsabase/.cvsignore Normal file
View File

@ -0,0 +1,4 @@
Makefile
rsabase.dll.dbg.c
rsabase.spec.c
rsabase.spec.def

14
dlls/rsabase/Makefile.in Normal file
View File

@ -0,0 +1,14 @@
EXTRADEFS = -DCOM_NO_WINDOWS_H
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = rsabase.dll
IMPORTS = kernel32
C_SRCS = \
main.c
@MAKE_DLL_RULES@
### Dependencies:

310
dlls/rsabase/main.c Normal file
View File

@ -0,0 +1,310 @@
/*
* RSABASE - RSA encryption for Wine
*
* Copyright 2004 Mike McCormack for Codeweavers
* Copyright 2002 Transgaming Technologies
*
* David Hammerton
*
* (based upon code from dlls/wininet/netconnection.c)
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wincrypt.h"
#ifdef HAVE_OPENSSL_SSL_H
#define DSA __ssl_DSA /* avoid conflict with commctrl.h */
#undef FAR
# include <openssl/rand.h>
#undef FAR
#define FAR do_not_use_this_in_wine
#undef DSA
#endif
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(crypt);
#define RSABASE_MAGIC 0x52534100
#ifdef HAVE_OPENSSL_SSL_H
#ifndef SONAME_LIBCRYPTO
#define SONAME_LIBCRYPTO "libcrypto.so"
#endif
static void *libcrypto;
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
/* OpenSSL funtions that we use */
MAKE_FUNCPTR(RAND_bytes);
static BOOL load_libcrypto( void )
{
libcrypto = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0);
if (!libcrypto)
{
MESSAGE("Couldn't load %s, RSA encryption not available.\n", SONAME_LIBCRYPTO);
MESSAGE("Install the openssl package if you're have problems.\n");
return FALSE;
}
#define GETFUNC(x) \
p##x = wine_dlsym(libcrypto, #x, NULL, 0); \
if (!p##x) \
{ \
ERR("failed to load symbol %s\n", #x); \
return FALSE; \
}
GETFUNC(RAND_bytes);
return TRUE;
}
#endif
typedef struct _RSA_CryptProv
{
DWORD dwMagic;
} RSA_CryptProv;
BOOL WINAPI RSA_CPAcquireContext(HCRYPTPROV *phProv, LPSTR pszContainer,
DWORD dwFlags, PVTableProvStruc pVTable)
{
BOOL ret = FALSE;
RSA_CryptProv *cp;
TRACE("%p %s %08lx %p\n", phProv, debugstr_a(pszContainer),
dwFlags, pVTable);
#ifdef HAVE_OPENSSL_SSL_H
if( !load_libcrypto() )
return FALSE;
cp = HeapAlloc( GetProcessHeap(), 0, sizeof (RSA_CryptProv) );
if( !cp )
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
cp->dwMagic = RSABASE_MAGIC;
*phProv = (HCRYPTPROV) cp;
ret = TRUE;
#endif
return ret;
}
BOOL WINAPI RSA_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash)
{
FIXME("%08lx %d %08lx %08lx %p\n", hProv, Algid, hKey, dwFlags, phHash);
return FALSE;
}
BOOL WINAPI RSA_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPDeriveKey(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, HCRYPTKEY *phKey)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPDestroyHash(HCRYPTPROV hProv, HCRYPTHASH hHash)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPDestroyKey(HCRYPTPROV hProv, HCRYPTKEY hKey)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPDuplicateHash(HCRYPTPROV hUID, HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPDuplicateKey(HCRYPTPROV hUID, HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPEncrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash, BOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen, DWORD dwBufLen)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPExportKey(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTKEY hPubKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPGenKey(HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPGenRandom(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer)
{
BOOL ret = FALSE;
RSA_CryptProv *cp = (RSA_CryptProv*) hProv;
TRACE("%08lx %ld %p\n", hProv, dwLen, pbBuffer);
if( cp && ( cp->dwMagic != RSABASE_MAGIC ) )
return FALSE;
#ifdef HAVE_OPENSSL_SSL_H
if( !pRAND_bytes)
return FALSE;
ret = pRAND_bytes( pbBuffer, dwLen );
#endif
return ret;
}
BOOL WINAPI RSA_CPGetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPGetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPGetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPGetUserKey(HCRYPTPROV hProv, DWORD dwKeySpec, HCRYPTKEY *phUserKey)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPHashData(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbData, DWORD dwDataLen, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPHashSessionKey(HCRYPTPROV hProv, HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPImportKey(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDataLen, HCRYPTKEY hPubKey, DWORD dwFlags, HCRYPTKEY *phKey)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPReleaseContext(HCRYPTPROV hProv, DWORD dwFlags)
{
RSA_CryptProv *cp = (RSA_CryptProv*) hProv;
TRACE("%08lx %08lx\n", hProv, dwFlags);
if( cp && ( cp->dwMagic != RSABASE_MAGIC ) )
return FALSE;
HeapFree( GetProcessHeap(), 0, cp );
return TRUE;
}
BOOL WINAPI RSA_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPSetProvParam(HCRYPTPROV hProv, DWORD dwParam, BYTE *pbData, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPSignHash(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen)
{
FIXME("(stub)\n");
return FALSE;
}
BOOL WINAPI RSA_CPVerifySignature(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags)
{
FIXME("(stub)\n");
return FALSE;
}
/***********************************************************************
* DllRegisterServer (RSABASE.@)
*/
HRESULT WINAPI RSABASE_DllRegisterServer()
{
FIXME("\n");
return S_OK;
}
/***********************************************************************
* DllUnregisterServer (RSABASE.@)
*/
HRESULT WINAPI RSABASE_DllUnregisterServer()
{
FIXME("\n");
return S_OK;
}

27
dlls/rsabase/rsabase.spec Normal file
View File

@ -0,0 +1,27 @@
@ stdcall CPAcquireContext(ptr str long ptr) RSA_CPAcquireContext
@ stdcall CPCreateHash(long long ptr long ptr) RSA_CPCreateHash
@ stdcall CPDecrypt(long long long long long ptr ptr) RSA_CPDecrypt
@ stdcall CPDeriveKey(long long long long ptr) RSA_CPDeriveKey
@ stdcall CPDestroyHash(long long) RSA_CPDestroyHash
@ stdcall CPDestroyKey(long long) RSA_CPDestroyKey
@ stdcall CPDuplicateHash(long long ptr long ptr) RSA_CPDuplicateHash
@ stdcall CPDuplicateKey(long long ptr long ptr) RSA_CPDuplicateKey
@ stdcall CPEncrypt(long long long long long ptr ptr long) RSA_CPEncrypt
@ stdcall CPExportKey(long long long long long ptr ptr) RSA_CPExportKey
@ stdcall CPGenKey(long long long ptr) RSA_CPGenKey
@ stdcall CPGenRandom(long long ptr) RSA_CPGenRandom
@ stdcall CPGetHashParam(long long long ptr ptr long) RSA_CPGetHashParam
@ stdcall CPGetKeyParam(long long long ptr ptr long) RSA_CPGetKeyParam
@ stdcall CPGetProvParam(long long ptr ptr long) RSA_CPGetProvParam
@ stdcall CPGetUserKey(long long ptr) RSA_CPGetUserKey
@ stdcall CPHashData(long long ptr long long) RSA_CPHashData
@ stdcall CPHashSessionKey(long long long long) RSA_CPHashSessionKey
@ stdcall CPImportKey(long ptr long long long ptr) RSA_CPImportKey
@ stdcall CPReleaseContext(long long) RSA_CPReleaseContext
@ stdcall CPSetHashParam(long long long ptr long) RSA_CPSetHashParam
@ stdcall CPSetKeyParam(long long long ptr long) RSA_CPSetKeyParam
@ stdcall CPSetProvParam(long long ptr long) RSA_CPSetProvParam
@ stdcall CPSignHash(long long long wstr long ptr ptr) RSA_CPSignHash
@ stdcall CPVerifySignature(long long ptr long long wstr long) RSA_CPVerifySignature
@ stdcall -private DllRegisterServer() RSABASE_DllRegisterServer
@ stdcall -private DllUnregisterServer() RSABASE_DllUnregisterServer

View File

@ -4633,3 +4633,10 @@
[HKEY_CLASSES_ROOT\CLSID\{E436EBB3-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
#
# crypto config
#
[HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider\Microsoft Base Cryptographic Provider v1.0]
"Image Path"="rsabase.dll"
"Type"=dword:00000001