fix a few more style issues
[openssl.git] / crypto / rsa / rsa_ameth.c
index 07002033fe5e45441658bfa517891d70b958be32..ae844eaf1f3238995afbda6de9a8aceaa109e03e 100644 (file)
@@ -44,11 +44,8 @@ static int rsa_param_encode(const EVP_PKEY *pkey,
         return 1;
     }
     /* Encode PSS parameters */
-    if (!ASN1_item_pack(rsa->pss, ASN1_ITEM_rptr(RSA_PSS_PARAMS), pstr)) {
-        ASN1_STRING_free(*pstr);
-        *pstr = NULL;
+    if (ASN1_item_pack(rsa->pss, ASN1_ITEM_rptr(RSA_PSS_PARAMS), pstr) == NULL)
         return 0;
-    }
 
     *pstrtype = V_ASN1_SEQUENCE;
     return 1;
@@ -400,6 +397,7 @@ static int rsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
     if (OBJ_obj2nid(sigalg->algorithm) == EVP_PKEY_RSA_PSS) {
         int rv;
         RSA_PSS_PARAMS *pss = rsa_pss_decode(sigalg);
+
         rv = rsa_pss_param_print(bp, 0, pss, indent);
         RSA_PSS_PARAMS_free(pss);
         if (!rv)
@@ -493,7 +491,7 @@ static int rsa_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md)
     /* need to embed algorithm ID inside another */
     if (!rsa_md_to_algor(&algtmp, mgf1md))
         goto err;
-    if (!ASN1_item_pack(algtmp, ASN1_ITEM_rptr(X509_ALGOR), &stmp))
+    if (ASN1_item_pack(algtmp, ASN1_ITEM_rptr(X509_ALGOR), &stmp) == NULL)
          goto err;
     *palg = X509_ALGOR_new();
     if (*palg == NULL)
@@ -578,15 +576,12 @@ RSA_PSS_PARAMS *rsa_pss_params_create(const EVP_MD *sigmd,
 static ASN1_STRING *rsa_ctx_to_pss_string(EVP_PKEY_CTX *pkctx)
 {
     RSA_PSS_PARAMS *pss = rsa_ctx_to_pss(pkctx);
-    ASN1_STRING *os = NULL;
+    ASN1_STRING *os;
 
     if (pss == NULL)
         return NULL;
 
-    if (!ASN1_item_pack(pss, ASN1_ITEM_rptr(RSA_PSS_PARAMS), &os)) {
-        ASN1_STRING_free(os);
-        os = NULL;
-    }
+    os = ASN1_item_pack(pss, ASN1_ITEM_rptr(RSA_PSS_PARAMS), NULL);
     RSA_PSS_PARAMS_free(pss);
     return os;
 }
@@ -665,8 +660,9 @@ int rsa_pss_get_param(const RSA_PSS_PARAMS *pss, const EVP_MD **pmd,
             RSAerr(RSA_F_RSA_PSS_GET_PARAM, RSA_R_INVALID_SALT_LENGTH);
             return 0;
         }
-    } else
+    } else {
         *psaltlen = 20;
+    }
 
     /*
      * low-level routines support only trailer field 0xbc (value 1) and