@@ -149,7 +149,7 @@ impl DHPrivateKey {
149
149
. map_err ( |_| pyo3:: exceptions:: PyValueError :: new_err ( "Error computing shared key." ) ) ?;
150
150
151
151
let len = deriver. len ( ) ?;
152
- Ok ( pyo3:: types:: PyBytes :: new_bound_with ( py, len, |b| {
152
+ Ok ( pyo3:: types:: PyBytes :: new_with ( py, len, |b| {
153
153
let n = deriver. derive ( b) . unwrap ( ) ;
154
154
155
155
let pad = b. len ( ) - n;
@@ -363,34 +363,34 @@ impl DHParameters {
363
363
#[ pyo3:: pyclass( frozen, module = "cryptography.hazmat.primitives.asymmetric.dh" ) ]
364
364
struct DHPrivateNumbers {
365
365
#[ pyo3( get) ]
366
- x : pyo3:: Py < pyo3:: types:: PyLong > ,
366
+ x : pyo3:: Py < pyo3:: types:: PyInt > ,
367
367
#[ pyo3( get) ]
368
368
public_numbers : pyo3:: Py < DHPublicNumbers > ,
369
369
}
370
370
371
371
#[ pyo3:: pyclass( frozen, module = "cryptography.hazmat.primitives.asymmetric.dh" ) ]
372
372
struct DHPublicNumbers {
373
373
#[ pyo3( get) ]
374
- y : pyo3:: Py < pyo3:: types:: PyLong > ,
374
+ y : pyo3:: Py < pyo3:: types:: PyInt > ,
375
375
#[ pyo3( get) ]
376
376
parameter_numbers : pyo3:: Py < DHParameterNumbers > ,
377
377
}
378
378
379
379
#[ pyo3:: pyclass( frozen, module = "cryptography.hazmat.primitives.asymmetric.dh" ) ]
380
380
struct DHParameterNumbers {
381
381
#[ pyo3( get) ]
382
- p : pyo3:: Py < pyo3:: types:: PyLong > ,
382
+ p : pyo3:: Py < pyo3:: types:: PyInt > ,
383
383
#[ pyo3( get) ]
384
- g : pyo3:: Py < pyo3:: types:: PyLong > ,
384
+ g : pyo3:: Py < pyo3:: types:: PyInt > ,
385
385
#[ pyo3( get) ]
386
- q : Option < pyo3:: Py < pyo3:: types:: PyLong > > ,
386
+ q : Option < pyo3:: Py < pyo3:: types:: PyInt > > ,
387
387
}
388
388
389
389
#[ pyo3:: pymethods]
390
390
impl DHPrivateNumbers {
391
391
#[ new]
392
392
fn new (
393
- x : pyo3:: Py < pyo3:: types:: PyLong > ,
393
+ x : pyo3:: Py < pyo3:: types:: PyInt > ,
394
394
public_numbers : pyo3:: Py < DHPublicNumbers > ,
395
395
) -> DHPrivateNumbers {
396
396
DHPrivateNumbers { x, public_numbers }
@@ -428,7 +428,7 @@ impl DHPrivateNumbers {
428
428
py : pyo3:: Python < ' _ > ,
429
429
other : pyo3:: PyRef < ' _ , Self > ,
430
430
) -> CryptographyResult < bool > {
431
- Ok ( self . x . bind ( py) . eq ( other. x . bind ( py) ) ?
431
+ Ok ( ( * * self . x . bind ( py) ) . eq ( other. x . bind ( py) ) ?
432
432
&& self
433
433
. public_numbers
434
434
. bind ( py)
@@ -440,7 +440,7 @@ impl DHPrivateNumbers {
440
440
impl DHPublicNumbers {
441
441
#[ new]
442
442
fn new (
443
- y : pyo3:: Py < pyo3:: types:: PyLong > ,
443
+ y : pyo3:: Py < pyo3:: types:: PyInt > ,
444
444
parameter_numbers : pyo3:: Py < DHParameterNumbers > ,
445
445
) -> DHPublicNumbers {
446
446
DHPublicNumbers {
@@ -472,7 +472,7 @@ impl DHPublicNumbers {
472
472
py : pyo3:: Python < ' _ > ,
473
473
other : pyo3:: PyRef < ' _ , Self > ,
474
474
) -> CryptographyResult < bool > {
475
- Ok ( self . y . bind ( py) . eq ( other. y . bind ( py) ) ?
475
+ Ok ( ( * * self . y . bind ( py) ) . eq ( other. y . bind ( py) ) ?
476
476
&& self
477
477
. parameter_numbers
478
478
. bind ( py)
@@ -486,9 +486,9 @@ impl DHParameterNumbers {
486
486
#[ pyo3( signature = ( p, g, q=None ) ) ]
487
487
fn new (
488
488
py : pyo3:: Python < ' _ > ,
489
- p : pyo3:: Py < pyo3:: types:: PyLong > ,
490
- g : pyo3:: Py < pyo3:: types:: PyLong > ,
491
- q : Option < pyo3:: Py < pyo3:: types:: PyLong > > ,
489
+ p : pyo3:: Py < pyo3:: types:: PyInt > ,
490
+ g : pyo3:: Py < pyo3:: types:: PyInt > ,
491
+ q : Option < pyo3:: Py < pyo3:: types:: PyInt > > ,
492
492
) -> CryptographyResult < DHParameterNumbers > {
493
493
if g. bind ( py) . lt ( 2 ) ? {
494
494
return Err ( CryptographyError :: from (
@@ -528,12 +528,12 @@ impl DHParameterNumbers {
528
528
other : pyo3:: PyRef < ' _ , Self > ,
529
529
) -> CryptographyResult < bool > {
530
530
let q_equal = match ( self . q . as_ref ( ) , other. q . as_ref ( ) ) {
531
- ( Some ( self_q) , Some ( other_q) ) => self_q. bind ( py) . eq ( other_q. bind ( py) ) ?,
531
+ ( Some ( self_q) , Some ( other_q) ) => ( * * self_q. bind ( py) ) . eq ( other_q. bind ( py) ) ?,
532
532
( None , None ) => true ,
533
533
_ => false ,
534
534
} ;
535
- Ok ( self . p . bind ( py) . eq ( other. p . bind ( py) ) ?
536
- && self . g . bind ( py) . eq ( other. g . bind ( py) ) ?
535
+ Ok ( ( * * self . p . bind ( py) ) . eq ( other. p . bind ( py) ) ?
536
+ && ( * * self . g . bind ( py) ) . eq ( other. g . bind ( py) ) ?
537
537
&& q_equal)
538
538
}
539
539
}
0 commit comments