int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key)
{
    int ret = 0;

    if (k == NULL || klen == 0 || key == NULL) {
        ret = BAD_FUNC_ARG;
    }

    if (ret == 0) {
        if (key->sign_k == NULL) {
            key->sign_k = (mp_int*)XMALLOC(sizeof(mp_int), key->heap,
                                                              DYNAMIC_TYPE_ECC);
            if (key->sign_k == NULL) {
                ret = MEMORY_E;
            }
        }
    }

    if (ret == 0) {
        ret = mp_init(key->sign_k);
    }
    if (ret == 0) {
        ret = mp_read_unsigned_bin(key->sign_k, k, klen);
    }

    return ret;
}
int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key)
{
    int ret = 0;

    if (k == NULL || klen == 0 || key == NULL) {
        ret = BAD_FUNC_ARG;
    }

    if (ret == 0) {
        if (key->sign_k == NULL) {
            key->sign_k = (mp_int*)XMALLOC(sizeof(mp_int), key->heap,
                                                              DYNAMIC_TYPE_ECC);
            if (key->sign_k == NULL) {
                ret = MEMORY_E;
            }
        }
    }

    if (ret == 0) {
        ret = mp_init(key->sign_k);
    }
    if (ret == 0) {
        ret = mp_read_unsigned_bin(key->sign_k, k, klen);
    }

    return ret;
}