The branch master has been updated
       via  93e43f4c47ea3ec3b916c0a7fcd4912f47460416 (commit)
      from  63ae8476796510c15163c9bd18998ccef6c1de16 (commit)


- Log -----------------------------------------------------------------
commit 93e43f4c47ea3ec3b916c0a7fcd4912f47460416
Author: Benjamin Kaduk <[email protected]>
Date:   Thu Feb 11 15:52:54 2021 -0800

    RSA: avoid dereferencing possibly-NULL parameter in initializers
    
    Fix CID 1472835: the explicit NULL check for prsactx is useless when
    we have already dereferenced it in the initializers.
    
    Move the actual initialization to the function body to get the
    logic sequenced properly.
    
    Reviewed-by: Paul Dale <[email protected]>
    Reviewed-by: Shane Lontis <[email protected]>
    (Merged from https://github.com/openssl/openssl/pull/14160)

-----------------------------------------------------------------------

Summary of changes:
 providers/implementations/signature/rsa.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/providers/implementations/signature/rsa.c 
b/providers/implementations/signature/rsa.c
index 98e3a2d1f4..4cdd90a5c6 100644
--- a/providers/implementations/signature/rsa.c
+++ b/providers/implementations/signature/rsa.c
@@ -1107,8 +1107,8 @@ static int rsa_set_ctx_params(void *vprsactx, const 
OSSL_PARAM params[])
 {
     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
     const OSSL_PARAM *p;
-    int pad_mode = prsactx->pad_mode;
-    int saltlen = prsactx->saltlen;
+    int pad_mode;
+    int saltlen;
     char mdname[OSSL_MAX_NAME_SIZE] = "", *pmdname = NULL;
     char mdprops[OSSL_MAX_PROPQUERY_SIZE] = "", *pmdprops = NULL;
     char mgf1mdname[OSSL_MAX_NAME_SIZE] = "", *pmgf1mdname = NULL;
@@ -1116,6 +1116,8 @@ static int rsa_set_ctx_params(void *vprsactx, const 
OSSL_PARAM params[])
 
     if (prsactx == NULL || params == NULL)
         return 0;
+    pad_mode = prsactx->pad_mode;
+    saltlen = prsactx->saltlen;
 
     p = OSSL_PARAM_locate_const(params, OSSL_SIGNATURE_PARAM_DIGEST);
     /* Not allowed during certain operations */

Reply via email to