+
    '(jG@                         ^ RI t ^ RIHtHt ^ RIHtHtHtHtH	t	H
t
 ^ RIHt ^ RIHt  ! R R]4      t ! R R	]4      t]! 4       t ! R
 R]4      t ! R R]4      tR# )    N)bytes_to_longlong_to_bytes)VoidPointernull_pointerSmartPointerc_size_tc_uint8_ptrc_ulonglong)Integer)getrandbitsc                   :    ] tR t^t^t^t^t^t^t^t	^t
^t^	tRtR# )CurveID N)__name__
__module____qualname____firstlineno__P192P224P256P384P521ED25519ED448
CURVE25519CURVE448__static_attributes__r       L/home/ubuntu/cf-venv/lib/python3.14/site-packages/Crypto/PublicKey/_point.pyr   r      s/    DDDDDGEJHr   r   c                      a  ] tR t^t o / t]P                  ! 4       t. ROt. ROt	. ROt
. ROt. ROtRR.tRR.t. ROt. ROt]]	,           ]
,           ],           ],           ],           ],           ],           ],           tR tR tR tR tR	 tR
tV tR# )_Curvesed25519Ed25519ed448Ed448c                    WP                   9   # N	all_names)selfitems   &&r   __contains___Curves.__contains__1   s    ~~%%r   c                    V P                   # r'   r(   r*   s   &r   __dir___Curves.__dir__4   s    ~~r   c                   WP                   9   dg   ^RIHp VP                  4       p\        P
                  Vn        V P                  P                  \        P                  V P                   V4      4       EMWP                  9   dg   ^RIHp VP                  4       p\        P                  Vn        V P                  P                  \        P                  V P                  V4      4       EMIWP                  9   dg   ^RIHp VP                  4       p\        P                   Vn        V P                  P                  \        P                  V P                  V4      4       EMWP"                  9   dg   ^RIHp VP%                  4       p\        P&                  Vn        V P                  P                  \        P                  V P"                  V4      4       EM]WP(                  9   dg   ^RIHp VP+                  4       p\        P,                  Vn        V P                  P                  \        P                  V P(                  V4      4       EMWP.                  9   dg   ^RIHp VP3                  4       p	\        P4                  V	n        V P                  P                  \        P                  V P.                  V	4      4       EMqWP6                  9   df   ^RIHp VP9                  4       p
\        P:                  V
n        V P                  P                  \        P                  V P6                  V
4      4       MWP<                  9   df   ^RIHp VPA                  4       p\        PB                  Vn        V P                  P                  \        P                  V P<                  V4      4       MWPD                  9   df   ^RIHp VPG                  4       p\        PH                  Vn        V P                  P                  \        P                  V PD                  V4      4       M\K        RV,          4      hV P                  V,          # )   )	_nist_ecc)_edwards)_montgomeryzUnsupported curve '%s')&
p192_names r4   
p192_curver   r   idcurvesupdatedictfromkeys
p224_names
p224_curver   
p256_names
p256_curver   
p384_names
p384_curver   
p521_names
p521_curver   ed25519_namesr5   ed25519_curver   ed448_namesed448_curver   curve25519_namesr6   curve25519_curver   curve448_namescurve448_curver   
ValueError)r*   namer4   p192p224p256p384p521r5   r"   r$   r6   
curve25519curve448s   &&            r   load_Curves.load7   s   ??"#'')DllDGKKt}}T__dCD__$#'')DllDGKKt}}T__dCD__$#'')DllDGKKt}}T__dCD__$#'')DllDGKKt}}T__dCD__$#'')DllDGKKt}}T__dCD'''",,.G GJKKt}}T-?-?IJ%%%"((*E}}EHKKt}}T-=-=uEF***%$557J#..JMKKt}}T-B-BJOP(((%"113H!**HKKKt}}T-@-@(KL5<=={{4  r   c                   V P                   ;_uu_ 4        V P                  P                  V4      pVEf   V P                  V4      pWP                  9   g   WP
                  9   d   \        VP                  V4      Vn        M&\        VP                  VP                  V4      Vn        VP                  \        P                  \        P                  39   Vn        VP                  \        P                   \        P"                  39   Vn        VP                  ;'       g    VP$                  '       * Vn        R R R 4       V#   + '       g   i     X# ; ir'   )curves_lockr;   getrX   rK   rM   	EccXPointGxGEccPointGyr:   r   r   r   
is_edwardsr   r   is_montgomeryis_weierstrass)r*   rP   curves   && r   __getitem___Curves.__getitem__i   s    KKOOD)E}		$000D<O<O4O'$7EG&uxx4@EG#(88/O#O &+hh73E3E3:3C3C3E 'E#,1,<,< -@ -@,1,?,?(A$    s   D
E EE	c                l    V P                    F  pW,          pK  	  V P                  P                  4       # r'   )r)   r;   items)r*   rP   _s   &  r   ri   _Curves.itemsy   s*    NND
A #{{  ""r   r   N)rQ   z
NIST P-192zP-192
prime192v1	secp192r1nistp192)rR   z
NIST P-224zP-224
prime224v1	secp224r1nistp224)rS   z
NIST P-256zP-256
prime256v1	secp256r1nistp256)rT   z
NIST P-384zP-384
prime384v1	secp384r1nistp384)rU   z
NIST P-521zP-521
prime521v1	secp521r1nistp521)rV   
Curve25519X25519)rW   Curve448X448)r   r   r   r   r;   	threadingRLockr[   r7   r?   rA   rC   rE   rG   rI   rK   rM   r)   r,   r0   rX   rf   ri   r   __classdictcell____classdict__s   @r   r!   r!      s     F//#KJJJJJ	*MG$K=5NZ'*4zAJN#$&679GHI&0!d # #r   r!   c                      a  ] tR t^t o RtRR ltR tR tR tR t	R t
R tR	 t]R
 4       t]R 4       t]R 4       tR tR tR tR tR tR tR tR tRtV tR# )r`   a  A class to model a point on an Elliptic Curve.

