Mercurial > dropbear
diff rsa.c @ 1459:06d52bcb8094
Pointer parameter could be declared as pointing to const
author | Francois Perrad <francois.perrad@gadz.org> |
---|---|
date | Sat, 19 Aug 2017 17:16:13 +0200 |
parents | c721e8c42d2a |
children | 5916af64acd4 36ab6b091ad3 |
line wrap: on
line diff
--- a/rsa.c Sat Aug 12 20:51:58 2017 +0200 +++ b/rsa.c Sat Aug 19 17:16:13 2017 +0200 @@ -38,8 +38,8 @@ #if DROPBEAR_RSA -static void rsa_pad_em(dropbear_rsa_key * key, - buffer *data_buf, mp_int * rsa_em); +static void rsa_pad_em(const dropbear_rsa_key * key, + const buffer *data_buf, mp_int * rsa_em); /* Load a public rsa key from a buffer, initialising the values. * The key will have the same format as buf_put_rsa_key. @@ -147,7 +147,7 @@ * mp_int e * mp_int n */ -void buf_put_rsa_pub_key(buffer* buf, dropbear_rsa_key *key) { +void buf_put_rsa_pub_key(buffer* buf, const dropbear_rsa_key *key) { TRACE(("enter buf_put_rsa_pub_key")) dropbear_assert(key != NULL); @@ -161,7 +161,7 @@ } /* Same as buf_put_rsa_pub_key, but with the private "x" key appended */ -void buf_put_rsa_priv_key(buffer* buf, dropbear_rsa_key *key) { +void buf_put_rsa_priv_key(buffer* buf, const dropbear_rsa_key *key) { TRACE(("enter buf_put_rsa_priv_key")) @@ -185,7 +185,7 @@ #if DROPBEAR_SIGNKEY_VERIFY /* Verify a signature in buf, made on data by the key given. * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ -int buf_rsa_verify(buffer * buf, dropbear_rsa_key *key, buffer *data_buf) { +int buf_rsa_verify(buffer * buf, const dropbear_rsa_key *key, const buffer *data_buf) { unsigned int slen; DEF_MP_INT(rsa_s); DEF_MP_INT(rsa_mdash); @@ -240,7 +240,7 @@ /* Sign the data presented with key, writing the signature contents * to the buffer */ -void buf_put_rsa_sign(buffer* buf, dropbear_rsa_key *key, buffer *data_buf) { +void buf_put_rsa_sign(buffer* buf, const dropbear_rsa_key *key, const buffer *data_buf) { unsigned int nsize, ssize; unsigned int i; DEF_MP_INT(rsa_s); @@ -346,8 +346,8 @@ * * rsa_em must be a pointer to an initialised mp_int. */ -static void rsa_pad_em(dropbear_rsa_key * key, - buffer *data_buf, mp_int * rsa_em) { +static void rsa_pad_em(const dropbear_rsa_key * key, + const buffer *data_buf, mp_int * rsa_em) { /* ASN1 designator (including the 0x00 preceding) */ const unsigned char rsa_asn1_magic[] =