Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/pk/rsa/rsa_exptmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
@param key The RSA key to use
@return CRYPT_OK if successful
*/
int rsa_exptmod(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen, int which,
int rsa_exptmod(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen, int which,
const rsa_key *key)
{
void *tmp, *tmpa, *tmpb;
Expand Down Expand Up @@ -79,13 +79,13 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen,
}

/* rnd = rnd^e */
err = ltc_mp_exptmod( rnd, key->e, key->N, rnd);
err = ltc_mp_exptmod(rnd, key->e, key->N, rnd);
if (err != CRYPT_OK) {
goto error;
}

/* tmp = tmp*rnd mod N */
err = ltc_mp_mulmod( tmp, rnd, key->N, tmp);
err = ltc_mp_mulmod(tmp, rnd, key->N, tmp);
if (err != CRYPT_OK) {
goto error;
}
Expand Down Expand Up @@ -121,7 +121,7 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen,

#ifdef LTC_RSA_BLINDING
/* unblind */
err = ltc_mp_mulmod( tmp, rndi, key->N, tmp);
err = ltc_mp_mulmod(tmp, rndi, key->N, tmp);
if (err != CRYPT_OK) {
goto error;
}
Expand Down
7 changes: 4 additions & 3 deletions src/pk/rsa/rsa_sign_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int rsa_sign_hash_v2(const unsigned char *hash, unsigned long hashlen,
ltc_rsa_op_parameters *params,
const rsa_key *key)
{
unsigned long modulus_bitlen, modulus_bytelen, x, y;
unsigned long modulus_bitlen, modulus_bytelen, x;
int err;
ltc_rsa_op_checked op_checked = ltc_rsa_op_checked_init(key, params);

Expand All @@ -37,10 +37,10 @@ int rsa_sign_hash_v2(const unsigned char *hash, unsigned long hashlen,
}

/* get modulus len in bits */
modulus_bitlen = ltc_mp_count_bits((key->N));
modulus_bitlen = ltc_mp_count_bits(key->N);

/* siglen must be at least the size of the modulus */
modulus_bytelen = ltc_mp_unsigned_bin_size((key->N));
modulus_bytelen = ltc_mp_unsigned_bin_size(key->N);
if (modulus_bytelen > *siglen) {
*siglen = modulus_bytelen;
return CRYPT_BUFFER_OVERFLOW;
Expand All @@ -54,6 +54,7 @@ int rsa_sign_hash_v2(const unsigned char *hash, unsigned long hashlen,
}
} else {
/* PKCS #1 v1.5 pad the hash */
unsigned long y;
unsigned char *tmpin = NULL;
const unsigned char *tmpin_ro;

Expand Down
8 changes: 4 additions & 4 deletions src/pk/rsa/rsa_verify_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
@param key The public RSA key corresponding to the key that performed the signature
@return CRYPT_OK on success (even if the signature is invalid)
*/
int rsa_verify_hash_v2(const unsigned char *sig, unsigned long siglen,
const unsigned char *hash, unsigned long hashlen,
int rsa_verify_hash_v2(const unsigned char *sig, unsigned long siglen,
const unsigned char *hash, unsigned long hashlen,
ltc_rsa_op_parameters *params,
int *stat,
const rsa_key *key)
Expand All @@ -43,10 +43,10 @@ int rsa_verify_hash_v2(const unsigned char *sig, unsigned long siglen,
}

/* get modulus len in bits */
modulus_bitlen = ltc_mp_count_bits( (key->N));
modulus_bitlen = ltc_mp_count_bits(key->N);

/* outlen must be at least the size of the modulus */
modulus_bytelen = ltc_mp_unsigned_bin_size( (key->N));
modulus_bytelen = ltc_mp_unsigned_bin_size(key->N);
if (modulus_bytelen != siglen) {
return CRYPT_INVALID_PACKET;
}
Expand Down
Loading