summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2019-10-31 13:05:09 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2019-10-31 13:05:09 +0000
commit6fcfe21e88bb07d98ef188047a59f1087706ee19 (patch)
tree2620301a030e08351f8ccbb3181e54dee59a3cd2
parentcc2da8d4a196cdacd136b85ca587d789b7187613 (diff)
Use braces where a statement has both multi-line and single-line blocks.
Makes code more robust and reduces differences with OpenSSL. ok inoguchi@
-rw-r--r--lib/libcrypto/rsa/rsa_pmeth.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/libcrypto/rsa/rsa_pmeth.c b/lib/libcrypto/rsa/rsa_pmeth.c
index 91e64fe500d..9d2cc86112b 100644
--- a/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/lib/libcrypto/rsa/rsa_pmeth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_pmeth.c,v 1.27 2019/10/31 13:02:49 jsing Exp $ */
+/* $OpenBSD: rsa_pmeth.c,v 1.28 2019/10/31 13:05:08 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -215,11 +215,13 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
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;
@@ -261,11 +263,13 @@ pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen,
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;
@@ -306,8 +310,9 @@ pkey_rsa_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,
if (ret <= 0)
return 0;
return 1;
- } else
+ } else {
return -1;
+ }
} else {
if (!setup_tbuf(rctx, ctx))
return -1;
@@ -439,9 +444,9 @@ bad_pad:
RSAerror(RSA_R_INVALID_PSS_SALTLEN);
return -2;
}
- if (type == EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN)
+ if (type == EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN) {
*(int *)p2 = rctx->saltlen;
- else {
+ } else {
if (p1 < -2)
return -2;
rctx->saltlen = p1;