added generic implementation helpers for private_key_t.equals/belongs_to, public_key_t.equals

This commit is contained in:
Martin Willi
2009-08-26 11:23:52 +02:00
parent 0dd2defc5a
commit edd354db6f
4 changed files with 97 additions and 3 deletions
@@ -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.
*/