[pkg-wpa-devel] r1379 - in /crda/branches/upstream/current: reglib.c utils/key2pub.py

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Wed May 13 20:01:48 UTC 2009


Author: kelmo-guest
Date: Wed May 13 20:01:48 2009
New Revision: 1379

URL: http://svn.debian.org/wsvn/?sc=1&rev=1379
Log:
[svn-upgrade] Integrating new upstream version, crda (1.1.0)

Modified:
    crda/branches/upstream/current/reglib.c
    crda/branches/upstream/current/utils/key2pub.py

Modified: crda/branches/upstream/current/reglib.c
URL: http://svn.debian.org/wsvn/crda/branches/upstream/current/reglib.c?rev=1379&op=diff
==============================================================================
--- crda/branches/upstream/current/reglib.c (original)
+++ crda/branches/upstream/current/reglib.c Wed May 13 20:01:48 2009
@@ -49,32 +49,28 @@
 	unsigned int i;
 	int ok = 0;
 
-	rsa = RSA_new();
-	if (!rsa) {
-		fprintf(stderr, "Failed to create RSA key.\n");
-		goto out;
-	}
-
 	if (SHA1(db, dblen, hash) != hash) {
 		fprintf(stderr, "Failed to calculate SHA1 sum.\n");
-		RSA_free(rsa);
 		goto out;
 	}
 
 	for (i = 0; (i < sizeof(keys)/sizeof(keys[0])) && (!ok); i++) {
+		rsa = RSA_new();
+		if (!rsa) {
+			fprintf(stderr, "Failed to create RSA key.\n");
+			goto out;
+		}
+
 		rsa->e = &keys[i].e;
 		rsa->n = &keys[i].n;
 
-		if (RSA_size(rsa) != siglen)
-			continue;
-
 		ok = RSA_verify(NID_sha1, hash, SHA_DIGEST_LENGTH,
 				db + dblen, siglen, rsa) == 1;
+
+		rsa->e = NULL;
+		rsa->n = NULL;
+		RSA_free(rsa);
 	}
-
-	rsa->e = NULL;
-	rsa->n = NULL;
-	RSA_free(rsa);
 #endif
 
 #ifdef USE_GCRYPT

Modified: crda/branches/upstream/current/utils/key2pub.py
URL: http://svn.debian.org/wsvn/crda/branches/upstream/current/utils/key2pub.py?rev=1379&op=diff
==============================================================================
--- crda/branches/upstream/current/utils/key2pub.py (original)
+++ crda/branches/upstream/current/utils/key2pub.py Wed May 13 20:01:48 2009
@@ -9,7 +9,31 @@
        sys.stderr.write('On Debian GNU/Linux the package is called "python-m2crypto".\n')
        sys.exit(1)
 
-def print_ssl(output, name, val):
+def print_ssl_64(output, name, val):
+    while val[0] == '\0':
+        val = val[1:]
+    while len(val) % 8:
+        val = '\0' + val
+    vnew = []
+    while len(val):
+        vnew.append((val[0], val[1], val[2], val[3], val[4], val[5], val[6], val[7]))
+        val = val[8:]
+    vnew.reverse()
+    output.write('static BN_ULONG %s[%d] = {\n' % (name, len(vnew)))
+    idx = 0
+    for v1, v2, v3, v4, v5, v6, v7, v8 in vnew:
+        if not idx:
+            output.write('\t')
+        output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4), ord(v5), ord(v6), ord(v7), ord(v8)))
+        idx += 1
+        if idx == 2:
+            idx = 0
+            output.write('\n')
+    if idx:
+        output.write('\n')
+    output.write('};\n\n')
+
+def print_ssl_32(output, name, val):
     while val[0] == '\0':
         val = val[1:]
     while len(val) % 4:
@@ -32,6 +56,13 @@
     if idx:
         output.write('\n')
     output.write('};\n\n')
+
+def print_ssl(output, name, val):
+    import struct
+    if len(struct.pack('@L', 0)) == 8:
+        return print_ssl_64(output, name, val)
+    else:
+        return print_ssl_32(output, name, val)
 
 def print_ssl_keys(output, n):
     output.write(r'''




More information about the Pkg-wpa-devel mailing list