Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/ttssh2/ttxssh/hostkey.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 10065 by doda, Sun Jul 17 15:39:21 2022 UTC revision 10068 by doda, Sun Jul 17 15:39:53 2022 UTC
# Line 247  void SSH2_update_host_key_myproposal(PTI Line 247  void SSH2_update_host_key_myproposal(PTI
247                  buf[len - 1] = '\0';  // get rid of comma                  buf[len - 1] = '\0';  // get rid of comma
248          myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = buf;          myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = buf;
249  }  }
250    
251    ssh_keyalgo choose_SSH2_keysign_algorithm(char *server_proposal, ssh_keytype keytype)
252    {
253            char buff[128];
254            const struct ssh2_host_key_t *ptr = ssh2_host_key;
255    
256            if (keytype == KEY_RSA) {
257                    if (server_proposal == NULL) {
258                            logprintf(LOG_LEVEL_VERBOSE, "%s: no server_sig_algs, ssh-rsa is selected.", __FUNCTION__);
259                            return KEY_ALGO_RSA;
260                    }
261                    else {
262                            choose_SSH2_proposal(server_proposal, "rsa-sha2-512,rsa-sha2-256,ssh-rsa", buff, sizeof(buff));
263                            if (strlen(buff) == 0) {
264                                    // not found.
265                                    logprintf(LOG_LEVEL_WARNING, "%s: no match sign algorithm.", __FUNCTION__);
266                                    return KEY_ALGO_UNSPEC;
267                            }
268                            else {
269                                    logprintf(LOG_LEVEL_VERBOSE, "%s: %s is selected.", __FUNCTION__, buff);
270                                    return get_ssh2_keyalgo_from_name(buff);
271                            }
272                    }
273            }
274            else {
275                    while (ptr->type != KEY_UNSPEC && ptr->type != keytype) {
276                            ptr++;
277                    }
278    
279                    return ptr->algo;
280            }
281    
282            // not reached
283            return KEY_ALGO_UNSPEC;
284    }

Legend:
Removed from v.10065  
changed lines
  Added in v.10068

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26