The class supports operators for:

* Adding two points: ``R = S + T``
* In-place addition: ``S += T``
* Negating a point: ``R = -T``
* Comparing two points: ``if S == T: ...`` or ``if S != T: ...``
* Multiplying a point by a scalar: ``R = S*k``
* In-place multiplication by a scalar: ``T *= k``

:ivar curve: The **canonical** name of the curve as defined in the `ECC table`_.
:vartype curve: string

:ivar x: The affine X-coordinate of the ECC point
:vartype x: integer

:ivar y: The affine Y-coordinate of the ECC point
:vartype y: integer

:ivar xy: The tuple with affine X- and Y- coordinates
c                    \         V,          V n        T P                  P
                  T n        T P                  P                  \        P                  8X  d   \        R4      hT P                  4       p\        Y4      p\        Y$4      p\        T4      T8w  g   \        T4      T8w  d   \        R4      hT P                  P                  P                  pT P                  P                  P                  p\!        4       T n         T P                  P$                  P'                  4       p	T! T P"                  P-                  4       \/        T4      \/        T4      \1        T4      T	4      p
T
'       d%   T
^8X  d   \        R4      h\        RT
,          4      h\3        T P"                  P'                  4       T4      T n        R#   \         d    \        R \	        T4      ,          4      hi ; i  \(         d
    \*        p	 Li ; i)Unknown curve name %sz)EccPoint cannot be created for Curve25519Incorrect coordinate length)The EC point does not belong to the curve(Error %d while instantiating an EC pointN)_curves_curveKeyErrorrO   str	canonicalre   r:   r   r   size_in_bytesr   lenrawlib	new_point
