summaryrefslogtreecommitdiff
path: root/pipermail/pycrypto/2012q2/000588.html
blob: a5fefbf7e10cfa73786d016fae6a87e67073fc01 (plain)
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:
&gt;<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>&gt;<i>1_PSS.py
</I>&gt;<i>
</I>&gt;<i>In the file on lines 41 &amp; 42 it has:
</I>&gt;&gt;&gt;&gt;<i> signer = PKCS1_PSS.new(key)
</I>&gt;&gt;&gt;&gt;<i> signature = PKCS1_PSS.sign(key)
</I>&gt;<i>
</I>&gt;<i>The second line is incorrect.  It should be:
</I>&gt;&gt;&gt;&gt;<i> signature = signer.sign(h)
</I>
I've committed a fix.  Thanks!

&gt;<i>Oh, there is also a bogus assertion in _slowmath.py:
</I>&gt;<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>&gt;<i>wmath.py	
</I>&gt;<i>
</I>&gt;<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>&gt;<i>n = long(n)
</I>&gt;<i>e = long(e)
</I>&gt;<i>
</I>&gt;<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 &lt;<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dlitz at dlitz.net</A>&gt;
  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>