Panic with High-level API in C

Hi, I have two issues with C api

  • lack of some casting functions like
        fhe_***_cast_into_fhe_uint2048
        fhe_***_cast_into_fhe_uint1024
        fhe_***_cast_into_fhe_uint512
        fhe_***_cast_into_fhe_uint12

Is there some real reason why these casts are not available or is it error in C API?

  • panic when using function fhe_uint2_shr
        thread '<unnamed>' panicked at tfhe/src/integer/server_key/radix_parallel/shift.rs:588:54:
        index out of bounds: the len is 1 but the index is 1
        note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Here is minimal reproduce code

int main(void)
{
    int ok = 0;

    Config *config;

    {
        ConfigBuilder *builder;
        config_builder_default(&builder);
        config_builder_build(builder, &config);
    }

    ClientKey *CK = NULL;
    ServerKey *SK = NULL;

    generate_keys(config, &CK, &SK);
    set_server_key(SK);

    FheUint2 *a, *b, *c;
    fhe_uint2_try_encrypt_trivial_u8(0, &a);
    fhe_uint2_try_encrypt_trivial_u8(0, &b);
    int d = fhe_uint2_shr(a, b, &c);
}

These are indeed legit bugs/missing features, we are going to fix those

Thanks for reporting

1 Like

Just as an update, the FheUint2 shr bug has been fixed a few days ago, the missing cast are on their way to be added