Browse Source

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>
kris/onging/CECPQ3_patch15
David Benjamin 9 years ago
committed by Adam Langley
parent
commit
a5974bfae7
5 changed files with 1431 additions and 1508 deletions
  1. +1
    -1
      crypto/bn/CMakeLists.txt
  2. +0
    -1506
      crypto/bn/bn_test.c
  3. +1424
    -0
      crypto/bn/bn_test.cc
  4. +4
    -0
      crypto/test/scoped_types.h
  5. +2
    -1
      include/openssl/bn.h

+ 1
- 1
crypto/bn/CMakeLists.txt View File

@@ -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)

+ 0
- 1506
crypto/bn/bn_test.c
File diff suppressed because it is too large
View File


+ 1424
- 0
crypto/bn/bn_test.cc
File diff suppressed because it is too large
View File


+ 4
- 0
crypto/test/scoped_types.h View File

@@ -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,


+ 2
- 1
include/openssl/bn.h View File

@@ -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…
Cancel
Save