Ë
    øíŸem  ã                   ó(   — d dl mZ d dlmZ d„ Zd„ Zy)é    )Úlong_to_bytes)ÚEccKeyc                 ó¶   — |j                   | j                  z  }|j                  «       rt        d«      ‚t	        |j
                  |j                  «       «      }|S )NzInvalid ECDH point)ÚpointQÚdÚis_point_at_infinityÚ
ValueErrorr   ÚxÚsize_in_bytes)Úkey_privÚkey_pubÚpointPÚzs       ú8/usr/lib/python3/dist-packages/Cryptodome/Protocol/DH.pyÚ_compute_ecdhr      sJ   € à�^‰^˜hŸj™jÑ(€FØ×"Ñ"Ô$ÜÐ-Ó.Ð.Ü�f—h‘h × 4Ñ 4Ó 6Ó7€AØ€Hó    c                  ó–  — | j                  dd«      }| j                  dd«      }| j                  dd«      }| j                  dd«      }| j                  dd«      }|€t        d«      ‚d}d}d}d	„ }	|� |	||dd
«      }|dz  }|� |	||dd«      }|dz  }|� |	||dd
«      }|dz  }|� |	||dd«      }|dz  }||z   dk  s
|dk(  s|dk(  rt        d«      ‚d}
d}|r|rt        ||«      }
|r1|r/t        |«      t        |«      k7  rt        d«      ‚t        ||«      }n!|r|rt        ||«      }n|r|rt        ||«      }||
z   } ||«      S )aÌ  Perform a Diffie-Hellman key agreement.

    Keywords:
      kdf (callable):
        A key derivation function that accepts ``bytes`` as input and returns
        ``bytes``.
      static_priv (EccKey):
        The local static private key. Optional.
      static_pub (EccKey):
        The static public key that belongs to the peer. Optional.
      eph_priv (EccKey):
        The local ephemeral private key, generated for this session. Optional.
      eph_pub (EccKey):
        The ephemeral public key, received from the peer for this session. Optional.

    At least two keys must be passed, of which one is a private key and one
    a public key.

    Returns (bytes):
      The derived secret key material.
    Ústatic_privNÚ
static_pubÚeph_privÚeph_pubÚkdfz'kdf' is mandatoryr   c                 óÜ   — t        |t        «      st        d|z  «      ‚|r|j                  «       st        d|z  «      ‚| €|j                  } | S | |j                  k7  rt        d|z  «      ‚| S )Nz'%s' must be an ECC keyz'%s' must be a private ECC keyz('%s' is defined on an incompatible curve)Ú
isinstancer   Ú	TypeErrorÚhas_privateÚcurve)r   ÚkeyÚnameÚprivates       r   Úcheck_curvez"key_agreement.<locals>.check_curve2   ss   € Ü˜#œvÔ&ÜÐ5¸Ñ<Ó=Ð=Ù˜3Ÿ?™?Ô,ÜÐ<¸tÑCÓDÐDØˆ=Ø—I‘IˆEð ˆð �c—i‘iÒÜÐFÈÑMÓNÐNØˆr   Té   Fé   z'Too few keys for the ECDH key agreementr   z"DH mode C(2e, 1s) is not supported)Úgetr	   r   Úbool)Úkwargsr   r   r   r   r   Ú
count_privÚ	count_pubr   r!   ÚZsÚZeÚZs                r   Úkey_agreementr,      sš  € ð. —*‘*˜]¨DÓ1€KØ—‘˜L¨$Ó/€JØ�z‰z˜* dÓ+€HØ�j‰j˜ DÓ)€GØ
�*‰*�U˜DÓ
!€Cà
€{ÜÐ-Ó.Ð.à€JØ€IØ€Eò	ð ÐÙ˜E ;°¸tÓDˆØ�a‰ˆ
àÐÙ˜E :¨|¸UÓCˆØ�Q‰ˆ	àÐÙ˜E 8¨Z¸Ó>ˆØ�a‰ˆ
àÐÙ˜E 7¨I°uÓ=ˆØ�Q‰ˆ	à�YÑ !Ò# z°Q¢¸)Àqº.ÜÐBÓCÐCà	€BØ	€Bá‘zä˜;¨
Ó3ˆá‘Gä�Ó¤ ZÓ 0Ò0ÜÐAÓBÐBÜ˜8 WÓ-‰Ù	‘jä˜8 ZÓ0‰Ù	‘[ä˜;¨Ó0ˆà
ˆR‰€Aáˆq‹6€Mr   N)ÚCryptodome.Util.numberr   ÚCryptodome.PublicKey.ECCr   r   r,   © r   r   ú<module>r0      s   ðÝ 0Ý +òóWr   