diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bn/bn_ctx.c | 22 | ||||
-rw-r--r-- | crypto/bn/bn_err.c | 3 | ||||
-rw-r--r-- | crypto/err/openssl.txt | 1 |
3 files changed, 20 insertions, 6 deletions
diff --git a/crypto/bn/bn_ctx.c b/crypto/bn/bn_ctx.c index 62e29b5dcc..4857661d2d 100644 --- a/crypto/bn/bn_ctx.c +++ b/crypto/bn/bn_ctx.c @@ -86,6 +86,8 @@ struct bignum_ctx { int too_many; /* Flags. */ int flags; + /* The library context */ + OPENSSL_CTX *libctx; }; /* Debugging functionality */ @@ -121,30 +123,40 @@ static void ctxdbg(BIO *channel, const char *text, BN_CTX *ctx) ctxdbg(trc_out, str, ctx); \ } OSSL_TRACE_END(BN_CTX) - -BN_CTX *BN_CTX_new(void) +BN_CTX *BN_CTX_new_ex(OPENSSL_CTX *ctx) { BN_CTX *ret; if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { - BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); + BNerr(BN_F_BN_CTX_NEW_EX, ERR_R_MALLOC_FAILURE); return NULL; } /* Initialise the structure */ BN_POOL_init(&ret->pool); BN_STACK_init(&ret->stack); + ret->libctx = ctx; return ret; } -BN_CTX *BN_CTX_secure_new(void) +BN_CTX *BN_CTX_new(void) { - BN_CTX *ret = BN_CTX_new(); + return BN_CTX_new_ex(NULL); +} + +BN_CTX *BN_CTX_secure_new_ex(OPENSSL_CTX *ctx) +{ + BN_CTX *ret = BN_CTX_new_ex(ctx); if (ret != NULL) ret->flags = BN_FLG_SECURE; return ret; } +BN_CTX *BN_CTX_secure_new(void) +{ + return BN_CTX_secure_new_ex(NULL); +} + void BN_CTX_free(BN_CTX *ctx) { if (ctx == NULL) diff --git a/crypto/bn/bn_err.c b/crypto/bn/bn_err.c index b988646f22..5ca6a1f34f 100644 --- a/crypto/bn/bn_err.c +++ b/crypto/bn/bn_err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -29,6 +29,7 @@ static const ERR_STRING_DATA BN_str_functs[] = { {ERR_PACK(ERR_LIB_BN, BN_F_BN_COMPUTE_WNAF, 0), "bn_compute_wNAF"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_CTX_GET, 0), "BN_CTX_get"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_CTX_NEW, 0), "BN_CTX_new"}, + {ERR_PACK(ERR_LIB_BN, BN_F_BN_CTX_NEW_EX, 0), "BN_CTX_new_ex"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_CTX_START, 0), "BN_CTX_start"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_DIV, 0), "BN_div"}, {ERR_PACK(ERR_LIB_BN, BN_F_BN_DIV_RECP, 0), "BN_div_recp"}, diff --git a/crypto/err/openssl.txt b/crypto/err/openssl.txt index 58e1b940cd..a8a632f025 100644 --- a/crypto/err/openssl.txt +++ b/crypto/err/openssl.txt @@ -196,6 +196,7 @@ BN_F_BN_BN2HEX:105:BN_bn2hex BN_F_BN_COMPUTE_WNAF:142:bn_compute_wNAF BN_F_BN_CTX_GET:116:BN_CTX_get BN_F_BN_CTX_NEW:106:BN_CTX_new +BN_F_BN_CTX_NEW_EX:151:BN_CTX_new_ex BN_F_BN_CTX_START:129:BN_CTX_start BN_F_BN_DIV:107:BN_div BN_F_BN_DIV_RECP:130:BN_div_recp |