Commit 90862ab4 authored by Paul Yang's avatar Paul Yang Committed by Matt Caswell
Browse files

This part fixes braces around if-else.

parent 8686c474
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
/*
 * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
 * Copyright 2006-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
@@ -250,8 +250,9 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss,
    if (pss->hashAlgorithm) {
        if (i2a_ASN1_OBJECT(bp, pss->hashAlgorithm->algorithm) <= 0)
            goto err;
    } else if (BIO_puts(bp, "sha1 (default)") <= 0)
    } else if (BIO_puts(bp, "sha1 (default)") <= 0) {
        goto err;
    }

    if (BIO_puts(bp, "\n") <= 0)
        goto err;
@@ -270,10 +271,12 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss,
        if (maskHash != NULL) {
            if (i2a_ASN1_OBJECT(bp, maskHash->algorithm) <= 0)
                goto err;
        } else if (BIO_puts(bp, "INVALID") <= 0)
        } else if (BIO_puts(bp, "INVALID") <= 0) {
            goto err;
    } else if (BIO_puts(bp, "mgf1 with sha1 (default)") <= 0)
        }
    } else if (BIO_puts(bp, "mgf1 with sha1 (default)") <= 0) {
        goto err;
    }
    BIO_puts(bp, "\n");

    if (!BIO_indent(bp, indent, 128))
@@ -283,8 +286,9 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss,
    if (pss->saltLength) {
        if (i2a_ASN1_INTEGER(bp, pss->saltLength) <= 0)
            goto err;
    } else if (BIO_puts(bp, "14 (default)") <= 0)
    } else if (BIO_puts(bp, "14 (default)") <= 0) {
        goto err;
    }
    BIO_puts(bp, "\n");

    if (!BIO_indent(bp, indent, 128))
@@ -294,8 +298,9 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss,
    if (pss->trailerField) {
        if (i2a_ASN1_INTEGER(bp, pss->trailerField) <= 0)
            goto err;
    } else if (BIO_puts(bp, "BC (default)") <= 0)
    } else if (BIO_puts(bp, "BC (default)") <= 0) {
        goto err;
    }
    BIO_puts(bp, "\n");

    rv = 1;
@@ -536,9 +541,9 @@ static RSA_PSS_PARAMS *rsa_ctx_to_pss(EVP_PKEY_CTX *pkctx)
        return NULL;
    if (!EVP_PKEY_CTX_get_rsa_pss_saltlen(pkctx, &saltlen))
        return NULL;
    if (saltlen == -1)
    if (saltlen == -1) {
        saltlen = EVP_MD_size(sigmd);
    else if (saltlen == -2) {
    } else if (saltlen == -2) {
        saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2;
        if ((EVP_PKEY_bits(pk) & 0x7) == 1)
            saltlen--;
+4 −2
Original line number Diff line number Diff line
@@ -117,8 +117,9 @@ BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
    if (in_ctx == NULL) {
        if ((ctx = BN_CTX_new()) == NULL)
            return 0;
    } else
    } else {
        ctx = in_ctx;
    }

    BN_CTX_start(ctx);
    e = BN_CTX_get(ctx);
@@ -133,8 +134,9 @@ BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
            RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);
            goto err;
        }
    } else
    } else {
        e = rsa->e;
    }

    {
        BIGNUM *n = BN_new();
+2 −1
Original line number Diff line number Diff line
@@ -73,8 +73,9 @@ RSA *RSA_new_method(ENGINE *engine)
            goto err;
        }
        ret->engine = engine;
    } else
    } else {
        ret->engine = ENGINE_get_default_RSA();
    }
    if (ret->engine) {
        ret->meth = ENGINE_get_RSA(ret->engine);
        if (ret->meth == NULL) {
+4 −3
Original line number Diff line number Diff line
@@ -200,12 +200,12 @@ static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx)
static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind,
                                BN_CTX *ctx)
{
    if (unblind == NULL)
    if (unblind == NULL) {
        /*
         * Local blinding: store the unblinding factor in BN_BLINDING.
         */
        return BN_BLINDING_convert_ex(f, NULL, b, ctx);
    else {
    } else {
        /*
         * Shared blinding: store the unblinding factor outside BN_BLINDING.
         */
@@ -347,8 +347,9 @@ static int rsa_ossl_private_encrypt(int flen, const unsigned char *from,
            res = f;
        else
            res = ret;
    } else
    } else {
        res = ret;
    }

    /*
     * put in leading 0 bytes if the number is less than the length of the
+25 −17
Original line number Diff line number Diff line
/*
 * Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
 * Copyright 2006-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
@@ -170,11 +170,13 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig,
                return -1;
            ret = RSA_private_encrypt(RSA_size(rsa), rctx->tbuf,
                                      sig, rsa, RSA_NO_PADDING);
        } else
        } else {
            return -1;
    } else
        }
    } else {
        ret = RSA_private_encrypt(tbslen, tbs, sig, ctx->pkey->pkey.rsa,
                                  rctx->pad_mode);
    }
    if (ret < 0)
        return ret;
    *siglen = ret;
@@ -218,11 +220,13 @@ static int pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx,
            if (ret <= 0)
                return 0;
            ret = sltmp;
        } else
        } else {
            return -1;
    } else
        }
    } else {
        ret = RSA_public_decrypt(siglen, sig, rout, ctx->pkey->pkey.rsa,
                                 rctx->pad_mode);
    }
    if (ret < 0)
        return ret;
    *routlen = ret;
@@ -262,8 +266,9 @@ static int pkey_rsa_verify(EVP_PKEY_CTX *ctx,
            if (ret <= 0)
                return 0;
            return 1;
        } else
        } else {
            return -1;
        }
    } else {
        if (!setup_tbuf(rctx, ctx))
            return -1;
@@ -299,9 +304,10 @@ static int pkey_rsa_encrypt(EVP_PKEY_CTX *ctx,
            return -1;
        ret = RSA_public_encrypt(klen, rctx->tbuf, out,
                                 ctx->pkey->pkey.rsa, RSA_NO_PADDING);
    } else
    } else {
        ret = RSA_public_encrypt(inlen, in, out, ctx->pkey->pkey.rsa,
                                 rctx->pad_mode);
    }
    if (ret < 0)
        return ret;
    *outlen = ret;
@@ -327,9 +333,10 @@ static int pkey_rsa_decrypt(EVP_PKEY_CTX *ctx,
                                                rctx->oaep_label,
                                                rctx->oaep_labellen,
                                                rctx->md, rctx->mgf1md);
    } else
    } else {
        ret = RSA_private_decrypt(inlen, in, out, ctx->pkey->pkey.rsa,
                                  rctx->pad_mode);
    }
    if (ret < 0)
        return ret;
    *outlen = ret;
@@ -572,21 +579,21 @@ static int pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx,
    }
    if (strcmp(type, "rsa_padding_mode") == 0) {
        int pm;
        if (strcmp(value, "pkcs1") == 0)
        if (strcmp(value, "pkcs1") == 0) {
            pm = RSA_PKCS1_PADDING;
        else if (strcmp(value, "sslv23") == 0)
        } else if (strcmp(value, "sslv23") == 0) {
            pm = RSA_SSLV23_PADDING;
        else if (strcmp(value, "none") == 0)
        } else if (strcmp(value, "none") == 0) {
            pm = RSA_NO_PADDING;
        else if (strcmp(value, "oeap") == 0)
        } else if (strcmp(value, "oeap") == 0) {
            pm = RSA_PKCS1_OAEP_PADDING;
        else if (strcmp(value, "oaep") == 0)
        } else if (strcmp(value, "oaep") == 0) {
            pm = RSA_PKCS1_OAEP_PADDING;
        else if (strcmp(value, "x931") == 0)
        } else if (strcmp(value, "x931") == 0) {
            pm = RSA_X931_PADDING;
        else if (strcmp(value, "pss") == 0)
        } else if (strcmp(value, "pss") == 0) {
            pm = RSA_PKCS1_PSS_PADDING;
        else {
        } else {
            RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_UNKNOWN_PADDING_TYPE);
            return -2;
        }
@@ -704,8 +711,9 @@ static int pkey_rsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
            return 0;
        }
        evp_pkey_set_cb_translate(pcb, ctx);
    } else
    } else {
        pcb = NULL;
    }
    ret = RSA_generate_key_ex(rsa, rctx->nbits, rctx->pub_exp, pcb);
    BN_GENCB_free(pcb);
    if (ret > 0 && !rsa_set_pss_param(rsa, ctx)) {
Loading