comparison cli-authpubkey.c @ 839:33207ed1174b

Merge in ECC
author Matt Johnston <matt@ucc.asn.au>
date Mon, 21 Oct 2013 22:57:21 +0800
parents a78a38e402d1
children 0da8ba489c23
comparison
equal deleted inserted replaced
834:e378da7eae5d 839:33207ed1174b
119 119
120 TRACE(("leave recv_msg_userauth_pk_ok")) 120 TRACE(("leave recv_msg_userauth_pk_ok"))
121 } 121 }
122 122
123 void cli_buf_put_sign(buffer* buf, sign_key *key, int type, 123 void cli_buf_put_sign(buffer* buf, sign_key *key, int type,
124 const unsigned char *data, unsigned int len) 124 buffer *data_buf) {
125 {
126 #ifdef ENABLE_CLI_AGENTFWD 125 #ifdef ENABLE_CLI_AGENTFWD
127 if (key->source == SIGNKEY_SOURCE_AGENT) { 126 if (key->source == SIGNKEY_SOURCE_AGENT) {
128 /* Format the agent signature ourselves, as buf_put_sign would. */ 127 /* Format the agent signature ourselves, as buf_put_sign would. */
129 buffer *sigblob; 128 buffer *sigblob;
130 sigblob = buf_new(MAX_PUBKEY_SIZE); 129 sigblob = buf_new(MAX_PUBKEY_SIZE);
131 agent_buf_sign(sigblob, key, data, len); 130 agent_buf_sign(sigblob, key, data_buf);
132 buf_setpos(sigblob, 0); 131 buf_putbufstring(buf, sigblob);
133 buf_putstring(buf, buf_getptr(sigblob, sigblob->len),
134 sigblob->len);
135
136 buf_free(sigblob); 132 buf_free(sigblob);
137 } else 133 } else
138 #endif /* ENABLE_CLI_AGENTFWD */ 134 #endif /* ENABLE_CLI_AGENTFWD */
139 { 135 {
140 buf_put_sign(buf, key, type, data, len); 136 buf_put_sign(buf, key, type, data_buf);
141 } 137 }
142 } 138 }
143 139
144 /* TODO: make it take an agent reference to use as well */ 140 /* TODO: make it take an agent reference to use as well */
145 static void send_msg_userauth_pubkey(sign_key *key, int type, int realsign) { 141 static void send_msg_userauth_pubkey(sign_key *key, int type, int realsign) {
171 167
172 if (realsign) { 168 if (realsign) {
173 TRACE(("realsign")) 169 TRACE(("realsign"))
174 /* We put the signature as well - this contains string(session id), then 170 /* We put the signature as well - this contains string(session id), then
175 * the contents of the write payload to this point */ 171 * the contents of the write payload to this point */
176 sigbuf = buf_new(4 + SHA1_HASH_SIZE + ses.writepayload->len); 172 sigbuf = buf_new(4 + ses.session_id->len + ses.writepayload->len);
177 buf_putstring(sigbuf, ses.session_id, SHA1_HASH_SIZE); 173 buf_putbufstring(sigbuf, ses.session_id);
178 buf_putbytes(sigbuf, ses.writepayload->data, ses.writepayload->len); 174 buf_putbytes(sigbuf, ses.writepayload->data, ses.writepayload->len);
179 cli_buf_put_sign(ses.writepayload, key, type, sigbuf->data, sigbuf->len); 175 cli_buf_put_sign(ses.writepayload, key, type, sigbuf);
180 buf_free(sigbuf); /* Nothing confidential in the buffer */ 176 buf_free(sigbuf); /* Nothing confidential in the buffer */
181 } 177 }
182 178
183 encrypt_packet(); 179 encrypt_packet();
184 TRACE(("leave send_msg_userauth_pubkey")) 180 TRACE(("leave send_msg_userauth_pubkey"))