static char *sec_alloc_realloc(BUF_MEM *str, size_t len)
{
    char *ret;

    ret = OPENSSL_secure_malloc(len);
    if (str->data != NULL) {
        if (ret != NULL)
            memcpy(ret, str->data, str->length);
        OPENSSL_secure_free(str->data);
    }
    return (ret);
}