~ubuntu-branches/ubuntu/karmic/openvpn/karmic

« back to all changes in this revision

Viewing changes to cryptoapi.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-07-24 19:22:13 UTC
  • mfrom: (1.1.13 upstream) (10.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090724192213-cy0pox13ulk4hdam
Tags: 2.1~rc19-1ubuntu1
* Merge from debian unstable (LP: #404099), remaining changes:
  - debian/openvpn.init.d:
    - Do not use start-stop-daemon and use < /dev/null to avoid blocking boot
    - show per-VPN result messages
    - add "--script-security 2" by default for backwards compatibility
    - Added lsb-base>=3.2-14 depend to allow status_of_proc()

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#define CERT_STORE_OPEN_EXISTING_FLAG 0x00004000
52
52
#define CRYPT_ACQUIRE_COMPARE_KEY_FLAG 0x00000004
53
53
static HINSTANCE crypt32dll = NULL;
54
 
static BOOL WINAPI (*CryptAcquireCertificatePrivateKey) (PCCERT_CONTEXT pCert, DWORD dwFlags,
55
 
    void *pvReserved, HCRYPTPROV *phCryptProv, DWORD *pdwKeySpec, BOOL *pfCallerFreeProv) = NULL;
 
54
static BOOL WINAPI (*OpenVPNCryptAcquireCertificatePrivateKey) (PCCERT_CONTEXT pCert, DWORD dwFlags,
 
55
  void *pvReserved, HCRYPTPROV *phCryptProv, DWORD *pdwKeySpec, BOOL *pfCallerFreeProv) = NULL;
 
56
#else
 
57
#define OpenVPNCryptAcquireCertificatePrivateKey CryptAcquireCertificatePrivateKey
56
58
#endif
57
59
 
58
60
/* Size of an SSL signature: MD5+SHA1 */
387
389
            goto err;
388
390
        }
389
391
    }
390
 
    if (CryptAcquireCertificatePrivateKey == NULL) {
391
 
        CryptAcquireCertificatePrivateKey = GetProcAddress(crypt32dll,
 
392
    if (OpenVPNCryptAcquireCertificatePrivateKey == NULL) {
 
393
        OpenVPNCryptAcquireCertificatePrivateKey = GetProcAddress(crypt32dll,
392
394
                "CryptAcquireCertificatePrivateKey");
393
 
        if (CryptAcquireCertificatePrivateKey == NULL) {
 
395
        if (OpenVPNCryptAcquireCertificatePrivateKey == NULL) {
394
396
            CRYPTOAPIerr(CRYPTOAPI_F_GET_PROC_ADDRESS);
395
397
            goto err;
396
398
        }
397
399
    }
398
400
#endif
399
 
    if (!CryptAcquireCertificatePrivateKey(cd->cert_context, CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
 
401
    if (!OpenVPNCryptAcquireCertificatePrivateKey(cd->cert_context, CRYPT_ACQUIRE_COMPARE_KEY_FLAG,
400
402
            NULL, &cd->crypt_prov, &cd->key_spec, &cd->free_crypt_prov)) {
401
403
        /* if we don't have a smart card reader here, and we try to access a
402
404
         * smart card certificate, we get: