/* RFC 5280, section 7.5, requires that only the domain is compared in a case-insensitive manner.  */
static int equal_email(const unsigned char *a, size_t a_len, const unsigned char *b, size_t b_len, unsigned int unused_flags)
/* RFC 5280, section 7.5, requires that only the domain is compared in a case-insensitive manner.  */
static int equal_email(const unsigned char *a, size_t a_len, const unsigned char *b, size_t b_len, unsigned int unused_flags)
{
    size_t i = a_len;
    if (a_len != b_len)
        return 0;
    while (i > 0) {
        --i;
        if (a[i] == '@' || b[i] == '@') {
            if (!equal_nocase(a + i, a_len - i, b + i, a_len - i, 0))
                return 0;
            break;
        }
    }
    if (i == 0)
        i = a_len;
    return equal_case(a, i, b, i, 0);
}