summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_crypto.h24
-rw-r--r--src/modules/crypt/encrypt.cpp10
2 files changed, 29 insertions, 5 deletions
diff --git a/include/m_crypto.h b/include/m_crypto.h
index 9cd971b5bd..1f7d782113 100644
--- a/include/m_crypto.h
+++ b/include/m_crypto.h
@@ -52,10 +52,11 @@ struct MICryptoEngine
STDMETHOD_(WCHAR*, decodeStringW)(const BYTE *pBuf, size_t bufLen, size_t *cbResultLen) PURE;
};
-//registers a crypto provider v0.94+
-//wParam = (int)hLangpack
-//lParam = (CRYPTO_PROVIDER*)
-//returns HANDLE on success or NULL on failure
+/////////////////////////////////////////////////////////////////////////////////////////
+// registers a crypto provider v0.94+
+// wParam = (int)hLangpack
+// lParam = (CRYPTO_PROVIDER*)
+// returns HANDLE on success or NULL on failure
typedef MICryptoEngine* (__cdecl *pfnCryptoProviderFactory)(void);
@@ -83,7 +84,7 @@ typedef struct tagCRYPTOPROVIDER
}
CRYPTO_PROVIDER;
-#define MS_CRYPTO_REGISTER_ENGINE "SRCrypto/RegisterEngine"
+#define MS_CRYPTO_REGISTER_ENGINE "Crypto/RegisterEngine"
__forceinline HANDLE Crypto_RegisterEngine(CRYPTO_PROVIDER *pProvider)
{
@@ -91,4 +92,17 @@ __forceinline HANDLE Crypto_RegisterEngine(CRYPTO_PROVIDER *pProvider)
return (HANDLE)CallService(MS_CRYPTO_REGISTER_ENGINE, hLangpack, (LPARAM)pProvider);
}
+///////////////////////////////////////////////////////////////////////////////////////////////
+// retrieves list of all available crypto providers
+// wParam = (WPARAM)(int*)piNumProviders
+// lParam = (CRYPTO_PROVIDER***)pointer to an array of CRYPTO_PROVIDER*
+// always returns 0
+
+#define MS_CRYPTO_ENUM_PROVIDERS "Crypto/EnumProviders"
+
+__forceinline void Crypto_EnumProviders(int *numProvs, CRYPTO_PROVIDER ***pResult)
+{
+ CallService(MS_CRYPTO_ENUM_PROVIDERS, WPARAM(numProvs), LPARAM(pResult));
+}
+
#endif // M_CRYPTO_H__
diff --git a/src/modules/crypt/encrypt.cpp b/src/modules/crypt/encrypt.cpp
index ab73ac5671..4cb096e3ec 100644
--- a/src/modules/crypt/encrypt.cpp
+++ b/src/modules/crypt/encrypt.cpp
@@ -74,6 +74,15 @@ static INT_PTR srvRegister(WPARAM wParam, LPARAM lParam)
return 0;
}
+static INT_PTR srvEnumProviders(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam && lParam) {
+ *(int*)wParam = arProviders.getCount();
+ *(CRYPTO_PROVIDER***)lParam = arProviders.getArray();
+ }
+ return 0;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
int InitCrypt(void)
@@ -82,6 +91,7 @@ int InitCrypt(void)
CreateServiceFunction(MS_DB_CRYPT_DECODESTRING, DecodeString);
CreateServiceFunction(MS_CRYPTO_REGISTER_ENGINE, srvRegister);
+ CreateServiceFunction(MS_CRYPTO_ENUM_PROVIDERS, srvEnumProviders);
return 0;
}