/* Initialize RSA Interface. 1. Initializes the resources needed for the RSA interface 2.registers event callback function.  */
rsa_handle_t csi_rsa_initialize(int32_t idx, rsa_event_cb_t cb_event)
/* Initialize RSA Interface. 1. Initializes the resources needed for the RSA interface 2.registers event callback function.  */
rsa_handle_t csi_rsa_initialize(int32_t idx, rsa_event_cb_t cb_event)
{
    if (idx < 0 || idx >= CONFIG_RSA_NUM) {
        return NULL;
    }
    uint32_t base = 0u;
    uint32_t irq;
    int32_t real_idx = target_get_rsa(idx, &base, &irq);
    if (real_idx != idx) {
        return NULL;
    }
    ck_rsa_priv_t *rsa_priv = &rsa_handle[idx];
    rsa_priv->base = base;
    rsa_priv->irq  = irq;
    rsa_priv->cb = cb_event;
    rsa_priv->data_bit = RSA_DATA_BITS_1024;
    rsa_priv->endian = RSA_ENDIAN_MODE_LITTLE;
    rsa_priv->padding.padding_type = RSA_PADDING_MODE_PKCS1;
    rsa_priv->padding.hash_type = RSA_HASH_TYPE_SHA1;
    rsa_priv->status.busy = 0;
    return (rsa_handle_t)rsa_priv;
}