Lines 1-88
Link Here
|
1 |
--- dsa.c.orig Tue Jan 13 14:52:15 2004 |
|
|
2 |
+++ dsa.c Tue Jan 13 14:53:54 2004 |
3 |
@@ -297,15 +297,15 @@ |
4 |
return err; |
5 |
} |
6 |
|
7 |
-#define OUTPUT_BIGNUM(num, buf2, y, z) \ |
8 |
-{ \ |
9 |
- z = (unsigned long)mp_unsigned_bin_size(num); \ |
10 |
- if ((y + 4 + z) > *outlen) { return CRYPT_BUFFER_OVERFLOW; } \ |
11 |
- STORE32L(z, out+y); \ |
12 |
- y += 4; \ |
13 |
- if (mp_to_unsigned_bin(num, out+y) != MP_OKAY) { return CRYPT_MEM; } \ |
14 |
- y += z; \ |
15 |
-} |
16 |
+#define OUTPUT_BIGNUM(num, buf2, y, z) \ |
17 |
+{ \ |
18 |
+ z = (unsigned long)mp_unsigned_bin_size(num); \ |
19 |
+ if ((y + 4 + z) > *outlen) { return CRYPT_BUFFER_OVERFLOW; } \ |
20 |
+ STORE32L(z, out+y); \ |
21 |
+ y += 4; \ |
22 |
+ if (mp_to_unsigned_bin(num, out+y) != MP_OKAY) { return CRYPT_MEM; } \ |
23 |
+ y += z; \ |
24 |
+} |
25 |
|
26 |
int dsa_export(unsigned char *out, unsigned long *outlen, int type, dsa_key *key) |
27 |
{ |
28 |
@@ -352,33 +352,33 @@ |
29 |
return CRYPT_OK; |
30 |
} |
31 |
|
32 |
-#define INPUT_BIGNUM(num, in, x, y) \ |
33 |
-{ \ |
34 |
- /* load value */ \ |
35 |
- if (y+4 > inlen) { \ |
36 |
- err = CRYPT_INVALID_PACKET; \ |
37 |
- goto error; \ |
38 |
- } \ |
39 |
- LOAD32L(x, in+y); \ |
40 |
- y += 4; \ |
41 |
- \ |
42 |
- /* sanity check... */ \ |
43 |
- if (y+x > inlen) { \ |
44 |
- err = CRYPT_INVALID_PACKET; \ |
45 |
- goto error; \ |
46 |
- } \ |
47 |
- \ |
48 |
- /* load it */ \ |
49 |
- if (mp_read_unsigned_bin(num, (unsigned char *)in+y, (int)x) != MP_OKAY) {\ |
50 |
- err = CRYPT_MEM; \ |
51 |
- goto error; \ |
52 |
- } \ |
53 |
- y += x; \ |
54 |
- if (mp_shrink(num) != MP_OKAY) { \ |
55 |
- err = CRYPT_MEM; \ |
56 |
- goto error; \ |
57 |
- } \ |
58 |
-} |
59 |
+#define INPUT_BIGNUM(num, in, x, y) \ |
60 |
+{ \ |
61 |
+ /* load value */ \ |
62 |
+ if (y+4 > inlen) { \ |
63 |
+ err = CRYPT_INVALID_PACKET; \ |
64 |
+ goto error; \ |
65 |
+ } \ |
66 |
+ LOAD32L(x, in+y); \ |
67 |
+ y += 4; \ |
68 |
+ \ |
69 |
+ /* sanity check... */ \ |
70 |
+ if (y+x > inlen) { \ |
71 |
+ err = CRYPT_INVALID_PACKET; \ |
72 |
+ goto error; \ |
73 |
+ } \ |
74 |
+ \ |
75 |
+ /* load it */ \ |
76 |
+ if (mp_read_unsigned_bin(num, (unsigned char *)in+y, (int)x) != MP_OKAY) {\ |
77 |
+ err = CRYPT_MEM; \ |
78 |
+ goto error; \ |
79 |
+ } \ |
80 |
+ y += x; \ |
81 |
+ if (mp_shrink(num) != MP_OKAY) { \ |
82 |
+ err = CRYPT_MEM; \ |
83 |
+ goto error; \ |
84 |
+ } \ |
85 |
+} |
86 |
|
87 |
int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key) |
88 |
{ |