Lines Matching refs:bn

333     BIGNUM *bn = BN_new();  in set_signed_bn()  local
335 if (bn == NULL) in set_signed_bn()
337 if (!BN_set_word(bn, value < 0 ? -value : value)) { in set_signed_bn()
338 BN_free(bn); in set_signed_bn()
341 BN_set_negative(bn, value < 0); in set_signed_bn()
342 return bn; in set_signed_bn()
1932 BIGNUM *bn = NULL, *bn2 = NULL; in test_bn2signed() local
1935 if (!TEST_ptr(bn = BN_new()) in test_bn2signed()
1936 || !TEST_true(BN_asc2bn(&bn, test->base10))) in test_bn2signed()
1945 if (!TEST_int_eq(BN_signed_bn2bin(bn, scratch, sizeof(scratch)), in test_bn2signed()
1952 || !TEST_BN_eq(bn, bn2)) in test_bn2signed()
1960 || !TEST_BN_eq(bn, bn2)) in test_bn2signed()
1972 if (!TEST_int_eq(BN_signed_bn2lebin(bn, scratch, sizeof(scratch)), in test_bn2signed()
1979 || !TEST_BN_eq(bn, bn2)) in test_bn2signed()
1987 || !TEST_BN_eq(bn, bn2)) in test_bn2signed()
1993 BN_free(bn); in test_bn2signed()
1999 BIGNUM *bn = NULL; in test_dec2bn() local
2002 if (!TEST_int_eq(parsedecBN(&bn, "0"), 1) in test_dec2bn()
2003 || !TEST_BN_eq_word(bn, 0) in test_dec2bn()
2004 || !TEST_BN_eq_zero(bn) in test_dec2bn()
2005 || !TEST_BN_le_zero(bn) in test_dec2bn()
2006 || !TEST_BN_ge_zero(bn) in test_dec2bn()
2007 || !TEST_BN_even(bn)) in test_dec2bn()
2009 BN_free(bn); in test_dec2bn()
2010 bn = NULL; in test_dec2bn()
2012 if (!TEST_int_eq(parsedecBN(&bn, "256"), 3) in test_dec2bn()
2013 || !TEST_BN_eq_word(bn, 256) in test_dec2bn()
2014 || !TEST_BN_ge_zero(bn) in test_dec2bn()
2015 || !TEST_BN_gt_zero(bn) in test_dec2bn()
2016 || !TEST_BN_ne_zero(bn) in test_dec2bn()
2017 || !TEST_BN_even(bn)) in test_dec2bn()
2019 BN_free(bn); in test_dec2bn()
2020 bn = NULL; in test_dec2bn()
2022 if (!TEST_int_eq(parsedecBN(&bn, "-42"), 3) in test_dec2bn()
2023 || !TEST_BN_abs_eq_word(bn, 42) in test_dec2bn()
2024 || !TEST_BN_lt_zero(bn) in test_dec2bn()
2025 || !TEST_BN_le_zero(bn) in test_dec2bn()
2026 || !TEST_BN_ne_zero(bn) in test_dec2bn()
2027 || !TEST_BN_even(bn)) in test_dec2bn()
2029 BN_free(bn); in test_dec2bn()
2030 bn = NULL; in test_dec2bn()
2032 if (!TEST_int_eq(parsedecBN(&bn, "1"), 1) in test_dec2bn()
2033 || !TEST_BN_eq_word(bn, 1) in test_dec2bn()
2034 || !TEST_BN_ne_zero(bn) in test_dec2bn()
2035 || !TEST_BN_gt_zero(bn) in test_dec2bn()
2036 || !TEST_BN_ge_zero(bn) in test_dec2bn()
2037 || !TEST_BN_eq_one(bn) in test_dec2bn()
2038 || !TEST_BN_odd(bn)) in test_dec2bn()
2040 BN_free(bn); in test_dec2bn()
2041 bn = NULL; in test_dec2bn()
2043 if (!TEST_int_eq(parsedecBN(&bn, "-0"), 2) in test_dec2bn()
2044 || !TEST_BN_eq_zero(bn) in test_dec2bn()
2045 || !TEST_BN_ge_zero(bn) in test_dec2bn()
2046 || !TEST_BN_le_zero(bn) in test_dec2bn()
2047 || !TEST_BN_even(bn)) in test_dec2bn()
2049 BN_free(bn); in test_dec2bn()
2050 bn = NULL; in test_dec2bn()
2052 if (!TEST_int_eq(parsedecBN(&bn, "42trailing garbage is ignored"), 2) in test_dec2bn()
2053 || !TEST_BN_abs_eq_word(bn, 42) in test_dec2bn()
2054 || !TEST_BN_ge_zero(bn) in test_dec2bn()
2055 || !TEST_BN_gt_zero(bn) in test_dec2bn()
2056 || !TEST_BN_ne_zero(bn) in test_dec2bn()
2057 || !TEST_BN_even(bn)) in test_dec2bn()
2062 BN_free(bn); in test_dec2bn()
2068 BIGNUM *bn = NULL; in test_hex2bn() local
2071 if (!TEST_int_eq(parseBN(&bn, "0"), 1) in test_hex2bn()
2072 || !TEST_BN_eq_zero(bn) in test_hex2bn()
2073 || !TEST_BN_ge_zero(bn) in test_hex2bn()
2074 || !TEST_BN_even(bn)) in test_hex2bn()
2076 BN_free(bn); in test_hex2bn()
2077 bn = NULL; in test_hex2bn()
2079 if (!TEST_int_eq(parseBN(&bn, "256"), 3) in test_hex2bn()
2080 || !TEST_BN_eq_word(bn, 0x256) in test_hex2bn()
2081 || !TEST_BN_ge_zero(bn) in test_hex2bn()
2082 || !TEST_BN_gt_zero(bn) in test_hex2bn()
2083 || !TEST_BN_ne_zero(bn) in test_hex2bn()
2084 || !TEST_BN_even(bn)) in test_hex2bn()
2086 BN_free(bn); in test_hex2bn()
2087 bn = NULL; in test_hex2bn()
2089 if (!TEST_int_eq(parseBN(&bn, "-42"), 3) in test_hex2bn()
2090 || !TEST_BN_abs_eq_word(bn, 0x42) in test_hex2bn()
2091 || !TEST_BN_lt_zero(bn) in test_hex2bn()
2092 || !TEST_BN_le_zero(bn) in test_hex2bn()
2093 || !TEST_BN_ne_zero(bn) in test_hex2bn()
2094 || !TEST_BN_even(bn)) in test_hex2bn()
2096 BN_free(bn); in test_hex2bn()
2097 bn = NULL; in test_hex2bn()
2099 if (!TEST_int_eq(parseBN(&bn, "cb"), 2) in test_hex2bn()
2100 || !TEST_BN_eq_word(bn, 0xCB) in test_hex2bn()
2101 || !TEST_BN_ge_zero(bn) in test_hex2bn()
2102 || !TEST_BN_gt_zero(bn) in test_hex2bn()
2103 || !TEST_BN_ne_zero(bn) in test_hex2bn()
2104 || !TEST_BN_odd(bn)) in test_hex2bn()
2106 BN_free(bn); in test_hex2bn()
2107 bn = NULL; in test_hex2bn()
2109 if (!TEST_int_eq(parseBN(&bn, "-0"), 2) in test_hex2bn()
2110 || !TEST_BN_eq_zero(bn) in test_hex2bn()
2111 || !TEST_BN_ge_zero(bn) in test_hex2bn()
2112 || !TEST_BN_le_zero(bn) in test_hex2bn()
2113 || !TEST_BN_even(bn)) in test_hex2bn()
2115 BN_free(bn); in test_hex2bn()
2116 bn = NULL; in test_hex2bn()
2118 if (!TEST_int_eq(parseBN(&bn, "abctrailing garbage is ignored"), 3) in test_hex2bn()
2119 || !TEST_BN_eq_word(bn, 0xabc) in test_hex2bn()
2120 || !TEST_BN_ge_zero(bn) in test_hex2bn()
2121 || !TEST_BN_gt_zero(bn) in test_hex2bn()
2122 || !TEST_BN_ne_zero(bn) in test_hex2bn()
2123 || !TEST_BN_even(bn)) in test_hex2bn()
2128 BN_free(bn); in test_hex2bn()
2134 BIGNUM *bn = NULL; in test_asc2bn() local
2137 if (!TEST_ptr(bn = BN_new())) in test_asc2bn()
2140 if (!TEST_true(BN_asc2bn(&bn, "0")) in test_asc2bn()
2141 || !TEST_BN_eq_zero(bn) in test_asc2bn()
2142 || !TEST_BN_ge_zero(bn)) in test_asc2bn()
2145 if (!TEST_true(BN_asc2bn(&bn, "256")) in test_asc2bn()
2146 || !TEST_BN_eq_word(bn, 256) in test_asc2bn()
2147 || !TEST_BN_ge_zero(bn)) in test_asc2bn()
2150 if (!TEST_true(BN_asc2bn(&bn, "-42")) in test_asc2bn()
2151 || !TEST_BN_abs_eq_word(bn, 42) in test_asc2bn()
2152 || !TEST_BN_lt_zero(bn)) in test_asc2bn()
2155 if (!TEST_true(BN_asc2bn(&bn, "0x1234")) in test_asc2bn()
2156 || !TEST_BN_eq_word(bn, 0x1234) in test_asc2bn()
2157 || !TEST_BN_ge_zero(bn)) in test_asc2bn()
2160 if (!TEST_true(BN_asc2bn(&bn, "0X1234")) in test_asc2bn()
2161 || !TEST_BN_eq_word(bn, 0x1234) in test_asc2bn()
2162 || !TEST_BN_ge_zero(bn)) in test_asc2bn()
2165 if (!TEST_true(BN_asc2bn(&bn, "-0xabcd")) in test_asc2bn()
2166 || !TEST_BN_abs_eq_word(bn, 0xabcd) in test_asc2bn()
2167 || !TEST_BN_lt_zero(bn)) in test_asc2bn()
2170 if (!TEST_true(BN_asc2bn(&bn, "-0")) in test_asc2bn()
2171 || !TEST_BN_eq_zero(bn) in test_asc2bn()
2172 || !TEST_BN_ge_zero(bn)) in test_asc2bn()
2175 if (!TEST_true(BN_asc2bn(&bn, "123trailing garbage is ignored")) in test_asc2bn()
2176 || !TEST_BN_eq_word(bn, 123) in test_asc2bn()
2177 || !TEST_BN_ge_zero(bn)) in test_asc2bn()
2182 BN_free(bn); in test_asc2bn()
2200 BIGNUM *bn = NULL; in test_mpi() local
2204 if (!TEST_ptr(bn = BN_new()) in test_mpi()
2205 || !TEST_true(BN_asc2bn(&bn, test->base10))) in test_mpi()
2207 mpi_len = BN_bn2mpi(bn, NULL); in test_mpi()
2211 if (!TEST_size_t_eq(mpi_len2 = BN_bn2mpi(bn, scratch), mpi_len) in test_mpi()
2218 if (!TEST_BN_eq(bn, bn2)) { in test_mpi()
2226 BN_free(bn); in test_mpi()
2300 BIGNUM *bn = NULL; in test_rand() local
2303 if (!TEST_ptr(bn = BN_new())) in test_rand()
2307 if (!TEST_false(BN_rand(bn, 0, 0 /* top */ , 0 /* bottom */ )) in test_rand()
2308 || !TEST_false(BN_rand(bn, 0, 1 /* top */ , 1 /* bottom */ )) in test_rand()
2309 || !TEST_true(BN_rand(bn, 1, 0 /* top */ , 0 /* bottom */ )) in test_rand()
2310 || !TEST_BN_eq_one(bn) in test_rand()
2311 || !TEST_false(BN_rand(bn, 1, 1 /* top */ , 0 /* bottom */ )) in test_rand()
2312 || !TEST_true(BN_rand(bn, 1, -1 /* top */ , 1 /* bottom */ )) in test_rand()
2313 || !TEST_BN_eq_one(bn) in test_rand()
2314 || !TEST_true(BN_rand(bn, 2, 1 /* top */ , 0 /* bottom */ )) in test_rand()
2315 || !TEST_BN_eq_word(bn, 3)) in test_rand()
2320 BN_free(bn); in test_rand()