[BACK]Return to kex.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/kex.c between version 1.175 and 1.176

version 1.175, 2023/02/28 21:31:50 version 1.176, 2023/03/06 12:14:48
Line 52 
Line 52 
 #include "misc.h"  #include "misc.h"
 #include "dispatch.h"  #include "dispatch.h"
 #include "monitor.h"  #include "monitor.h"
   #include "myproposal.h"
   
 #include "ssherr.h"  #include "ssherr.h"
 #include "sshbuf.h"  #include "sshbuf.h"
 #include "digest.h"  #include "digest.h"
   #include "xmalloc.h"
   
 /* prototype */  /* prototype */
 static int kex_choose_conf(struct ssh *);  static int kex_choose_conf(struct ssh *);
Line 300 
Line 302 
         free(list);          free(list);
         free(ret);          free(ret);
         return r;          return r;
   }
   
   /*
    * Fill out a proposal array with dynamically allocated values, which may
    * be modified as required for compatibility reasons.
    * Any of the options may be NULL, in which case the default is used.
    * Array contents must be freed by calling kex_proposal_free_entries.
    */
   void
   kex_proposal_populate_entries(struct ssh *ssh, char *prop[PROPOSAL_MAX],
       const char *kexalgos, const char *ciphers, const char *macs,
       const char *comp, const char *hkalgs)
   {
           const char *defpropserver[PROPOSAL_MAX] = { KEX_SERVER };
           const char *defpropclient[PROPOSAL_MAX] = { KEX_CLIENT };
           const char **defprop = ssh->kex->server ? defpropserver : defpropclient;
           u_int i;
   
           if (prop == NULL)
                   fatal_f("proposal missing");
   
           for (i = 0; i < PROPOSAL_MAX; i++) {
                   switch(i) {
                   case PROPOSAL_KEX_ALGS:
                           prop[i] = compat_kex_proposal(ssh,
                               kexalgos ? kexalgos : defprop[i]);
                           break;
                   case PROPOSAL_ENC_ALGS_CTOS:
                   case PROPOSAL_ENC_ALGS_STOC:
                           prop[i] = xstrdup(ciphers ? ciphers : defprop[i]);
                           break;
                   case PROPOSAL_MAC_ALGS_CTOS:
                   case PROPOSAL_MAC_ALGS_STOC:
                           prop[i]  = xstrdup(macs ? macs : defprop[i]);
                           break;
                   case PROPOSAL_COMP_ALGS_CTOS:
                   case PROPOSAL_COMP_ALGS_STOC:
                           prop[i] = xstrdup(comp ? comp : defprop[i]);
                           break;
                   case PROPOSAL_SERVER_HOST_KEY_ALGS:
                           prop[i] = xstrdup(hkalgs ? hkalgs : defprop[i]);
                           break;
                   default:
                           prop[i] = xstrdup(defprop[i]);
                   }
           }
   }
   
   void
   kex_proposal_free_entries(char *prop[PROPOSAL_MAX])
   {
           u_int i;
   
           for (i = 0; i < PROPOSAL_MAX; i++)
                   free(prop[i]);
 }  }
   
 /* put algorithm proposal into buffer */  /* put algorithm proposal into buffer */

Legend:
Removed from v.1.175  
changed lines
  Added in v.1.176