/* Get length of bignum as an unsigned binary buffer.  */
int rt_hwcrypto_bignum_get_len(const struct hw_bignum_mpi *n)
/* Get length of bignum as an unsigned binary buffer.  */
int rt_hwcrypto_bignum_get_len(const struct hw_bignum_mpi *n)
{
    int tmp_len, total;
    if (n == RT_NULL || n->p == RT_NULL)
    {
        return 0;
    }
    tmp_len = 0;
    total = n->total;
    while ((total > 0) && (n->p[total - 1] == 0))
    {
        tmp_len++;
        total--;
    }
    return n->total - tmp_len;
}