#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <malloc.h>
-#ifndef alloca
-# define alloca _alloca
-#endif
#include <openssl/crypto.h>
-#include <openssl/buffer.h>
-#include <openssl/bn.h>
#ifdef OPENSSL_SYS_WIN32
#ifndef OPENSSL_NO_CAPIENG
+#include <openssl/buffer.h>
+#include <openssl/bn.h>
#include <openssl/rsa.h>
-#include <windows.h>
-
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
+#include <windows.h>
#include <wincrypt.h>
+#include <malloc.h>
+#ifndef alloca
+# define alloca _alloca
+#endif
/*
* This module uses several "new" interfaces, among which is
{
if (!ENGINE_set_id(e, engine_capi_id)
|| !ENGINE_set_name(e, engine_capi_name)
+ || !ENGINE_set_flags(e, ENGINE_FLAGS_NO_REGISTER_ALL)
|| !ENGINE_set_init_function(e, capi_init)
|| !ENGINE_set_finish_function(e, capi_finish)
|| !ENGINE_set_destroy_function(e, capi_destroy)
LPTSTR cspname = NULL;
CAPI_trace(ctx, "Listing containers CSP=%s, type = %d\n", ctx->cspname, ctx->csptype);
- if (sizeof(TCHAR)!=sizeof(char))
+ if (ctx->cspname && sizeof(TCHAR)!=sizeof(char))
{
if ((clen=MultiByteToWideChar(CP_ACP,0,ctx->cspname,-1,NULL,0)))
{
cspname = alloca(clen*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,ctx->cspname,-1,(WCHAR *)cspname,clen);
}
+ if (!cspname)
+ {
+ CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, ERR_R_MALLOC_FAILURE);
+ capi_addlasterror();
+ return 0;
+ }
}
else
cspname = (TCHAR *)ctx->cspname;
- if (!cspname || !CryptAcquireContext(&hprov, NULL, cspname, ctx->csptype, CRYPT_VERIFYCONTEXT))
+ if (!CryptAcquireContext(&hprov, NULL, cspname, ctx->csptype, CRYPT_VERIFYCONTEXT))
{
CAPIerr(CAPI_F_CAPI_LIST_CONTAINERS, CAPI_R_CRYPTACQUIRECONTEXT_ERROR);
capi_addlasterror();
#include <openssl/engine.h>
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
OPENSSL_EXPORT
+int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns);
+OPENSSL_EXPORT
int bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { return 0; }
IMPLEMENT_DYNAMIC_CHECK_FN()
#else