openssl: Fixes for ECDSA with OpenSSL 3.0
This commit is contained in:
@@ -86,6 +86,48 @@ error:
|
||||
return success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
bool openssl_fingerprint(EVP_PKEY *key, cred_encoding_type_t type, chunk_t *fp)
|
||||
{
|
||||
hasher_t *hasher;
|
||||
chunk_t enc;
|
||||
u_char *p;
|
||||
|
||||
if (lib->encoding->get_cache(lib->encoding, type, key, fp))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case KEYID_PUBKEY_SHA1:
|
||||
enc = chunk_alloc(i2d_PublicKey(key, NULL));
|
||||
p = enc.ptr;
|
||||
i2d_PublicKey(key, &p);
|
||||
break;
|
||||
case KEYID_PUBKEY_INFO_SHA1:
|
||||
enc = chunk_alloc(i2d_PUBKEY(key, NULL));
|
||||
p = enc.ptr;
|
||||
i2d_PUBKEY(key, &p);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
|
||||
if (!hasher || !hasher->allocate_hash(hasher, enc, fp))
|
||||
{
|
||||
DBG1(DBG_LIB, "SHA1 not supported, fingerprinting failed");
|
||||
DESTROY_IF(hasher);
|
||||
free(enc.ptr);
|
||||
return FALSE;
|
||||
}
|
||||
free(enc.ptr);
|
||||
hasher->destroy(hasher);
|
||||
lib->encoding->cache(lib->encoding, type, key, *fp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user