0.9.8 on linux:

#include <stdio.h>
#include <stdlib.h>
#include <openssl/bn.h>

void error(int line) {
    fprintf(stderr, "Error on line %d\n", line);
    exit(1);
}

int main(void) {
    BIGNUM m;

    BN_init(&m);
    if (!BN_set_word(&m, 5)) error(__LINE__);
    BN_mod_word(&m, 0L);
    BN_free(&m);
    return 0;
}

=====================

Gives:
Floating point exception (core dumped)

Reason: unlike in BN_div_word, in BN_mod_word w is not checked for being 0

PS:
 these functions are really bad in that you can't distinguish
 between failure and a real 0 result. Maybe they should be
 returning (BN_ULONG) -1, since that value is impossible as normal output
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to