Hi, it seems that all native MingW32 versions (tested with MingW32 4.50) lack of stuff to compile e_capi.c: gcc -I../include -DOPENSSL_THREADS -D_MT -DDSO_WIN32 -mno-cygwin -DL_ENDIAN -DWIN32_LEAN_AND_MEAN -fomit-frame-pointer -O3 -march=i486 -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DWHIRLPOOL_ASM -c -o e_capi.o e_capi.c e_capi.c: In function 'capi_get_pkey': e_capi.c:671:3: error: 'DSSPUBKEY' undeclared (first use in this function) e_capi.c:671:3: note: each undeclared identifier is reported only once for each function it appears in e_capi.c:671:14: error: 'dp' undeclared (first use in this function) e_capi.c:674:20: error: expected expression before ')' token e_capi.c:718:3: warning: format '%lx' expects type 'long unsigned int', but argument 4 has type 'ALG_ID' e_capi.c: In function 'capi_rsa_sign': e_capi.c:818:3: warning: format '%lx' expects type 'long unsigned int', but argument 4 has type 'int' e_capi.c: In function 'capi_rsa_priv_dec': e_capi.c:912:2: warning: passing argument 6 of 'CryptDecrypt' from incompatible pointer type d:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/wincrypt.h:1209:23: note: expected 'PDWORD' but argument is of type 'int *' e_capi.c: In function 'capi_get_provname': e_capi.c:1090:2: warning: implicit declaration of function 'CryptEnumProvidersA' e_capi.c: In function 'capi_list_providers': e_capi.c:1129:3: warning: format '%d' expects type 'int', but argument 3 has type 'DWORD' e_capi.c:1129:3: warning: format '%d' expects type 'int', but argument 5 has type 'DWORD' e_capi.c: In function 'capi_list_containers': e_capi.c:1173:3: warning: pointer targets in passing argument 3 of 'CryptGetProvParam' differ in signedness d:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/wincrypt.h:1203:23: note: expected 'PBYTE' but argument is of type 'LPSTR' e_capi.c:1188:3: warning: format '%d' expects type 'int', but argument 3 has type 'DWORD' e_capi.c: In function 'capi_dump_prov_info': e_capi.c:1239:2: warning: format '%d' expects type 'int', but argument 4 has type 'DWORD' e_capi.c:1240:2: warning: format '%d' expects type 'int', but argument 4 has type 'DWORD' e_capi.c: In function 'capi_dump_cert': e_capi.c:1290:2: warning: passing argument 2 of 'd2i_X509' from incompatible pointer type ../include/openssl/x509.h:834:1: note: expected 'const unsigned char **' but argument is of type 'unsigned char **' e_capi.c: In function 'capi_open_store': e_capi.c:1328:25: error: 'CERT_STORE_PROV_SYSTEM_A' undeclared (first use in this function) e_capi.c: In function 'capi_list_certs': e_capi.c:1369:11: warning: unused variable 'fname' e_capi.c: In function 'capi_ctx_new': e_capi.c:1529:5: error: 'CERT_STORE_READONLY_FLAG' undeclared (first use in this function) e_capi.c: In function 'capi_load_ssl_client_cert': e_capi.c:1632:5: warning: pointer targets in assignment differ in signedness e_capi.c:1633:3: warning: passing argument 2 of 'd2i_X509' from incompatible pointer type ../include/openssl/x509.h:834:1: note: expected 'const unsigned char **' but argument is of type 'const char **' make[1]: *** [e_capi.o] Error 1 make[1]: Leaving directory `/d/openssl-1.0.0b/engines'
Therefore I've added some more define tests to OpenSSL 1.0.0b e_capi.c to furher check what we have (or not) in wincrypt.h: --- e_capi.c.orig Mon Mar 15 23:29:20 2010 +++ e_capi.c Thu Nov 18 17:43:19 2010 @@ -76,10 +76,16 @@ * CertGetCertificateContextProperty. CERT_KEY_PROV_INFO_PROP_ID is * one of possible values you can pass to function in question. By * checking if it's defined we can see if wincrypt.h and accompanying - * crypt32.lib are in shape. Yes, it's rather "weak" test and if - * compilation fails, then re-configure with -DOPENSSL_NO_CAPIENG. + * crypt32.lib are in shape. The native MingW32 headers up to and + * including __W32API_VERSION 3.14 lack of struct DSSPUBKEY and the + * defines CERT_STORE_PROV_SYSTEM_A and CERT_STORE_READONLY_FLAG, + * so we check for these too and avoid compiling. + * Yes, it's rather "weak" test and if compilation fails, + * then re-configure with -DOPENSSL_NO_CAPIENG. */ -#ifdef CERT_KEY_PROV_INFO_PROP_ID +#if defined(CERT_KEY_PROV_INFO_PROP_ID) && \ + defined(CERT_STORE_PROV_SYSTEM_A) && \ + defined(CERT_STORE_READONLY_FLAG) # define __COMPILE_CAPIENG #endif /* CERT_KEY_PROV_INFO_PROP_ID */ #endif /* OPENSSL_NO_CAPIENG */ patch also attached.
--- e_capi.c.orig Mon Mar 15 23:29:20 2010 +++ e_capi.c Thu Nov 18 17:43:19 2010 @@ -76,10 +76,16 @@ * CertGetCertificateContextProperty. CERT_KEY_PROV_INFO_PROP_ID is * one of possible values you can pass to function in question. By * checking if it's defined we can see if wincrypt.h and accompanying - * crypt32.lib are in shape. Yes, it's rather "weak" test and if - * compilation fails, then re-configure with -DOPENSSL_NO_CAPIENG. + * crypt32.lib are in shape. The native MingW32 headers up to and + * including __W32API_VERSION 3.14 lack of struct DSSPUBKEY and the + * defines CERT_STORE_PROV_SYSTEM_A and CERT_STORE_READONLY_FLAG, + * so we check for these too and avoid compiling. + * Yes, it's rather "weak" test and if compilation fails, + * then re-configure with -DOPENSSL_NO_CAPIENG. */ -#ifdef CERT_KEY_PROV_INFO_PROP_ID +#if defined(CERT_KEY_PROV_INFO_PROP_ID) && \ + defined(CERT_STORE_PROV_SYSTEM_A) && \ + defined(CERT_STORE_READONLY_FLAG) # define __COMPILE_CAPIENG #endif /* CERT_KEY_PROV_INFO_PROP_ID */ #endif /* OPENSSL_NO_CAPIENG */
