Remove unnecessary type casts in crypto/rsa.

Change-Id: I0b5c661674fbcaf6b4d5b0ce7944459cd45606b1
Reviewed-on: https://boringssl-review.googlesource.com/7466
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
Brian Smith 2016-03-15 13:00:49 -10:00 committed by David Benjamin
parent 6f7374b0ed
commit 9aa1562843
2 changed files with 5 additions and 7 deletions

View File

@ -134,7 +134,7 @@ static BN_BLINDING *bn_blinding_create_param(BN_BLINDING *b, const BIGNUM *e,
BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) { BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod) {
BN_BLINDING *ret = NULL; BN_BLINDING *ret = NULL;
ret = (BN_BLINDING*) OPENSSL_malloc(sizeof(BN_BLINDING)); ret = OPENSSL_malloc(sizeof(BN_BLINDING));
if (ret == NULL) { if (ret == NULL) {
OPENSSL_PUT_ERROR(RSA, ERR_R_MALLOC_FAILURE); OPENSSL_PUT_ERROR(RSA, ERR_R_MALLOC_FAILURE);
return NULL; return NULL;

View File

@ -74,7 +74,6 @@
int RSA_padding_add_PKCS1_type_1(uint8_t *to, unsigned to_len, int RSA_padding_add_PKCS1_type_1(uint8_t *to, unsigned to_len,
const uint8_t *from, unsigned from_len) { const uint8_t *from, unsigned from_len) {
unsigned j; unsigned j;
uint8_t *p;
if (to_len < RSA_PKCS1_PADDING_SIZE) { if (to_len < RSA_PKCS1_PADDING_SIZE) {
OPENSSL_PUT_ERROR(RSA, RSA_R_KEY_SIZE_TOO_SMALL); OPENSSL_PUT_ERROR(RSA, RSA_R_KEY_SIZE_TOO_SMALL);
@ -86,7 +85,7 @@ int RSA_padding_add_PKCS1_type_1(uint8_t *to, unsigned to_len,
return 0; return 0;
} }
p = (uint8_t *)to; uint8_t *p = to;
*(p++) = 0; *(p++) = 0;
*(p++) = 1; /* Private Key BT (Block Type) */ *(p++) = 1; /* Private Key BT (Block Type) */
@ -155,7 +154,6 @@ int RSA_padding_check_PKCS1_type_1(uint8_t *to, unsigned to_len,
int RSA_padding_add_PKCS1_type_2(uint8_t *to, unsigned to_len, int RSA_padding_add_PKCS1_type_2(uint8_t *to, unsigned to_len,
const uint8_t *from, unsigned from_len) { const uint8_t *from, unsigned from_len) {
unsigned i, j; unsigned i, j;
uint8_t *p;
if (to_len < RSA_PKCS1_PADDING_SIZE) { if (to_len < RSA_PKCS1_PADDING_SIZE) {
OPENSSL_PUT_ERROR(RSA, RSA_R_KEY_SIZE_TOO_SMALL); OPENSSL_PUT_ERROR(RSA, RSA_R_KEY_SIZE_TOO_SMALL);
@ -167,7 +165,7 @@ int RSA_padding_add_PKCS1_type_2(uint8_t *to, unsigned to_len,
return 0; return 0;
} }
p = (unsigned char *)to; uint8_t *p = to;
*(p++) = 0; *(p++) = 0;
*(p++) = 2; /* Public Key BT (Block Type) */ *(p++) = 2; /* Public Key BT (Block Type) */
@ -358,7 +356,7 @@ int RSA_padding_add_PKCS1_OAEP_mgf1(uint8_t *to, unsigned to_len,
seed = to + 1; seed = to + 1;
db = to + mdlen + 1; db = to + mdlen + 1;
if (!EVP_Digest((void *)param, param_len, db, NULL, md, NULL)) { if (!EVP_Digest(param, param_len, db, NULL, md, NULL)) {
return 0; return 0;
} }
memset(db + mdlen, 0, emlen - from_len - 2 * mdlen - 1); memset(db + mdlen, 0, emlen - from_len - 2 * mdlen - 1);
@ -444,7 +442,7 @@ int RSA_padding_check_PKCS1_OAEP_mgf1(uint8_t *to, unsigned to_len,
db[i] ^= maskeddb[i]; db[i] ^= maskeddb[i];
} }
if (!EVP_Digest((void *)param, param_len, phash, NULL, md, NULL)) { if (!EVP_Digest(param, param_len, phash, NULL, md, NULL)) {
goto err; goto err;
} }