comparison cli-agentfwd.c @ 1682:a53e7d2d60be

rsa-sha256 for ssh-agent
author Matt Johnston <matt@ucc.asn.au>
date Mon, 25 May 2020 20:23:02 +0800
parents 79eef94ccea9
children a7cc3332d8ab
comparison
equal deleted inserted replaced
1681:435cfb9ec96e 1682:a53e7d2d60be
253 253
254 agent_get_key_list(ret_list); 254 agent_get_key_list(ret_list);
255 } 255 }
256 256
257 void agent_buf_sign(buffer *sigblob, sign_key *key, 257 void agent_buf_sign(buffer *sigblob, sign_key *key,
258 const buffer *data_buf) { 258 const buffer *data_buf, enum signature_type sigtype) {
259 buffer *request_data = NULL; 259 buffer *request_data = NULL;
260 buffer *response = NULL; 260 buffer *response = NULL;
261 unsigned int siglen; 261 unsigned int siglen;
262 int packet_type; 262 int packet_type;
263 int flags = 0;
263 264
264 /* Request format 265 /* Request format
265 byte SSH2_AGENTC_SIGN_REQUEST 266 byte SSH2_AGENTC_SIGN_REQUEST
266 string key_blob 267 string key_blob
267 string data 268 string data
269 */ 270 */
270 request_data = buf_new(MAX_PUBKEY_SIZE + data_buf->len + 12); 271 request_data = buf_new(MAX_PUBKEY_SIZE + data_buf->len + 12);
271 buf_put_pub_key(request_data, key, key->type); 272 buf_put_pub_key(request_data, key, key->type);
272 273
273 buf_putbufstring(request_data, data_buf); 274 buf_putbufstring(request_data, data_buf);
274 buf_putint(request_data, 0); 275 #if DROPBEAR_RSA_SHA256
276 if (sigtype == DROPBEAR_SIGNATURE_RSA_SHA256) {
277 flags |= SSH_AGENT_RSA_SHA2_256;
278 }
279 #endif
280 buf_putint(request_data, flags);
275 281
276 response = agent_request(SSH2_AGENTC_SIGN_REQUEST, request_data); 282 response = agent_request(SSH2_AGENTC_SIGN_REQUEST, request_data);
277 283
278 if (!response) { 284 if (!response) {
279 goto fail; 285 goto fail;