fixed crash in openssl signature verification if sizeof(size_t) != sizeof(int) (64bit)
authorMartin Willi <martin@strongswan.org>
Fri, 31 Oct 2008 17:05:40 +0000 (17:05 -0000)
committerMartin Willi <martin@strongswan.org>
Fri, 31 Oct 2008 17:05:40 +0000 (17:05 -0000)
src/libstrongswan/plugins/openssl/openssl_rsa_private_key.c

index fd10ab9..205220a 100644 (file)
@@ -77,6 +77,7 @@ static bool build_emsa_pkcs1_signature(private_openssl_rsa_private_key_t *this,
                                                                           int type, chunk_t data, chunk_t *signature)
 {
        bool success = FALSE;
+       u_int len;
        const EVP_MD *hasher = EVP_get_digestbynid(type);
        if (!hasher)
        {
@@ -107,10 +108,11 @@ static bool build_emsa_pkcs1_signature(private_openssl_rsa_private_key_t *this,
        
        *signature = chunk_alloc(RSA_size(this->rsa));
        
-       if (!EVP_SignFinal(ctx, signature->ptr, &signature->len, key))
+       if (!EVP_SignFinal(ctx, signature->ptr, &len, key))
        {
                goto error;
        }
+       signature->len = len;
        
        success = TRUE;