1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20documentation%20for%20PKCS1_PSS.py%20is%20incorrect%2C%0A%20plus%20minor%20issue%20w/%20_slowmath.py&In-Reply-To=%3C010EF8E44879B2468C96768709C743D21CE64770F1%40EXCHANGE.rambus.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<style type="text/css">
pre {
white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
}
</style>
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000586.html">
<LINK REL="Next" HREF="000589.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py</H1>
<B>Gurney, John-Mark</B>
<A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=Re%3A%20%5Bpycrypto%5D%20documentation%20for%20PKCS1_PSS.py%20is%20incorrect%2C%0A%20plus%20minor%20issue%20w/%20_slowmath.py&In-Reply-To=%3C010EF8E44879B2468C96768709C743D21CE64770F1%40EXCHANGE.rambus.com%3E"
TITLE="[pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py">john-mark at cryptography.com
</A><BR>
<I>Thu May 24 19:36:22 EDT 2012</I>
<P><UL>
<LI>Previous message: <A HREF="000586.html">[pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py
</A></li>
<LI>Next message: <A HREF="000589.html">[pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#588">[ date ]</a>
<a href="thread.html#588">[ thread ]</a>
<a href="subject.html#588">[ subject ]</a>
<a href="author.html#588">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Since that is for compatibility w/ _fastmath, I agree that it shouldn't go there then.
How about a fix to RSA's construct method that attempts to convert the tuple's contents to longs?
Such as:
key = self._math.rsa_construct(*(long(x) for x in tup))
on line 539.
Thanks for fixing the doc bug!
-----Original Message-----
From: Dwayne C. Litzenberger [mailto:<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dlitz at dlitz.net</A>]
Sent: Thursday, May 24, 2012 3:58 PM
To: Gurney, John-Mark
Cc: <A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">pycrypto at lists.dlitz.net</A>
Subject: Re: [pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py
On Wed, May 23, 2012 at 10:48:03AM -0700, Gurney, John-Mark wrote:
><i><A HREF="https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/Signature/PKCS">https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/Signature/PKCS</A>
</I>><i>1_PSS.py
</I>><i>
</I>><i>In the file on lines 41 & 42 it has:
</I>>>>><i> signer = PKCS1_PSS.new(key)
</I>>>>><i> signature = PKCS1_PSS.sign(key)
</I>><i>
</I>><i>The second line is incorrect. It should be:
</I>>>>><i> signature = signer.sign(h)
</I>
I've committed a fix. Thanks!
><i>Oh, there is also a bogus assertion in _slowmath.py:
</I>><i><A HREF="https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/PublicKey/_slo">https://github.com/dlitz/pycrypto/blob/master/lib/Crypto/PublicKey/_slo</A>
</I>><i>wmath.py
</I>><i>
</I>><i>On line 85, it asserts that e is long. If you have an e of 3, it is reasonable for e to be a normal int, and not a long. Maybe the asserts should be changed to:
</I>><i>n = long(n)
</I>><i>e = long(e)
</I>><i>
</I>><i>So that python will convert the types properly.
</I>
No, those assertions in _slowmath are there so that we catch usage that would break when using _fastmath.
_fastmath.rsa_construct (which is written in C) requires long parameters in order to keep the C code simple. If we do the implicit conversions in _slowmath, we should also have do the conversions in _fastmath. Since _fastmath is an internal module, I see no reason for the added complexity (and risk of bugs).
Cheers,
- Dwayne
--
Dwayne C. Litzenberger <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dlitz at dlitz.net</A>>
OpenPGP: 19E1 1FE8 B3CF F273 ED17 4A24 928C EC13 39C2 5CF7
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000586.html">[pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py
</A></li>
<LI>Next message: <A HREF="000589.html">[pycrypto] documentation for PKCS1_PSS.py is incorrect, plus minor issue w/ _slowmath.py
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#588">[ date ]</a>
<a href="thread.html#588">[ thread ]</a>
<a href="subject.html#588">[ subject ]</a>
<a href="author.html#588">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
mailing list</a><br>
</body></html>
|