svnno****@sourc*****
svnno****@sourc*****
2014年 3月 13日 (木) 01:11:14 JST
Revision: 5533 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5533 Author: yutakapon Date: 2014-03-13 01:11:13 +0900 (Thu, 13 Mar 2014) Log Message: ----------- 接続処理の ED25519 対応を開始した。 Modified Paths: -------------- branches/ssh_ed25519/ttssh2/ttxssh/key.c -------------- next part -------------- Modified: branches/ssh_ed25519/ttssh2/ttxssh/key.c =================================================================== --- branches/ssh_ed25519/ttssh2/ttxssh/key.c 2014-03-12 15:09:04 UTC (rev 5532) +++ branches/ssh_ed25519/ttssh2/ttxssh/key.c 2014-03-12 16:11:13 UTC (rev 5533) @@ -524,6 +524,8 @@ case KEY_ECDSA384: case KEY_ECDSA521: return "ECDSA"; + case KEY_ED25519: + return "ED25519"; } return "unknown"; } @@ -1198,6 +1200,11 @@ buffer_put_ecpoint(msg, EC_KEY_get0_group(keypair->ecdsa), EC_KEY_get0_public_key(keypair->ecdsa)); break; + case KEY_ED25519: + s = get_sshname_from_key(keypair); + buffer_put_cstring(msg, s); + buffer_put_string(msg, keypair->ed25519_pk, ED25519_PK_SZ); + break; default: return FALSE; } @@ -1281,33 +1288,34 @@ Key *key_private_deserialize(buffer_t *blob) { - char *type_name = NULL; - Key *k = NULL; - unsigned int pklen, sklen; - int type; - int success = 0; + char *type_name = NULL; + Key *k = NULL; + unsigned int pklen, sklen; + int type; + int success = 0; - type_name = buffer_get_string_msg(blob, NULL); - type = get_keytype_from_name(type_name); - - switch (type) { + type_name = buffer_get_string_msg(blob, NULL); + type = get_keytype_from_name(type_name); + + switch (type) { case KEY_ED25519: k = malloc(sizeof(Key)); memset(k, 0, sizeof(Key)); + k->type = type; k->ed25519_pk = buffer_get_string_msg(blob, &pklen); k->ed25519_sk = buffer_get_string_msg(blob, &sklen); - if (pklen != ED25519_PK_SZ) - goto error; - if (sklen != ED25519_SK_SZ) - goto error; + if (pklen != ED25519_PK_SZ) + goto error; + if (sklen != ED25519_SK_SZ) + goto error; break; default: // TODO: ED25519 \x88ȊO\x82͖\xA2\x83T\x83|\x81[\x83g\x81B break; - } - success = 1; + } + success = 1; error: free(type_name);