Rename BIO_print_errors_fp back to ERR_print_errors_fp & refactor it.

A previous change in BoringSSL renamed ERR_print_errors_fp to
BIO_print_errors_fp as part of refactoring the code to improve the
layering of modules within BoringSSL. Rename it back for better
compatibility with code that was using the function under the original
name. Move its definition back to crypto/err using an implementation
that avoids depending on crypto/bio.

Change-Id: Iee7703bb1eb4a3d640aff6485712bea71d7c1052
Reviewed-on: https://boringssl-review.googlesource.com/4310
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Brian Smith 2015-04-09 16:21:10 -10:00 committed by Adam Langley
parent 7d897a1bf2
commit 83a82981dc
19 changed files with 94 additions and 81 deletions

View File

@ -462,12 +462,6 @@ int BIO_indent(BIO *bio, unsigned indent, unsigned max_indent) {
return 1;
}
void BIO_print_errors_fp(FILE *out) {
BIO *bio = BIO_new_fp(out, BIO_NOCLOSE);
BIO_print_errors(bio);
BIO_free(bio);
}
static int print_bio(const char *str, size_t len, void *bio) {
return BIO_write((BIO *)bio, str, len);
}

View File

@ -111,7 +111,7 @@ static bool TestSocketConnect() {
if (BIO_write(bio.get(), kTestMessage, sizeof(kTestMessage)) !=
sizeof(kTestMessage)) {
fprintf(stderr, "BIO_write failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}

View File

@ -945,7 +945,7 @@ static bool test_mod_mul(BIO *bp, BN_CTX *ctx) {
a->neg = rand_neg();
b->neg = rand_neg();
if (!BN_mod_mul(e.get(), a.get(), b.get(), c.get(), ctx)) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
if (bp != NULL) {
@ -975,7 +975,7 @@ static bool test_mod_mul(BIO *bp, BN_CTX *ctx) {
}
if (!BN_is_zero(b.get())) {
fprintf(stderr, "Modulo multiply test failed!\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
}
@ -1323,7 +1323,7 @@ static bool test_sqrt(BIO *bp, BN_CTX *ctx) {
0 /* don't modify bottom bit */) ||
!BN_mul(nn.get(), n.get(), n.get(), ctx) ||
!BN_sqrt(sqrt.get(), nn.get(), ctx)) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
if (BN_cmp(n.get(), sqrt.get()) != 0) {
@ -1339,7 +1339,7 @@ static bool test_sqrt(BIO *bp, BN_CTX *ctx) {
0 /* don't modify bottom bit */) ||
!BN_mul(nn.get(), n.get(), n.get(), ctx) ||
!BN_add(nn.get(), nn.get(), BN_value_one())) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
@ -1380,7 +1380,7 @@ static bool test_bn2bin_padded(BIO *bp, BN_CTX *ctx) {
for (size_t bytes = 128 - 7; bytes <= 128; bytes++) {
if (!BN_rand(n.get(), bytes * 8, 0 /* make sure top bit is 1 */,
0 /* don't modify bottom bit */)) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
if (BN_num_bytes(n.get()) != bytes ||

View File

@ -18,7 +18,6 @@
#include <string.h>
#include <openssl/aead.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
@ -298,7 +297,7 @@ int main(int argc, char **argv) {
if (any_values_set) {
if (!run_test_case(aead, bufs, lengths, line_no)) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 4;
}

View File

@ -57,7 +57,6 @@
#include <stdio.h>
#include <string.h>
#include <openssl/bio.h>
#include <openssl/cipher.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
@ -158,39 +157,39 @@ static void test1(const EVP_CIPHER *c, const uint8_t *key, int kn,
if (mode == EVP_CIPH_GCM_MODE) {
if (!EVP_EncryptInit_ex(&ctx, c, NULL, NULL, NULL)) {
fprintf(stderr, "EncryptInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(10);
}
if (!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_IVLEN, in, NULL)) {
fprintf(stderr, "IV length set failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(11);
}
if (!EVP_EncryptInit_ex(&ctx, NULL, NULL, key, iv)) {
fprintf(stderr, "Key/IV set failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(12);
}
if (an && !EVP_EncryptUpdate(&ctx, NULL, &outl, aad, an)) {
fprintf(stderr, "AAD set failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(13);
}
} else if (!EVP_EncryptInit_ex(&ctx, c, NULL, key, iv)) {
fprintf(stderr, "EncryptInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(10);
}
EVP_CIPHER_CTX_set_padding(&ctx, 0);
if (!EVP_EncryptUpdate(&ctx, out, &outl, plaintext, pn)) {
fprintf(stderr, "Encrypt failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(6);
}
if (!EVP_EncryptFinal_ex(&ctx, out + outl, &outl2)) {
fprintf(stderr, "EncryptFinal failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(7);
}
@ -213,7 +212,7 @@ static void test1(const EVP_CIPHER *c, const uint8_t *key, int kn,
*/
if (!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_GET_TAG, tn, rtag)) {
fprintf(stderr, "Get tag failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(14);
}
if (memcmp(rtag, tag, tn)) {
@ -229,45 +228,45 @@ static void test1(const EVP_CIPHER *c, const uint8_t *key, int kn,
if (mode == EVP_CIPH_GCM_MODE) {
if (!EVP_DecryptInit_ex(&ctx, c, NULL, NULL, NULL)) {
fprintf(stderr, "EncryptInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(10);
}
if (!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_IVLEN, in, NULL)) {
fprintf(stderr, "IV length set failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(11);
}
if (!EVP_DecryptInit_ex(&ctx, NULL, NULL, key, iv)) {
fprintf(stderr, "Key/IV set failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(12);
}
if (!EVP_CIPHER_CTX_ctrl(&ctx, EVP_CTRL_GCM_SET_TAG, tn, (void *)tag)) {
fprintf(stderr, "Set tag failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(14);
}
if (an && !EVP_DecryptUpdate(&ctx, NULL, &outl, aad, an)) {
fprintf(stderr, "AAD set failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(13);
}
} else if (!EVP_DecryptInit_ex(&ctx, c, NULL, key, iv)) {
fprintf(stderr, "DecryptInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(11);
}
EVP_CIPHER_CTX_set_padding(&ctx, 0);
if (!EVP_DecryptUpdate(&ctx, out, &outl, ciphertext, cn)) {
fprintf(stderr, "Decrypt failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(6);
}
outl2 = 0;
if (!EVP_DecryptFinal_ex(&ctx, out + outl, &outl2)) {
fprintf(stderr, "DecryptFinal failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
exit(7);
}

View File

@ -62,6 +62,7 @@
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/mem.h>
#include "internal.h"
@ -194,7 +195,7 @@ int main(int argc, char *argv[]) {
}
err:
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
if (abuf != NULL) {
OPENSSL_free(abuf);
@ -498,7 +499,7 @@ static int run_rfc5114_tests(void) {
bad_err:
fprintf(stderr, "Initalisation error RFC5114 set %d\n", i + 1);
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
err:
if (Z1 != NULL) {

View File

@ -15,7 +15,6 @@
#include <stdio.h>
#include <string.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/ec_key.h>
#include <openssl/err.h>
@ -44,7 +43,7 @@ int test_d2i_ECPrivateKey(void) {
if (key == NULL || inp != kECKeyWithoutPublic + sizeof(kECKeyWithoutPublic)) {
fprintf(stderr, "Failed to parse private key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
goto out;
}
@ -53,7 +52,7 @@ int test_d2i_ECPrivateKey(void) {
outp = out;
if (len != i2d_ECPrivateKey(key, &outp)) {
fprintf(stderr, "Failed to serialize private key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
goto out;
}

View File

@ -612,6 +612,17 @@ void ERR_print_errors_cb(ERR_print_errors_callback_t callback, void *ctx) {
}
}
static int print_errors_to_file(const char* msg, size_t msg_len, void* ctx) {
assert(msg[msg_len] == '\0');
FILE* fp = ctx;
int res = fputs(msg, fp);
return res < 0 ? 0 : 1;
}
void ERR_print_errors_fp(FILE *file) {
ERR_print_errors_cb(print_errors_to_file, file);
}
/* err_set_error_data sets the data on the most recent error. The |flags|
* argument is a combination of the |ERR_FLAG_*| values. */
static void err_set_error_data(char *data, int flags) {

View File

@ -18,7 +18,6 @@
#include <vector>
#include <openssl/bio.h>
#include <openssl/bytestring.h>
#include <openssl/crypto.h>
#include <openssl/digest.h>
@ -541,59 +540,59 @@ int main(void) {
if (!TestEVP_DigestSignInit()) {
fprintf(stderr, "EVP_DigestSignInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!TestEVP_DigestVerifyInit()) {
fprintf(stderr, "EVP_DigestVerifyInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!TestEVP_DigestSignAlgorithm()) {
fprintf(stderr, "EVP_DigestSignInit failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!TestEVP_DigestVerifyInitFromAlgorithm()) {
fprintf(stderr, "EVP_DigestVerifyInitFromAlgorithm failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!Testd2i_AutoPrivateKey(kExampleRSAKeyDER, sizeof(kExampleRSAKeyDER),
EVP_PKEY_RSA)) {
fprintf(stderr, "d2i_AutoPrivateKey(kExampleRSAKeyDER) failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!Testd2i_AutoPrivateKey(kExampleRSAKeyPKCS8, sizeof(kExampleRSAKeyPKCS8),
EVP_PKEY_RSA)) {
fprintf(stderr, "d2i_AutoPrivateKey(kExampleRSAKeyPKCS8) failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!Testd2i_AutoPrivateKey(kExampleECKeyDER, sizeof(kExampleECKeyDER),
EVP_PKEY_EC)) {
fprintf(stderr, "d2i_AutoPrivateKey(kExampleECKeyDER) failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!Testd2i_AutoPrivateKey(kExampleDSAKeyDER, sizeof(kExampleDSAKeyDER),
EVP_PKEY_DSA)) {
fprintf(stderr, "d2i_AutoPrivateKey(kExampleDSAKeyDER) failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (!TestEVP_PKCS82PKEY()) {
fprintf(stderr, "TestEVP_PKCS82PKEY failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}

View File

@ -46,7 +46,7 @@ static bool TestPBKDF2(const void *password, size_t password_len,
(const uint8_t *)salt, salt_len, iterations, digest,
key_len, key)) {
fprintf(stderr, "Call to PKCS5_PBKDF2_HMAC failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}

View File

@ -15,7 +15,6 @@
#include <stdio.h>
#include <string.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/digest.h>
#include <openssl/err.h>
@ -224,7 +223,7 @@ int main(void) {
if (!HKDF(buf, test->out_len, test->md_func(), test->ikm, test->ikm_len,
test->salt, test->salt_len, test->info, test->info_len)) {
fprintf(stderr, "Call to HKDF failed\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (memcmp(buf, test->out, test->out_len) != 0) {

View File

@ -690,7 +690,7 @@ static int test(const char *name, const uint8_t *der, size_t der_len) {
CBS_init(&pkcs12, der, der_len);
if (!PKCS12_get_key_and_certs(&key, certs, &pkcs12, "foo")) {
fprintf(stderr, "PKCS12 failed on %s data.\n", name);
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
@ -717,14 +717,14 @@ static int test_compat(const uint8_t *der, size_t der_len) {
p12 = d2i_PKCS12_bio(bio, NULL);
if (p12 == NULL) {
fprintf(stderr, "PKCS12_parse failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
BIO_free(bio);
if (!PKCS12_parse(p12, "foo", &key, &cert, &ca_certs)) {
fprintf(stderr, "PKCS12_parse failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}

View File

@ -58,7 +58,6 @@
#include <string.h>
#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
@ -249,13 +248,13 @@ static int test_bad_key(void) {
if (!RSA_generate_key_ex(key, 512, &e, NULL)) {
fprintf(stderr, "RSA_generate_key_ex failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
if (!BN_add(key->p, key->p, BN_value_one())) {
fprintf(stderr, "BN error.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
@ -292,19 +291,19 @@ static int test_only_d_given(void) {
if (!RSA_check_key(key)) {
fprintf(stderr, "RSA_check_key failed with only d given.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
goto err;
}
if (!RSA_sign(NID_md5, kDummyHash, sizeof(kDummyHash), buf, &buf_len, key)) {
fprintf(stderr, "RSA_sign failed with only d given.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
goto err;
}
if (!RSA_verify(NID_md5, kDummyHash, sizeof(kDummyHash), buf, buf_len, key)) {
fprintf(stderr, "RSA_verify failed with only d given.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
goto err;
}
@ -331,13 +330,13 @@ static int test_recover_crt_params(void) {
key1 = RSA_new();
if (!RSA_generate_key_ex(key1, 512, e, NULL)) {
fprintf(stderr, "RSA_generate_key_ex failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
if (!RSA_check_key(key1)) {
fprintf(stderr, "RSA_check_key failed with original key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
@ -349,7 +348,7 @@ static int test_recover_crt_params(void) {
if (!RSA_recover_crt_params(key2)) {
fprintf(stderr, "RSA_recover_crt_params failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
@ -359,21 +358,21 @@ static int test_recover_crt_params(void) {
if (!RSA_check_key(key2)) {
fprintf(stderr, "RSA_check_key failed with recovered key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
if (!RSA_sign(NID_md5, kDummyHash, sizeof(kDummyHash), buf, &buf_len,
key2)) {
fprintf(stderr, "RSA_sign failed with recovered key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}
if (!RSA_verify(NID_md5, kDummyHash, sizeof(kDummyHash), buf, buf_len,
key2)) {
fprintf(stderr, "RSA_verify failed with recovered key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 0;
}

View File

@ -62,6 +62,7 @@
#include <stdarg.h>
#include <stdio.h> /* For FILE */
#include <openssl/err.h> /* for ERR_print_errors_fp */
#include <openssl/ex_data.h>
#include <openssl/stack.h>
@ -331,10 +332,6 @@ OPENSSL_EXPORT int BIO_indent(BIO *bio, unsigned indent, unsigned max_indent);
OPENSSL_EXPORT int BIO_hexdump(BIO *bio, const uint8_t *data, size_t len,
unsigned indent);
/* BIO_print_errors_fp prints the current contents of the error stack to |out|
* using human readable strings where possible. */
OPENSSL_EXPORT void BIO_print_errors_fp(FILE *out);
/* BIO_print_errors prints the current contents of the error stack to |bio|
* using human readable strings where possible. */
OPENSSL_EXPORT void BIO_print_errors(BIO *bio);
@ -706,6 +703,14 @@ OPENSSL_EXPORT int BIO_zero_copy_get_write_buf_done(BIO* bio,
#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */
/* Android compatibility section.
*
* A previous version of BoringSSL used in Android renamed ERR_print_errors_fp
* to BIO_print_errors_fp. It has subsequently been renamed back to
* ERR_print_errors_fp. */
#define BIO_print_errors_fp ERR_print_errors_fp
/* Private functions */
#define BIO_FLAGS_READ 0x01

View File

@ -109,6 +109,8 @@
#ifndef OPENSSL_HEADER_ERR_H
#define OPENSSL_HEADER_ERR_H
#include <stdio.h>
#include <openssl/base.h>
#include <openssl/thread.h>
#include <openssl/lhash.h>
@ -251,6 +253,10 @@ OPENSSL_EXPORT void ERR_print_errors_cb(ERR_print_errors_callback_t callback,
void *ctx);
/* ERR_print_errors_fp prints the current contents of the error stack to |file|
* using human readable strings where possible. */
OPENSSL_EXPORT void ERR_print_errors_fp(FILE *file);
/* Clearing errors. */
/* ERR_clear_error clears the error queue for the current thread. */

View File

@ -486,7 +486,7 @@ int main(void) {
!TestDefaultVersion(DTLS1_VERSION, &DTLSv1_method) ||
!TestDefaultVersion(DTLS1_2_VERSION, &DTLSv1_2_method) ||
!TestCipherGetRFCName()) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}

View File

@ -37,6 +37,7 @@
#include <openssl/bio.h>
#include <openssl/buf.h>
#include <openssl/bytestring.h>
#include <openssl/err.h>
#include <openssl/ssl.h>
#include <memory>
@ -986,21 +987,21 @@ int main(int argc, char **argv) {
ScopedSSL_CTX ssl_ctx = SetupCtx(&config);
if (!ssl_ctx) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
ScopedSSL_SESSION session;
if (!DoExchange(&session, ssl_ctx.get(), &config, false /* is_resume */,
NULL /* session */)) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}
if (config.resume &&
!DoExchange(NULL, ssl_ctx.get(), &config, true /* is_resume */,
session.get())) {
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}

View File

@ -31,6 +31,7 @@
#endif
#include <openssl/bytestring.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/pkcs8.h>
#include <openssl/stack.h>
@ -123,7 +124,7 @@ bool DoPKCS12(const std::vector<std::string> &args) {
if (!PKCS12_get_key_and_certs(&key, certs, &pkcs12, password)) {
fprintf(stderr, "Failed to parse PKCS#12 data:\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}

View File

@ -22,8 +22,8 @@
#include <time.h>
#include <openssl/aead.h>
#include <openssl/bio.h>
#include <openssl/digest.h>
#include <openssl/err.h>
#include <openssl/obj.h>
#include <openssl/rsa.h>
@ -147,7 +147,7 @@ static bool SpeedRSA(const std::string& key_name, RSA *key) {
sig.get(), &sig_len, key);
})) {
fprintf(stderr, "RSA_sign failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
results.Print(key_name + " signing");
@ -158,7 +158,7 @@ static bool SpeedRSA(const std::string& key_name, RSA *key) {
sizeof(fake_sha256_hash), sig.get(), sig_len, key);
})) {
fprintf(stderr, "RSA_verify failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
results.Print(key_name + " verify");
@ -199,7 +199,7 @@ static bool SpeedAEADChunk(const EVP_AEAD *aead, const std::string &name,
EVP_AEAD_DEFAULT_TAG_LENGTH,
evp_aead_seal)) {
fprintf(stderr, "Failed to create EVP_AEAD_CTX.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
@ -213,7 +213,7 @@ static bool SpeedAEADChunk(const EVP_AEAD *aead, const std::string &name,
nonce_len, in, chunk_len, ad.get(), ad_len);
})) {
fprintf(stderr, "EVP_AEAD_CTX_seal failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
@ -250,7 +250,7 @@ static bool SpeedHashChunk(const EVP_MD *md, const std::string &name,
EVP_DigestFinal_ex(ctx, digest, &md_len);
})) {
fprintf(stderr, "EVP_DigestInit_ex failed.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
@ -273,7 +273,7 @@ bool Speed(const std::vector<std::string> &args) {
inp = kDERRSAPrivate2048;
if (NULL == d2i_RSAPrivateKey(&key, &inp, kDERRSAPrivate2048Len)) {
fprintf(stderr, "Failed to parse RSA key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return false;
}
@ -287,7 +287,7 @@ bool Speed(const std::vector<std::string> &args) {
inp = kDERRSAPrivate4096;
if (NULL == d2i_RSAPrivateKey(&key, &inp, kDERRSAPrivate4096Len)) {
fprintf(stderr, "Failed to parse 4096-bit RSA key.\n");
BIO_print_errors_fp(stderr);
ERR_print_errors_fp(stderr);
return 1;
}