added generic implementation helpers for private_key_t.equals/belongs_to, public_key_t.equals
This commit is contained in:
@@ -39,6 +39,30 @@ ENUM(signature_scheme_names, SIGN_UNKNOWN, SIGN_ECDSA_521,
|
||||
"ECDSA-521",
|
||||
);
|
||||
|
||||
/**
|
||||
* See header.
|
||||
*/
|
||||
bool public_key_equals(public_key_t *this, public_key_t *other)
|
||||
{
|
||||
key_encoding_type_t type;
|
||||
chunk_t a, b;
|
||||
|
||||
if (this == other)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (type = 0; type < KEY_ENCODING_MAX; type++)
|
||||
{
|
||||
if (this->get_fingerprint(this, type, &a) &&
|
||||
other->get_fingerprint(other, type, &b))
|
||||
{
|
||||
return chunk_equals(a, b);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Defined in header.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user