Skip to content

bn_mod_pmers hangs if modulus is 0 #221

@guidovranken

Description

@guidovranken
#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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions