Opened 9 years ago
Closed 9 years ago
#14854 closed enhancement (fixed)
Update pycrypto to 2.6.1
Reported by:  JeanPierre Flori  Owned by:  Jeroen Demeyer 

Priority:  major  Milestone:  sage6.1 
Component:  packages: standard  Keywords:  spkg pycrypto 
Cc:  Merged in:  
Authors:  JeanPierre Flori  Reviewers:  Volker Braun 
Report Upstream:  N/A  Work issues:  
Branch:  u/jpflori/ticket/14854 (Commits, GitHub, GitLab)  Commit:  83eeb4b6f2ba9581f98e4542897c47354eb17372 
Dependencies:  #12399  Stopgaps: 
Description (last modified by )
We ship 2.1.0.
Use git branch and upstream tarball at:
Change History (19)
comment:1 Changed 9 years ago by
Keywords:  spkg pycrypto added 

comment:2 Changed 9 years ago by
Authors:  → JeanPierre Flori 

Branch:  → u/jpflori/ticket/14854 
Commit:  → e0fbe47211e50eeb6ce8f1063f1fdeed097701db 
Dependencies:  → #12399 
Description:  modified (diff) 
Status:  new → needs_review 
comment:3 Changed 9 years ago by
Summary:  Update pycrypto to 2.6.0 → Update pycrypto to 2.6.1 

comment:4 Changed 9 years ago by
This was in #15531 but I'm pretty sure it applies here just as well:
sage t long src/sage/crypto/block_cipher/miniaes.py # 1 doctest failed sage t long src/sage/crypto/block_cipher/sdes.py # 1 doctest failed sage t long src/sage/crypto/classical_cipher.py # 1 doctest failed sage t long src/sage/crypto/stream_cipher.py # 1 doctest failed sage t long src/sage/crypto/util.py # 1 doctest failed sage t long src/sage/crypto/public_key/blum_goldwasser.py # 1 doctest failed sage t long src/sage/monoids/string_monoid.py # 1 doctest failed sage t long src/sage/monoids/string_monoid_element.py # 1 doctest failed
comment:6 Changed 9 years ago by
The errors are because pycrpto wants a secure (hum, let's say more side channel attacks resistant) implem of modular exponentiation or issues a warning. It's available as mpz_powm_sec from recent GMP releases, but MPIR does not supply that. (Also note that wiith FLINT 2.4 we should be able to build all of Sage IIRC on top of gmp, time for a new spkg?) So we should just ignore the warnings (or add them to the doctests but would fail with Sage on top of GMP). Anyway, we don't really care within Sage, at least that's my point of view, nobody would or should use Sage to do real crypto.
comment:7 Changed 9 years ago by
Commit:  e0fbe47211e50eeb6ce8f1063f1fdeed097701db → a76e9a36883efe7787b122f5ce201d05d152b773 

Branch pushed to git repo; I updated commit sha1. New commits:
a76e9a3  Filter pycrypto warning about insecure modular exponentiaiton.

comment:8 Changed 9 years ago by
The solution I've implemented is to filter pycrypto warnings in the warnings module. Feel free to say it is a bad solution and we should rather modify the tests, or move the piece of code I've added somewhere else (maybe it really slows down Sage startup, I don't know).
comment:9 Changed 9 years ago by
On a different topic, the only funciton actually used is in the monoids files, and that's only the byte_to_long function, so maybe we should implement this ourselves. I don't suggest to remove the pycrypto pkg though.
comment:12 Changed 9 years ago by
Explicit is better than implicit (one of Python's credos), but then I don't care that much ;)
comment:13 Changed 9 years ago by
Let's go for explicit. As I said, I think we should get rid of the pycrypto use in the monoid stuff anyway, so when that's the case it will force us to remove the explicit things rather than leaving ... evrywhere.
comment:14 Changed 9 years ago by
Unfortunately I'm not sure I can do anything else as what I did as the warning only comes up the first time the BinaryStrings?().encoding("") is used so it depends on the order the tests within the file will be run.
Maybe better reimplement bytes_to_long and long_to_bytes directly.
comment:16 Changed 9 years ago by
Commit:  a76e9a36883efe7787b122f5ce201d05d152b773 → 83eeb4b6f2ba9581f98e4542897c47354eb17372 

comment:17 Changed 9 years ago by
I've replaced the pycrypto functions by plain python funcitons which seem to be adequate for our use.
comment:18 Changed 9 years ago by
Reviewers:  → Volker Braun 

Status:  needs_review → positive_review 
lgtm
comment:19 Changed 9 years ago by
Resolution:  → fixed 

Status:  positive_review → closed 
This would be a good time to cleanup spkg scripts.