Convert bn_test to C++.
Along the way, fix a host of missing failure checks. This will save some headache when it comes time to run these under the malloc failure tests. Change-Id: I3fd589bd094178723398e793d6bc578884e99b67 Reviewed-on: https://boringssl-review.googlesource.com/4126 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
e12c4378e9
commit
a5974bfae7
@ -69,7 +69,7 @@ perlasm(armv4-mont.${ASM_EXT} asm/armv4-mont.pl)
|
||||
add_executable(
|
||||
bn_test
|
||||
|
||||
bn_test.c
|
||||
bn_test.cc
|
||||
)
|
||||
|
||||
target_link_libraries(bn_test crypto)
|
||||
|
1506
crypto/bn/bn_test.c
1506
crypto/bn/bn_test.c
File diff suppressed because it is too large
Load Diff
1424
crypto/bn/bn_test.cc
Normal file
1424
crypto/bn/bn_test.cc
Normal file
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/dh.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
@ -69,6 +70,9 @@ class ScopedOpenSSLContext {
|
||||
};
|
||||
|
||||
using ScopedBIO = ScopedOpenSSLType<BIO, BIO_vfree>;
|
||||
using ScopedBIGNUM = ScopedOpenSSLType<BIGNUM, BN_free>;
|
||||
using ScopedBN_CTX = ScopedOpenSSLType<BN_CTX, BN_CTX_free>;
|
||||
using ScopedBN_MONT_CTX = ScopedOpenSSLType<BN_MONT_CTX, BN_MONT_CTX_free>;
|
||||
using ScopedDH = ScopedOpenSSLType<DH, DH_free>;
|
||||
using ScopedEVP_PKEY = ScopedOpenSSLType<EVP_PKEY, EVP_PKEY_free>;
|
||||
using ScopedPKCS8_PRIV_KEY_INFO = ScopedOpenSSLType<PKCS8_PRIV_KEY_INFO,
|
||||
|
@ -473,7 +473,8 @@ OPENSSL_EXPORT BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
|
||||
BN_div(NULL, (rem), (numerator), (divisor), (ctx))
|
||||
|
||||
/* BN_nnmod is a non-negative modulo function. It acts like |BN_mod|, but 0 <=
|
||||
* |rem| < |divisor| is always true. */
|
||||
* |rem| < |divisor| is always true. It returns one on success and zero on
|
||||
* error. */
|
||||
OPENSSL_EXPORT int BN_nnmod(BIGNUM *rem, const BIGNUM *numerator,
|
||||
const BIGNUM *divisor, BN_CTX *ctx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user