summaryrefslogtreecommitdiffstats
path: root/crypto/rsa
diff options
context:
space:
mode:
authorPaul Yang <yang.yang@baishancloud.com>2017-08-23 01:25:23 +0800
committerMatt Caswell <matt@openssl.org>2017-08-25 16:23:07 +0100
commit8686c474807d3c7bcb722294f39ac4e5627e9fa2 (patch)
tree315e084d02d6c83ec3d202b44a4fcfa09322932a /crypto/rsa
parentb5fe5dfbdaf8ee25e45c9a94736a1478a355e136 (diff)
Fix coding style in crypto/rsa directory
this part contains only the return (x) fix. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4223)
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa_crpt.c18
-rw-r--r--crypto/rsa/rsa_lib.c8
-rw-r--r--crypto/rsa/rsa_none.c12
-rw-r--r--crypto/rsa/rsa_ossl.c14
-rw-r--r--crypto/rsa/rsa_pk1.c26
-rw-r--r--crypto/rsa/rsa_prn.c6
-rw-r--r--crypto/rsa/rsa_saos.c12
-rw-r--r--crypto/rsa/rsa_ssl.c22
-rw-r--r--crypto/rsa/rsa_x931.c6
9 files changed, 62 insertions, 62 deletions
diff --git a/crypto/rsa/rsa_crpt.c b/crypto/rsa/rsa_crpt.c
index 2b676fd3dd..2db03421f6 100644
--- a/crypto/rsa/rsa_crpt.c
+++ b/crypto/rsa/rsa_crpt.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
@@ -17,41 +17,41 @@
int RSA_bits(const RSA *r)
{
- return (BN_num_bits(r->n));
+ return BN_num_bits(r->n);
}
int RSA_size(const RSA *r)
{
- return (BN_num_bytes(r->n));
+ return BN_num_bytes(r->n);
}
int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
- return (rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding));
+ return rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding);
}
int RSA_private_encrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
- return (rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
+ return rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding);
}
int RSA_private_decrypt(int flen, const unsigned char *from,
unsigned char *to, RSA *rsa, int padding)
{
- return (rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding));
+ return rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding);
}
int RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
- return (rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding));
+ return rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding);
}
int RSA_flags(const RSA *r)
{
- return ((r == NULL) ? 0 : r->meth->flags);
+ return r == NULL ? 0 : r->meth->flags;
}
void RSA_blinding_off(RSA *rsa)
@@ -77,7 +77,7 @@ int RSA_blinding_on(RSA *rsa, BN_CTX *ctx)
rsa->flags &= ~RSA_FLAG_NO_BLINDING;
ret = 1;
err:
- return (ret);
+ return ret;
}
static BIGNUM *rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p,
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index 3c2354bbb4..d5ecd26ce6 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.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
@@ -148,17 +148,17 @@ int RSA_up_ref(RSA *r)
REF_PRINT_COUNT("RSA", r);
REF_ASSERT_ISNT(i < 2);
- return ((i > 1) ? 1 : 0);
+ return i > 1 ? 1 : 0;
}
int RSA_set_ex_data(RSA *r, int idx, void *arg)
{
- return (CRYPTO_set_ex_data(&r->ex_data, idx, arg));
+ return CRYPTO_set_ex_data(&r->ex_data, idx, arg);
}
void *RSA_get_ex_data(const RSA *r, int idx)
{
- return (CRYPTO_get_ex_data(&r->ex_data, idx));
+ return CRYPTO_get_ex_data(&r->ex_data, idx);
}
int RSA_security_bits(const RSA *rsa)
diff --git a/crypto/rsa/rsa_none.c b/crypto/rsa/rsa_none.c
index b78756d186..f16cc67066 100644
--- a/crypto/rsa/rsa_none.c
+++ b/crypto/rsa/rsa_none.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
@@ -16,16 +16,16 @@ int RSA_padding_add_none(unsigned char *to, int tlen,
{
if (flen > tlen) {
RSAerr(RSA_F_RSA_PADDING_ADD_NONE, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
- return (0);
+ return 0;
}
if (flen < tlen) {
RSAerr(RSA_F_RSA_PADDING_ADD_NONE, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE);
- return (0);
+ return 0;
}
memcpy(to, from, (unsigned int)flen);
- return (1);
+ return 1;
}
int RSA_padding_check_none(unsigned char *to, int tlen,
@@ -34,10 +34,10 @@ int RSA_padding_check_none(unsigned char *to, int tlen,
if (flen > tlen) {
RSAerr(RSA_F_RSA_PADDING_CHECK_NONE, RSA_R_DATA_TOO_LARGE);
- return (-1);
+ return -1;
}
memset(to, 0, tlen - flen);
memcpy(to + tlen - flen, from, flen);
- return (tlen);
+ return tlen;
}
diff --git a/crypto/rsa/rsa_ossl.c b/crypto/rsa/rsa_ossl.c
index c4feb9d6d3..6199b4ffdf 100644
--- a/crypto/rsa/rsa_ossl.c
+++ b/crypto/rsa/rsa_ossl.c
@@ -155,7 +155,7 @@ static int rsa_ossl_public_encrypt(int flen, const unsigned char *from,
BN_CTX_end(ctx);
BN_CTX_free(ctx);
OPENSSL_clear_free(buf, num);
- return (r);
+ return r;
}
static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx)
@@ -365,7 +365,7 @@ static int rsa_ossl_private_encrypt(int flen, const unsigned char *from,
BN_CTX_end(ctx);
BN_CTX_free(ctx);
OPENSSL_clear_free(buf, num);
- return (r);
+ return r;
}
static int rsa_ossl_private_decrypt(int flen, const unsigned char *from,
@@ -496,7 +496,7 @@ static int rsa_ossl_private_decrypt(int flen, const unsigned char *from,
BN_CTX_end(ctx);
BN_CTX_free(ctx);
OPENSSL_clear_free(buf, num);
- return (r);
+ return r;
}
/* signature verification */
@@ -595,7 +595,7 @@ static int rsa_ossl_public_decrypt(int flen, const unsigned char *from,
BN_CTX_end(ctx);
BN_CTX_free(ctx);
OPENSSL_clear_free(buf, num);
- return (r);
+ return r;
}
static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
@@ -787,13 +787,13 @@ static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
ret = 1;
err:
BN_CTX_end(ctx);
- return (ret);
+ return ret;
}
static int rsa_ossl_init(RSA *rsa)
{
rsa->flags |= RSA_FLAG_CACHE_PUBLIC | RSA_FLAG_CACHE_PRIVATE;
- return (1);
+ return 1;
}
static int rsa_ossl_finish(RSA *rsa)
@@ -801,5 +801,5 @@ static int rsa_ossl_finish(RSA *rsa)
BN_MONT_CTX_free(rsa->_method_mod_n);
BN_MONT_CTX_free(rsa->_method_mod_p);
BN_MONT_CTX_free(rsa->_method_mod_q);
- return (1);
+ return 1;
}
diff --git a/crypto/rsa/rsa_pk1.c b/crypto/rsa/rsa_pk1.c
index aeeb32c2dc..7d453ff989 100644
--- a/crypto/rsa/rsa_pk1.c
+++ b/crypto/rsa/rsa_pk1.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
@@ -24,7 +24,7 @@ int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
if (flen > (tlen - RSA_PKCS1_PADDING_SIZE)) {
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1,
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
- return (0);
+ return 0;
}
p = (unsigned char *)to;
@@ -38,7 +38,7 @@ int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
p += j;
*(p++) = '\0';
memcpy(p, from, (unsigned int)flen);
- return (1);
+ return 1;
}
int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
@@ -73,7 +73,7 @@ int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
if ((num != (flen + 1)) || (*(p++) != 0x01)) {
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
RSA_R_BLOCK_TYPE_IS_NOT_01);
- return (-1);
+ return -1;
}
/* scan over padding data */
@@ -86,7 +86,7 @@ int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
} else {
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
RSA_R_BAD_FIXED_HEADER_DECRYPT);
- return (-1);
+ return -1;
}
}
p++;
@@ -95,23 +95,23 @@ int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
if (i == j) {
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
RSA_R_NULL_BEFORE_BLOCK_MISSING);
- return (-1);
+ return -1;
}
if (i < 8) {
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
RSA_R_BAD_PAD_BYTE_COUNT);
- return (-1);
+ return -1;
}
i++; /* Skip over the '\0' */
j -= i;
if (j > tlen) {
RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1, RSA_R_DATA_TOO_LARGE);
- return (-1);
+ return -1;
}
memcpy(to, p, (unsigned int)j);
- return (j);
+ return j;
}
int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
@@ -123,7 +123,7 @@ int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
if (flen > (tlen - 11)) {
RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2,
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
- return (0);
+ return 0;
}
p = (unsigned char *)to;
@@ -135,12 +135,12 @@ int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
j = tlen - 3 - flen;
if (RAND_bytes(p, j) <= 0)
- return (0);
+ return 0;
for (i = 0; i < j; i++) {
if (*p == '\0')
do {
if (RAND_bytes(p, 1) <= 0)
- return (0);
+ return 0;
} while (*p == '\0');
p++;
}
@@ -148,7 +148,7 @@ int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
*(p++) = '\0';
memcpy(p, from, (unsigned int)flen);
- return (1);
+ return 1;
}
int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
diff --git a/crypto/rsa/rsa_prn.c b/crypto/rsa/rsa_prn.c
index 5e6c599e46..b5f4bce2a3 100644
--- a/crypto/rsa/rsa_prn.c
+++ b/crypto/rsa/rsa_prn.c
@@ -1,5 +1,5 @@
/*
- * 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
@@ -20,12 +20,12 @@ int RSA_print_fp(FILE *fp, const RSA *x, int off)
if ((b = BIO_new(BIO_s_file())) == NULL) {
RSAerr(RSA_F_RSA_PRINT_FP, ERR_R_BUF_LIB);
- return (0);
+ return 0;
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
ret = RSA_print(b, x, off);
BIO_free(b);
- return (ret);
+ return ret;
}
#endif
diff --git a/crypto/rsa/rsa_saos.c b/crypto/rsa/rsa_saos.c
index 9e5fff450b..89d86f069e 100644
--- a/crypto/rsa/rsa_saos.c
+++ b/crypto/rsa/rsa_saos.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
@@ -32,12 +32,12 @@ int RSA_sign_ASN1_OCTET_STRING(int type,
if (i > (j - RSA_PKCS1_PADDING_SIZE)) {
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,
RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
- return (0);
+ return 0;
}
s = OPENSSL_malloc((unsigned int)j + 1);
if (s == NULL) {
RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE);
- return (0);
+ return 0;
}
p = s;
i2d_ASN1_OCTET_STRING(&sig, &p);
@@ -48,7 +48,7 @@ int RSA_sign_ASN1_OCTET_STRING(int type,
*siglen = i;
OPENSSL_clear_free(s, (unsigned int)j + 1);
- return (ret);
+ return ret;
}
int RSA_verify_ASN1_OCTET_STRING(int dtype,
@@ -64,7 +64,7 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype,
if (siglen != (unsigned int)RSA_size(rsa)) {
RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,
RSA_R_WRONG_SIGNATURE_LENGTH);
- return (0);
+ return 0;
}
s = OPENSSL_malloc((unsigned int)siglen);
@@ -90,5 +90,5 @@ int RSA_verify_ASN1_OCTET_STRING(int dtype,
err:
ASN1_OCTET_STRING_free(sig);
OPENSSL_clear_free(s, (unsigned int)siglen);
- return (ret);
+ return ret;
}
diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c
index 9ef6b80ea8..cd98584be5 100644
--- a/crypto/rsa/rsa_ssl.c
+++ b/crypto/rsa/rsa_ssl.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
@@ -22,7 +22,7 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
if (flen > (tlen - 11)) {
RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23,
RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
- return (0);
+ return 0;
}
p = (unsigned char *)to;
@@ -34,12 +34,12 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
j = tlen - 3 - 8 - flen;
if (RAND_bytes(p, j) <= 0)
- return (0);
+ return 0;
for (i = 0; i < j; i++) {
if (*p == '\0')
do {
if (RAND_bytes(p, 1) <= 0)
- return (0);
+ return 0;
} while (*p == '\0');
p++;
}
@@ -49,7 +49,7 @@ int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
*(p++) = '\0';
memcpy(p, from, (unsigned int)flen);
- return (1);
+ return 1;
}
int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
@@ -61,11 +61,11 @@ int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
p = from;
if (flen < 10) {
RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_SMALL);
- return (-1);
+ return -1;
}
if ((num != (flen + 1)) || (*(p++) != 02)) {
RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_BLOCK_TYPE_IS_NOT_02);
- return (-1);
+ return -1;
}
/* scan over padding data */
@@ -77,7 +77,7 @@ int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
if ((i == j) || (i < 8)) {
RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,
RSA_R_NULL_BEFORE_BLOCK_MISSING);
- return (-1);
+ return -1;
}
for (k = -9; k < -1; k++) {
if (p[k] != 0x03)
@@ -85,16 +85,16 @@ int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
}
if (k == -1) {
RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_SSLV3_ROLLBACK_ATTACK);
- return (-1);
+ return -1;
}
i++; /* Skip over the '\0' */
j -= i;
if (j > tlen) {
RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_LARGE);
- return (-1);
+ return -1;
}
memcpy(to, p, (unsigned int)j);
- return (j);
+ return j;
}
diff --git a/crypto/rsa/rsa_x931.c b/crypto/rsa/rsa_x931.c
index b9301f3725..4b2ed37cac 100644
--- a/crypto/rsa/rsa_x931.c
+++ b/crypto/rsa/rsa_x931.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2005-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
@@ -47,7 +47,7 @@ int RSA_padding_add_X931(unsigned char *to, int tlen,
memcpy(p, from, (unsigned int)flen);
p += flen;
*p = 0xCC;
- return (1);
+ return 1;
}
int RSA_padding_check_X931(unsigned char *to, int tlen,
@@ -91,7 +91,7 @@ int RSA_padding_check_X931(unsigned char *to, int tlen,
memcpy(to, p, (unsigned int)j);
- return (j);
+ return j;
}
/* Translate between X931 hash ids and NIDs */