free_pointr   _pointcontextr\   AttributeErrorr   
address_ofr	   r   r   )r*   xyre   modulus_bytesxbybr   	free_funcr   results   &&&&       r   __init__EccPoint.__init__   s   	C!%.DK [[**
;;>>W///HII**,1,1,r7m#s2w-'?:;;KK&&00	KK&&11	!m	#kk))--/G 4;;113&r?&r?#M2"	$ | !LMMG&PQQ #4;;??#4i@G  	C4s5zABB	C(  	#"G	#s   F> $G( >'G%(G<;G<c                   V P                   P                  P                  pV P                   P                  P                  p\	        4       V n        V! V P
                  P                  4       VP
                  P                  4       4      pV'       d   \        R V,          4      h\        V P
                  P                  4       V4      V n        V # z"Error %d while cloning an EC point
r   r   cloner   r   r   r   r\   rO   r   r*   pointr   r   r   s   &&   r   setEccPoint.set   s    ""((KK&&11	!mt{{--/||'')+ AFJKK"4;;??#4i@r   c                    \        V\        4      '       g   R # V P                  P                  P                  p^ V! V P
                  P                  4       VP
                  P                  4       4      8H  # F)
isinstancer`   r   r   cmpr   r\   )r*   r   cmp_funcs   && r   __eq__EccPoint.__eq__   sQ    %**;;%%))HT[[__.0@0@0BCCCr   c                    W8X  * # r'   r   )r*   r   s   &&r   __ne__EccPoint.__ne__   s      r   c                    V P                   P                  P                  pV P                  4       pV! VP                  P                  4       4      pV'       d   \        R V,          4      hV# )z$Error %d while inverting an EC point)r   r   negcopyr   r\   rO   )r*   neg_funcnpr   s   &   r   __neg__EccPoint.__neg__   sO    ;;%%))YY["))--/*CfLMM	r   c                N    V P                   w  r\        WV P                  4      pV# zReturn a copy of this point.)xyr`   re   )r*   r   r   r   s   &   r   r   EccPoint.copy   s"    wwaDJJ'	r   c                v    V P                   P                  '       d   V P                  ^ 8H  # V P                  R8H  # ),``True`` if this is the *point-at-infinity*.)r   r   )r   rb   r   r   r/   s   &r   is_point_at_infinityEccPoint.is_point_at_infinity   s1     ;;!!!66Q;77f$$r   c                    V P                   P                  '       d   \        ^ ^V P                  4      # \        ^ ^ V P                  4      # )-Return the *point-at-infinity* for the curve.)r   rb   r`   re   r/   s   &r   point_at_infinityEccPoint.point_at_infinity   s:     ;;!!!Aq$**--Aq$**--r   c                (    V P                   ^ ,          # )r   r   r/   s   &r   r   
EccPoint.x       wwqzr   c                (    V P                   ^,          # )r3   r   r/   s   &r   r   
EccPoint.y   r   r   c                   V P                  4       p\        V4      p\        V4      pV P                  P                  P                  pV! \        V4      \        V4      \        V4      V P                  P                  4       4      pV'       d   \        R V,          4      h\        \        V4      4      \        \        V4      4      3# )z#Error %d while encoding an EC point)r   	bytearrayr   r   get_xyr	   r   r   r\   rO   r   r   )r*   r   r   r   r   r   s   &     r   r   EccPoint.xy  s    **,}%}%##**B#B /)+ BVKLLb)*GM"4E,FGGr   c                >    V P                  4       ^,           ^,          # z"Size of each coordinate, in bytes.size_in_bitsr/   s   &r   r   EccPoint.size_in_bytes      !!#a'A--r   c                .    V P                   P                  # z!Size of each coordinate, in bits.r   modulus_bitsr/   s   &r   r   EccPoint.size_in_bits      {{'''r   c                    V P                   P                  P                  pV! V P                  P	                  4       4      pV'       d   \        RV,          4      hV # )z]Double this point (in-place operation).

Returns:
    This same object (to enable chaining).
z#Error %d while doubling an EC point)r   r   doubler   r\   rO   )r*   double_funcr   s   &  r   r   EccPoint.double  sG     kk((//T[[__./BVKLLr   c                   V P                   P                  P                  pV! V P                  P	                  4       VP                  P	                  4       4      pV'       d%   V^8X  d   \        R4      h\        RV,          4      hV # )zAdd a second point to this onez#EC points are not on the same curvez#Error %d while adding two EC points)r   r   addr   r\   rO   )r*   r   add_funcr   s   &&  r   __iadd__EccPoint.__iadd__'  si     ;;%%))$++//+U\\-=-=-?@| !FGGBVKLLr   c                6    V P                  4       pW!,          pV# )z8Return a new point, the addition of this one and anotherr   )r*   r   r   s   && r   __add__EccPoint.__add__2  s     YY[
	r   c           
     T   V P                   P                  P                  pV^ 8  d   \        R4      h\	        V4      pV! V P
                  P                  4       \        V4      \        \        V4      4      \        \        ^@4      4      4      pV'       d   \        RV,          4      hV # zMultiply this point by a scalarz?Scalar multiplication is only defined for non-negative integersz%Error %d during scalar multiplicationr   r   scalarrO   r   r   r\   r	   r   r   r
   r   r*   r   scalar_funcsbr   s   &&   r   __imul__EccPoint.__imul__9       kk((//A:^__6"T[[__.(_%c"g.(R9; DvMNNr   c                6    V P                  4       pW!,          pV# z2Return a new point, the scalar product of this oner   r*   r   r   s   && r   __mul__EccPoint.__mul__H       YY[
	r   c                $    V P                  V4      # r'   r   r*   	left_hands   &&r   __rmul__EccPoint.__rmul__O      ||I&&r   r   r   re   N)rS   )r   r   r   r   __doc__r   r   r   r   r   r   r   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   s   @r   r`   r`      s     .'ARD!%.     H H.(	' 'r   r`   c                   v   a  ] tR tRt o RtR tR tR tR tR t	R t
]R	 4       tR
 tR tR tR tR tRtV tR# )r]   iS  a  A class to model a point on an Elliptic Curve,
where only the X-coordinate is exposed.

The class supports operators for:

* Multiplying a point by a scalar: ``R = S*k``
* In-place multiplication by a scalar: ``T *= k``

:ivar curve: The **canonical** name of the curve as defined in the `ECC table`_.
:vartype curve: string

:ivar x: The affine X-coordinate of the ECC point
:vartype x: integer
c                
    \         V,          V n        T P                  P
                  T n        T P                  P                  \        P                  \        P                  39  d   \        R4      hT P                  P                  P                  pT P                  P                  P                  p\        4       T n         T P                  P                   P#                  4       pT P)                  4       pTf   \&        pM/\+        \-        Y4      4      p\/        T4      T8w  d   \        R4      h\        4       T n        T! T P                  P1                  4       T\3        T4      T4      pT^8X  d   \        R4      hT'       d   \        RT,          4      h\5        T P                  P#                  4       T4      T n        R#   \         d    \        R \	        T4      ,          4      hi ; i  \$         d    \&        p ELi ; i)r   z5EccXPoint can only be created for Curve25519/Curve448Nr   r   r   )r   r   r   rO   r   r   re   r:   r   r   r   r   r   r   r   r   r   r\   r   r   r   r	   r   r   r   r   r   )	r*   r   re   r   r   r   r   r   r   s	   &&&      r   r   EccXPoint.__init__c  s   
	C!%.DK [[**
;;>>'"4"4g6F6F!GGTUUKK&&00	KK&&11	!m	#kk))--/G **,9B]1<=B2w-' !>??!m4;;113#M2"$
 R<HIIG&PQQ #4;;??#4i@M  	C4s5zABB	C  	#"G	#s   G $G- 'G*-HHc                   V P                   P                  P                  pV P                   P                  P                  p\	        4       V n        V! V P
                  P                  4       VP
                  P                  4       4      pV'       d   \        R V,          4      h\        V P
                  P                  4       V4      V n        V # r   r   r   s   &&   r   r   EccXPoint.set  s    ""((KK&&11	!mt{{--/||'')+AFJKK"4;;??#4i@r   c                    \        V\        4      '       g   R # V P                  P                  P                  pV P
                  P                  4       pVP
                  P                  4       pV! W44      p^ V8H  # r   )r   r]   r   r   r   r   r\   )r*   r   r   p1p2ress   &&    r   r   EccXPoint.__eq__  s\    %++;;%%))[[__\\rCxr   c                     V P                   p\        YP                  4      #   \         d    T P                  4       u # i ; ir   )r   rO   r   r]   re   )r*   r   s   & r   r   EccXPoint.copy  sA    	,A JJ''  	,))++	,s   # A Ac                D     V P                   pR#   \         d     R# i ; i)r   TF)r   rO   )r*   rj   s   & r   r   EccXPoint.is_point_at_infinity  s)    	A   		s    c                .    \        RV P                  4      # )r   N)r]   re   r/   s   &r   r   EccXPoint.point_at_infinity  s     tzz**r   c                `   V P                  4       p\        V4      pV P                  P                  P                  pV! \        V4      \        V4      V P                  P                  4       4      pV^8X  d   \        R4      hV'       d   \        RV,          4      h\        \        V4      4      # )   z)No X coordinate for the point at infinityz'Error %d while getting X of an EC point)r   r   r   r   get_xr	   r   r   r\   rO   r   r   )r*   r   r   r  r   s   &    r   r   EccXPoint.x  s    **,}%""(({2.{{(* R<HIIFOPP}R())r   c                >    V P                  4       ^,           ^,          # r   r   r/   s   &r   r   EccXPoint.size_in_bytes  r   r   c                .    V P                   P                  # r   r   r/   s   &r   r   EccXPoint.size_in_bits  r   r   c           
     T   V P                   P                  P                  pV^ 8  d   \        R4      h\	        V4      pV! V P
                  P                  4       \        V4      \        \        V4      4      \        \        ^@4      4      4      pV'       d   \        RV,          4      hV # r   r   r   s   &&   r   r   EccXPoint.__imul__  r   r   c                6    V P                  4       pW!,          pV# r   r   r   s   && r   r   EccXPoint.__mul__  r   r   c                $    V P                  V4      # r'   r   r   s   &&r   r   EccXPoint.__rmul__  r   r   r   N)r   r   r   r   r  r   r   r   r   r   r   r  r   r   r   r   r   r   r   r   r   s   @r   r]   r]   S  s\     -A^(+
 * *.(' 'r   r]   )r   Crypto.Util.numberr   r   Crypto.Util._raw_apir   r   r   r   r	   r
   Crypto.Math.Numbersr   Crypto.Random.randomr   objectr   r!   r   r`   r]   r   r   r   <module>r&     s`     ;/ / ( ,	f 	c#f c#L )M'v M'`Z' Z'r   