summaryrefslogtreecommitdiffhomepage
path: root/rsa.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2016-03-15 21:41:06 +0800
committerMatt Johnston <matt@ucc.asn.au>2016-03-15 21:41:06 +0800
commit645b2541732cebbccd499c4e8bf18f86d77bff0f (patch)
tree3e6f647d212466933d744e47dcdbcf97ff00ecfc /rsa.c
parentfdc61f3ab2c07f3f8d0546ee83b1a6776cc1786e (diff)
parent9bda22e70219c3056c07837803d0289b76453adb (diff)
Merge branch '20151231_indent' of https://github.com/fperrad/dropbear into fperrad-20151231_indent
Diffstat (limited to 'rsa.c')
-rw-r--r--rsa.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/rsa.c b/rsa.c
index 193e577..4fa4088 100644
--- a/rsa.c
+++ b/rsa.c
@@ -47,7 +47,7 @@ static void rsa_pad_em(dropbear_rsa_key * key,
* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
int buf_get_rsa_pub_key(buffer* buf, dropbear_rsa_key *key) {
- int ret = DROPBEAR_FAILURE;
+ int ret = DROPBEAR_FAILURE;
TRACE(("enter buf_get_rsa_pub_key"))
dropbear_assert(key != NULL);
m_mp_alloc_init_multi(&key->e, &key->n, NULL);
@@ -60,21 +60,21 @@ int buf_get_rsa_pub_key(buffer* buf, dropbear_rsa_key *key) {
if (buf_getmpint(buf, key->e) == DROPBEAR_FAILURE
|| buf_getmpint(buf, key->n) == DROPBEAR_FAILURE) {
TRACE(("leave buf_get_rsa_pub_key: failure"))
- goto out;
+ goto out;
}
if (mp_count_bits(key->n) < MIN_RSA_KEYLEN) {
dropbear_log(LOG_WARNING, "RSA key too short");
- goto out;
+ goto out;
}
TRACE(("leave buf_get_rsa_pub_key: success"))
- ret = DROPBEAR_SUCCESS;
+ ret = DROPBEAR_SUCCESS;
out:
- if (ret == DROPBEAR_FAILURE) {
- m_free(key->e);
- m_free(key->n);
- }
+ if (ret == DROPBEAR_FAILURE) {
+ m_free(key->e);
+ m_free(key->n);
+ }
return ret;
}
@@ -82,7 +82,7 @@ out:
* Loads a private rsa key from a buffer
* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
int buf_get_rsa_priv_key(buffer* buf, dropbear_rsa_key *key) {
- int ret = DROPBEAR_FAILURE;
+ int ret = DROPBEAR_FAILURE;
TRACE(("enter buf_get_rsa_priv_key"))
dropbear_assert(key != NULL);
@@ -99,34 +99,34 @@ int buf_get_rsa_priv_key(buffer* buf, dropbear_rsa_key *key) {
m_mp_alloc_init_multi(&key->d, NULL);
if (buf_getmpint(buf, key->d) == DROPBEAR_FAILURE) {
TRACE(("leave buf_get_rsa_priv_key: d: ret == DROPBEAR_FAILURE"))
- goto out;
+ goto out;
}
if (buf->pos == buf->len) {
- /* old Dropbear private keys didn't keep p and q, so we will ignore them*/
+ /* old Dropbear private keys didn't keep p and q, so we will ignore them*/
} else {
m_mp_alloc_init_multi(&key->p, &key->q, NULL);
if (buf_getmpint(buf, key->p) == DROPBEAR_FAILURE) {
TRACE(("leave buf_get_rsa_priv_key: p: ret == DROPBEAR_FAILURE"))
- goto out;
+ goto out;
}
if (buf_getmpint(buf, key->q) == DROPBEAR_FAILURE) {
TRACE(("leave buf_get_rsa_priv_key: q: ret == DROPBEAR_FAILURE"))
- goto out;
+ goto out;
}
}
- ret = DROPBEAR_SUCCESS;
+ ret = DROPBEAR_SUCCESS;
out:
- if (ret == DROPBEAR_FAILURE) {
- m_free(key->d);
- m_free(key->p);
- m_free(key->q);
- }
+ if (ret == DROPBEAR_FAILURE) {
+ m_free(key->d);
+ m_free(key->p);
+ m_free(key->q);
+ }
TRACE(("leave buf_get_rsa_priv_key"))
- return ret;
+ return ret;
}