diff dss.c @ 642:33fd2f3499d2 dropbear-tfm

A few build fixes
author Matt Johnston <matt@ucc.asn.au>
date Tue, 22 Nov 2011 19:28:58 +0700
parents 2b1bb792cd4d
children
line wrap: on
line diff
--- a/dss.c	Mon Nov 21 19:52:28 2011 +0800
+++ b/dss.c	Tue Nov 22 19:28:58 2011 +0700
@@ -43,7 +43,7 @@
  * The key will have the same format as buf_put_dss_key.
  * These should be freed with dss_key_free.
  * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
-int buf_get_dss_pub_key(buffer* buf, dss_key *key) {
+int buf_get_dss_pub_key(buffer* buf, dropbear_dss_key *key) {
 
 	TRACE(("enter buf_get_dss_pub_key"))
 	dropbear_assert(key != NULL);
@@ -51,10 +51,7 @@
 	key->q = m_malloc(sizeof(fp_int));
 	key->g = m_malloc(sizeof(fp_int));
 	key->y = m_malloc(sizeof(fp_int));
-	fp_init(key->p);
-	fp_init(key->q);
-	fp_init(key->g);
-	fp_init(key->y);
+	m_fp_init_multi(key->p, key->q, key->g, key->y, NULL);
 	key->x = NULL;
 
 	buf_incrpos(buf, 4+SSH_SIGNKEY_DSS_LEN); /* int + "ssh-dss" */
@@ -79,7 +76,7 @@
 /* Same as buf_get_dss_pub_key, but reads a private "x" key at the end.
  * Loads a private dss key from a buffer
  * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
-int buf_get_dss_priv_key(buffer* buf, dss_key *key) {
+int buf_get_dss_priv_key(buffer* buf, dropbear_dss_key *key) {
 
 	int ret = DROPBEAR_FAILURE;
 
@@ -102,7 +99,7 @@
 	
 
 /* Clear and free the memory used by a public or private key */
-void dss_key_free(dss_key *key) {
+void dss_key_free(dropbear_dss_key *key) {
 
 	TRACE(("enter dsa_key_free"))
 	if (key == NULL) {
@@ -141,7 +138,7 @@
  * fpint	g
  * fpint	y
  */
-void buf_put_dss_pub_key(buffer* buf, dss_key *key) {
+void buf_put_dss_pub_key(buffer* buf, dropbear_dss_key *key) {
 
 	dropbear_assert(key != NULL);
 	buf_putstring(buf, SSH_SIGNKEY_DSS, SSH_SIGNKEY_DSS_LEN);
@@ -153,7 +150,7 @@
 }
 
 /* Same as buf_put_dss_pub_key, but with the private "x" key appended */
-void buf_put_dss_priv_key(buffer* buf, dss_key *key) {
+void buf_put_dss_priv_key(buffer* buf, dropbear_dss_key *key) {
 
 	dropbear_assert(key != NULL);
 	buf_put_dss_pub_key(buf, key);
@@ -164,7 +161,7 @@
 #ifdef DROPBEAR_SIGNKEY_VERIFY
 /* Verify a DSS signature (in buf) made on data by the key given. 
  * returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
-int buf_dss_verify(buffer* buf, dss_key *key, const unsigned char* data,
+int buf_dss_verify(buffer* buf, dropbear_dss_key *key, const unsigned char* data,
 		unsigned int len) {
 
 	unsigned char msghash[SHA1_HASH_SIZE];
@@ -180,10 +177,7 @@
 	TRACE(("enter buf_dss_verify"))
 	dropbear_assert(key != NULL);
 
-	fp_init(&val1);
-	fp_init(&val2);
-	fp_init(&val3);
-	fp_init(&val4);
+	m_fp_init_multi(&val1, &val2, &val3, &val4, NULL);
 
 	/* get blob, check length */
 	string = buf_getstring(buf, &stringlen);
@@ -296,7 +290,7 @@
  *
  * Now we aren't relying on the random number generation to protect the private
  * key x, which is a long term secret */
-void buf_put_dss_sign(buffer* buf, dss_key *key, const unsigned char* data,
+void buf_put_dss_sign(buffer* buf, dropbear_dss_key *key, const unsigned char* data,
 		unsigned int len) {
 
 	unsigned char msghash[SHA1_HASH_SIZE];