Develop and Download Open Source Software

Browse Subversion Repository

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

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

revision 4602 by maya, Tue Aug 30 14:09:13 2011 UTC revision 5545 by yutakapon, Mon Mar 17 16:06:58 2014 UTC
# Line 301  static int eat_to_end_of_pattern(char FA Line 301  static int eat_to_end_of_pattern(char FA
301  // BASE64デコード処理を行う。(rfc1521)  // BASE64デコード処理を行う。(rfc1521)
302  // srcバッファは null-terminate している必要あり。  // srcバッファは null-terminate している必要あり。
303  //  //
304  static int uudecode(unsigned char *src, int srclen, unsigned char *target, int targsize)  int uudecode(unsigned char *src, int srclen, unsigned char *target, int targsize)
305  {  {
306          char pad = '=';          char pad = '=';
307          int tarindex, state, ch;          int tarindex, state, ch;
# Line 645  static int check_host_key(PTInstVar pvar Line 645  static int check_host_key(PTInstVar pvar
645                          pvar->hosts_state.hostkey.dsa = key->dsa;                          pvar->hosts_state.hostkey.dsa = key->dsa;
646                          pvar->hosts_state.hostkey.rsa = key->rsa;                          pvar->hosts_state.hostkey.rsa = key->rsa;
647                          pvar->hosts_state.hostkey.ecdsa = key->ecdsa;                          pvar->hosts_state.hostkey.ecdsa = key->ecdsa;
648                            pvar->hosts_state.hostkey.ed25519_pk = key->ed25519_pk;
649    
650                          index += eat_base64(data + index);                          index += eat_base64(data + index);
651                          index += eat_spaces(data + index);                          index += eat_spaces(data + index);
# Line 791  static int match_key(PTInstVar pvar, Key Line 792  static int match_key(PTInstVar pvar, Key
792          unsigned char FAR * mod;          unsigned char FAR * mod;
793          const EC_GROUP *group;          const EC_GROUP *group;
794          const EC_POINT *pa, *pb;          const EC_POINT *pa, *pb;
795            Key *a, *b;
796    
797          if (pvar->hosts_state.hostkey.type != key->type) {          if (pvar->hosts_state.hostkey.type != key->type) {
798                  return -1;                  return -1;
# Line 833  static int match_key(PTInstVar pvar, Key Line 835  static int match_key(PTInstVar pvar, Key
835                  pb = EC_KEY_get0_public_key(pvar->hosts_state.hostkey.ecdsa);                  pb = EC_KEY_get0_public_key(pvar->hosts_state.hostkey.ecdsa);
836                  return EC_POINT_cmp(group, pa, pb, NULL) == 0;                  return EC_POINT_cmp(group, pa, pb, NULL) == 0;
837    
838            case KEY_ED25519:
839                    a = key;
840                    b = &pvar->hosts_state.hostkey;
841                    return a->ed25519_pk != NULL && b->ed25519_pk != NULL &&
842                        memcmp(a->ed25519_pk, b->ed25519_pk, ED25519_PK_SZ) == 0;
843    
844          default:          default:
845                  return FALSE;                  return FALSE;
846          }          }
# Line 943  static char FAR *format_host_key(PTInstV Line 951  static char FAR *format_host_key(PTInstV
951          case KEY_ECDSA256:          case KEY_ECDSA256:
952          case KEY_ECDSA384:          case KEY_ECDSA384:
953          case KEY_ECDSA521:          case KEY_ECDSA521:
954            case KEY_ED25519:
955          {          {
956                  Key *key = &pvar->hosts_state.hostkey;                  Key *key = &pvar->hosts_state.hostkey;
957                  char *blob = NULL;                  char *blob = NULL;
# Line 1108  static void delete_different_key(PTInstV Line 1117  static void delete_different_key(PTInstV
1117                  }                  }
1118    
1119                  // 接続中のサーバのキーを読み込む                  // 接続中のサーバのキーを読み込む
1120                    memset(&key, 0, sizeof(key));
1121                  switch (pvar->hosts_state.hostkey.type) {                  switch (pvar->hosts_state.hostkey.type) {
1122                  case KEY_RSA1: // SSH1                  case KEY_RSA1: // SSH1
1123                          key.type = KEY_RSA1;                          key.type = KEY_RSA1;
# Line 1129  static void delete_different_key(PTInstV Line 1139  static void delete_different_key(PTInstV
1139                          key.type = pvar->hosts_state.hostkey.type;                          key.type = pvar->hosts_state.hostkey.type;
1140                          key.ecdsa = EC_KEY_dup(pvar->hosts_state.hostkey.ecdsa);                          key.ecdsa = EC_KEY_dup(pvar->hosts_state.hostkey.ecdsa);
1141                          break;                          break;
1142                    case KEY_ED25519:
1143                            key.type = pvar->hosts_state.hostkey.type;
1144                            key.ed25519_pk = duplicate_ED25519_PK(pvar->hosts_state.hostkey.ed25519_pk);
1145                            break;
1146                  }                  }
1147    
1148                  // ファイルから読み込む                  // ファイルから読み込む
# Line 1263  error2: Line 1277  error2:
1277                  _unlink(filename);                  _unlink(filename);
1278    
1279                  finish_read_host_files(pvar, 0);                  finish_read_host_files(pvar, 0);
1280    
1281                    // 最後にメモリを解放しておく。
1282                    key_free(&key);
1283          }          }
1284  }  }
1285    
# Line 1815  BOOL HOSTS_check_host_key(PTInstVar pvar Line 1832  BOOL HOSTS_check_host_key(PTInstVar pvar
1832          case KEY_ECDSA521:          case KEY_ECDSA521:
1833                  pvar->hosts_state.hostkey.ecdsa = EC_KEY_dup(key->ecdsa);                  pvar->hosts_state.hostkey.ecdsa = EC_KEY_dup(key->ecdsa);
1834                  break;                  break;
1835            case KEY_ED25519:
1836                    pvar->hosts_state.hostkey.ed25519_pk = duplicate_ED25519_PK(key->ed25519_pk);
1837                    break;
1838          }          }
1839          free(pvar->hosts_state.prefetched_hostname);          free(pvar->hosts_state.prefetched_hostname);
1840          pvar->hosts_state.prefetched_hostname = _strdup(hostname);          pvar->hosts_state.prefetched_hostname = _strdup(hostname);

Legend:
Removed from v.4602  
changed lines
  Added in v.5545

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