Created
July 18, 2018 08:16
-
-
Save kaworu/4f5e11de81798002096f694ed4861f74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <openssl/bn.h> | |
int | |
main(void) | |
{ | |
BIGNUM *z, *mz; | |
z = BN_new(); | |
if (BN_zero(z) == 0) | |
return (1); | |
mz = BN_new(); | |
if (BN_dec2bn(&mz, "-0") == 0) | |
return (1); | |
printf("BN_is_zero(BN_zero()): %s\n", BN_is_zero(z) ? "yes" : "no"); | |
printf("BN_is_zero(BN_dec2bn(\"-0\")): %s\n", BN_is_zero(mz) ? "yes" : "no"); | |
printf("BN_cmp(BN_zero(), BN_dec2bn(\"-0\")): %d\n", BN_cmp(z, mz)); | |
return (0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cc BN_zero.c -lcrypto && ./a.out
Output: