[pkg-wpa-devel] r1488 - in /crda/branches/upstream/current: Makefile reglib.c udev/regulatory.rules

kelmo-guest at users.alioth.debian.org kelmo-guest at users.alioth.debian.org
Mon Mar 1 08:40:47 UTC 2010


Author: kelmo-guest
Date: Mon Mar  1 08:40:47 2010
New Revision: 1488

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

Modified:
    crda/branches/upstream/current/Makefile
    crda/branches/upstream/current/reglib.c
    crda/branches/upstream/current/udev/regulatory.rules

Modified: crda/branches/upstream/current/Makefile
URL: http://svn.debian.org/wsvn/crda/branches/upstream/current/Makefile?rev=1488&op=diff
==============================================================================
--- crda/branches/upstream/current/Makefile (original)
+++ crda/branches/upstream/current/Makefile Mon Mar  1 08:40:47 2010
@@ -21,13 +21,16 @@
 # keys are put when building. For example you can run
 # with make PUBKEY_DIR=/usr/lib/crda/pubkeys
 PUBKEY_DIR?=pubkeys
+RUNTIME_PUBKEY_DIR?=/etc/wireless-regdb/pubkeys
 
 CFLAGS += -Wall -g
 
-all: $(REG_BIN) crda intersect verify
+all: all_noverify verify
+
+all_noverify: crda intersect regdbdump
 
 ifeq ($(USE_OPENSSL),1)
-CFLAGS += -DUSE_OPENSSL `pkg-config --cflags openssl`
+CFLAGS += -DUSE_OPENSSL -DPUBKEY_DIR=\"$(RUNTIME_PUBKEY_DIR)\" `pkg-config --cflags openssl`
 LDLIBS += `pkg-config --libs openssl`
 
 reglib.o: keys-ssl.c
@@ -74,11 +77,12 @@
 	$(NQ) '  EXIST ' $(REG_BIN)
 	$(NQ)
 	$(NQ) ERROR: The file: $(REG_BIN) is missing. You need this in place in order
-	$(NQ) to build CRDA. You can get it from:
+	$(NQ) to verify CRDA. You can get it from:
 	$(NQ)
 	$(NQ) $(REG_GIT)
 	$(NQ)
 	$(NQ) "Once cloned (no need to build) cp regulatory.bin to $(REG_BIN)"
+	$(NQ) "Use \"make noverify\" to disable verification"
 	$(NQ)
 	$(Q) exit 1
 

Modified: crda/branches/upstream/current/reglib.c
URL: http://svn.debian.org/wsvn/crda/branches/upstream/current/reglib.c?rev=1488&op=diff
==============================================================================
--- crda/branches/upstream/current/reglib.c (original)
+++ crda/branches/upstream/current/reglib.c Mon Mar  1 08:40:47 2010
@@ -1,12 +1,15 @@
 #include <errno.h>
 #include <stdio.h>
 #include <arpa/inet.h>
+#include <sys/types.h>
+#include <dirent.h>
 #include "reglib.h"
 
 #ifdef USE_OPENSSL
 #include <openssl/objects.h>
 #include <openssl/rsa.h>
 #include <openssl/sha.h>
+#include <openssl/pem.h>
 #endif
 
 #ifdef USE_GCRYPT
@@ -48,6 +51,10 @@
 	__u8 hash[SHA_DIGEST_LENGTH];
 	unsigned int i;
 	int ok = 0;
+	DIR *pubkey_dir;
+	struct dirent *nextfile;
+	FILE *keyfile;
+	char filename[PATH_MAX];
 
 	if (SHA1(db, dblen, hash) != hash) {
 		fprintf(stderr, "Failed to calculate SHA1 sum.\n");
@@ -70,6 +77,22 @@
 		rsa->e = NULL;
 		rsa->n = NULL;
 		RSA_free(rsa);
+	}
+	if (!ok && (pubkey_dir = opendir(PUBKEY_DIR))) {
+		while (!ok && (nextfile = readdir(pubkey_dir))) {
+			snprintf(filename, PATH_MAX, "%s/%s", PUBKEY_DIR,
+				nextfile->d_name);
+			if ((keyfile = fopen(filename, "rb"))) {
+				rsa = PEM_read_RSA_PUBKEY(keyfile,
+					NULL, NULL, NULL);
+				if (rsa)
+					ok = RSA_verify(NID_sha1, hash, SHA_DIGEST_LENGTH,
+						db + dblen, siglen, rsa) == 1;
+				RSA_free(rsa);
+				fclose(keyfile);
+			}
+		}
+		closedir(pubkey_dir);
 	}
 #endif
 

Modified: crda/branches/upstream/current/udev/regulatory.rules
URL: http://svn.debian.org/wsvn/crda/branches/upstream/current/udev/regulatory.rules?rev=1488&op=diff
==============================================================================
--- crda/branches/upstream/current/udev/regulatory.rules (original)
+++ crda/branches/upstream/current/udev/regulatory.rules Mon Mar  1 08:40:47 2010
@@ -2,4 +2,4 @@
 # For more information see:
 # http://wireless.kernel.org/en/developers/Regulatory/CRDA
 
-KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="$(SBINDIR)/crda"
+KERNEL=="regulatory*", ACTION=="change", SUBSYSTEM=="platform", RUN+="$(SBINDIR)crda"




More information about the Pkg-wpa-devel mailing list