gnupg on OpenBSD

Markus Friedl Markus.Friedl at informatik.uni-erlangen.de
Tue Oct 13 13:23:38 CEST 1998


hello!

i'm trying to use gnupg on OpenBSD.  here are some
problems with gnupg-0.4.1:

- /dev/random does not work on OpenBSD, i use /dev/srandom instead
  (random(4) says: /dev/random reserved for nuclear noise generators.)
- dynamic loading with dlopen works on OpenBSD, but:
	* dlopen() is not defined in libdl, but in crt0.o and friends
	* OpenBSD binaries are a.out, so every symbol begins with "_" 

  the rsa extension module works with:
	gcc -shared -rdynamic -fpic rsa.c -Wl,-Bshareable -Wl,-x -o rsa
  i'm not sure if this is the only way.

-markus


the following patches are quick hacks,
they test against the OS instead of features.

--- cipher/rand-unix.c-dist	Tue Oct  6 19:35:49 1998
+++ cipher/rand-unix.c	Tue Oct  6 19:37:41 1998
@@ -126,7 +126,11 @@
 
     if( level >= 2 ) {
 	if( fd_random == -1 )
+  #if defined(__OpenBSD__)
+	    fd_random = open_device( "/dev/srandom", 8 );
+  #else
 	    fd_random = open_device( "/dev/random", 8 );
+  #endif
 	fd = fd_random;
     }
     else {
--- cipher/dynload.c.dist	Tue Oct 13 10:37:25 1998
+++ cipher/dynload.c	Tue Oct 13 10:47:56 1998
@@ -125,7 +125,11 @@
 	log_error("%s: error loading extension: %s\n", el->name, dlerror() );
 	goto failure;
     }
+#ifdef __OpenBSD__
+    name = (char**)dlsym(el->handle, "_gnupgext_version");
+#else
     name = (char**)dlsym(el->handle, "gnupgext_version");
+#endif
     if( (err=dlerror()) ) {
 	log_error("%s: not a gnupg extension: %s\n", el->name, err );
 	goto failure;
@@ -137,7 +141,11 @@
 		  el->hintstr? el->hintstr:"",
 		  el->hintstr? ")":"");
 
+#ifdef __OpenBSD__
+    sym = dlsym(el->handle, "_gnupgext_enum_func");
+#else
     sym = dlsym(el->handle, "gnupgext_enum_func");
+#endif
     if( (err=dlerror()) ) {
 	log_error("%s: invalid gnupg extension: %s\n", el->name, err );
 	goto failure;




More information about the Gnupg-devel mailing list