Skip to content

ARM64 で SSH 接続できないことがある #1554

Closed

Description

@nmaya

再現

再現手順1 ECDSA 鍵交換 を使用する

  • TTSSH Setup > KEX order "diffie-hellman-group14-sha256" を最優先にする(ecdsa-sha2-* 以外を選択する)
  • TTSSH Setup > Host key order "ecdsa-sha2-nistp256" を最優先にする
  • 上の方式に対応した SSH サーバに接続する
  • handle_SSH2_dh_kex_reply: key_from_blob error

再現手順2 ECDSA サーバホスト鍵を使用する

  • TTSSH Setup > KEX order "ecdsa-sha2-nistp256" を最優先にする
  • 対応した SSH サーバに接続する
  • 上の方式に対応した SSH サーバに接続する
  • error occurred @ SSH2_ecdh_kex_init()

再現手順3 aes256-gcm@openssh.com と 固定DH KEX/GEX を組み合わせる

  • TTSSH Setup > Cipher order "aes256-gcm@openssh.com" を最優先にする
  • TTSSH Setup > KEX order "diffie-hellman-group14-sha256" を最優先にする
  • TTSSH Setup > Host key order "ssh-ed25519" を最優先にする(ecdsa-sha2-* 以外を選択する)
  • 上の方式に対応した SSH サーバに接続する

組み合わせ

cipher KEX Host key 結果
aes-256-ctr diffie-hellman-group14-sha256 ecdsa-sha2-nistp256 key_from_blob error
aes-256-ctr ecdsa-sha2-nistp256 ssh-ed25519 error occurred @ SSH2_ecdh_kex_init()
aes256-gcm@openssh.com diffie-hellman-group14-sha256 ssh-ed25519 aes256-gcm@openssh.com decrypt error(2) Detected corrupted data: connection terminating.
aes256-gcm@openssh.com diffie-hellman-group14-sha256 rsa-sha2-512 同上
aes256-gcm@openssh.com diffie-hellman-group16-sha256 rsa-sha2-512 同上
aes256-gcm@openssh.com diffie-hellman-group-exchange-sha256 ssh-ed25519 同上
aes-256-ctr diffie-hellman-group14-sha256 rsa-sha2-512 OK
chacha20-poly1305@openssh.com mlkem768x25519-sha256 ssh-ed25519 OK
aes256-gcm@openssh.com curve25519-sha256 ssh-ed25519 OK
aes256-gcm@openssh.com mlkem768x25519-sha256 ssh-ed25519 OK
aes256-gcm@openssh.com mlkem768x25519-sha256 rsa-sha2-512 OK

5.7.0 で発生する。5.6.2 では発生しない。
ARM64 で発生する。86, x64 では発生しない。

5.7.0 のコンパイラ(GitHub runner) 14.44 35228 で発生する。
手元のコンパイラ 14.44 35228 で発生する。

原因

libressl/portable#1403
MSVC コンパイラの最適化の問題

対策

Visual Studio 2026(v18.8.2) では問題が出ないらしい
https://developercommunity.visualstudio.com/t/MSVC-ARM64-optimizer-emits-ASR-instead-o/11132989#T-N11133789

Visual Studio 2022 は、手元のコンパイラを Version 17.14.41(19.44.35229)に更新しても発生する。

  • Visual C++ の対応 + GitHub runner の更新待ち?
  • LibreSSL 4.4.0 or 4.3.3 リリース待ち?
  • runner でパッチを適用する?

Activity

  1. added this to the 5.8.0 milestone on Sep 22, 2026
  2. added
    Needs MFCThe nature of this issue requires a merge into the stable branch
    on Sep 22, 2026
  3. changed the title [-]ARM64 で ecdsa が動作しない[/-] [+]ARM64 で SSH 接続できないことがある[/+] on Sep 26, 2026
  4. zmatsuo commented on Oct 5, 2026

    @zmatsuo
    Member

    パッチを当ててリリースするのがよさそうだなと思います。

    Visual Studio 2022 ARM64 用 patch を取り込んで適応するようにしました。 b3c5fc7
    手元にARM機がないので確認は行っていません。

  5. nmaya commented on Oct 5, 2026

    @nmaya
    MemberAuthor

    ありがとうございます。
    せっかく作っていただきましたが、LibreSSL 4.3.3が出ていて修正が含まれています。

  6. zmatsuo commented on Oct 5, 2026

    @zmatsuo
    Member

    対応版出てたんですね。
    ブランチ削除します。

  7. nmaya commented on Oct 6, 2026

    @nmaya
    MemberAuthor

    Visual Studio 2022 ARM64 用 patch を取り込んで適応するようにしました。 b3c5fc7

    こちらをこの Action で確認しましたが、ライブラリのキャッシュが効いたみたいで問題は再現しました。
    しかし、パッチの適用はこのように書けばいいというのが分かりましたのでよかったです。

  8. zmatsuo commented on Oct 6, 2026

    @zmatsuo
    Member

    ライブラリのキャッシュが効いたみたいで問題は再現しました。

    うまくパッチできてなかったかもしれないです。

    https://github.com/TeraTermProject/teraterm/actions/runs/37455015573
    ダウンロードしました。
    x86,x64版ともttsshのaboutboxで、LibreSSL 4.3.3 になっていました。

  9. added a commit that references this issue on Oct 6, 2026
  10. nmaya commented on Oct 6, 2026

    @nmaya
    MemberAuthor

    ライブラリのキャッシュが効いたみたいで問題は再現しました。

    うまくパッチできてなかったかもしれないです。

    https://github.com/TeraTermProject/teraterm/actions/runs/37336010788/job/111852833107#step:6:22
    キャッシュされていたようです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs ChangelogNeeds MFCThe nature of this issue requires a merge into the stable branch

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions