Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bn_mod_pmers hangs if modulus is 0 #221

Closed
guidovranken opened this issue Feb 3, 2022 · 1 comment
Closed

bn_mod_pmers hangs if modulus is 0 #221

guidovranken opened this issue Feb 3, 2022 · 1 comment

Comments

@guidovranken
Copy link
Contributor

#include <relic_conf.h>
#include <relic.h>

int main(void)
{
    if ( core_init() != RLC_OK ) abort();

    bn_t A, B, tmp, R;

    bn_null(A); bn_new(A);
    bn_null(B); bn_new(B);
    bn_null(tmp); bn_new(tmp);
    bn_null(R); bn_new(R);

    const char* s1 = "1";
    const char* s2 = "0";

    bn_read_str(A, s1, strlen(s2), 10);
    bn_read_str(B, s2, strlen(s2), 10);

    bn_mod_pre_pmers(tmp, B);
    bn_mod_pmers(R, A, B, tmp);

    bn_free(A);
    bn_free(B);
    bn_free(tmp);
    bn_free(R);
    return 0;
}

Maybe it should set the result to 0 like the other mod functions?

@guidovranken
Copy link
Contributor Author

Confirmed fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant