relic-toolkit / relic

Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bn_gcd_lehme hangs with negative input

guidovranken opened this issue · comments

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

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

    bn_t A, B, R;

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

    const char* s1 = "-9000000000000000000000000000000000000000000000035327";
    const char* s2 = "15317659751829901636";

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

    bn_gcd_lehme(R, A, B);

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