summaryrefslogtreecommitdiff
path: root/crypto/bn/bn_div.c
diff options
context:
space:
mode:
authorPaul Yang <paulyang.inf@gmail.com>2017-06-22 18:52:29 +0800
committerBernd Edlinger <bernd.edlinger@hotmail.de>2017-06-26 15:40:16 +0200
commitedea42c602854c902b7909a150cd2412d7b8f215 (patch)
treeb0e97a08a199df553af3dd0f6144dda7d77538e5 /crypto/bn/bn_div.c
parent9e1d5e8dff693cb2b658f66db4f10709d8364690 (diff)
downloadopenssl-new-edea42c602854c902b7909a150cd2412d7b8f215.tar.gz
Change to check last return value of BN_CTX_get
To make it consistent in the code base Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/3749)
Diffstat (limited to 'crypto/bn/bn_div.c')
-rw-r--r--crypto/bn/bn_div.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/bn/bn_div.c b/crypto/bn/bn_div.c
index 5e620b2096..bd49e07dbc 100644
--- a/crypto/bn/bn_div.c
+++ b/crypto/bn/bn_div.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -191,14 +191,11 @@ int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
}
BN_CTX_start(ctx);
+ res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
tmp = BN_CTX_get(ctx);
snum = BN_CTX_get(ctx);
sdiv = BN_CTX_get(ctx);
- if (dv == NULL)
- res = BN_CTX_get(ctx);
- else
- res = dv;
- if (sdiv == NULL || res == NULL || tmp == NULL || snum == NULL)
+ if (sdiv == NULL)
goto err;
/* First we normalise the numbers */