Overview
| Comment: | Added a wrapper PKCS#11 module which uses GNU dlmopen to segregate loading cackey and its libraries to avoid issues with different linkspaces |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | dlopen-wrapper |
| Files: | files | file ages | folders |
| SHA1: |
45c70bc44dfae9033f7577ff5749c044 |
| User & Date: | rkeene on 2017-12-27 18:48:13 |
| Other Links: | branch diff | manifest | tags |
Context
|
2017-12-27
| ||
| 18:54 | Integrated dlmopen() wrapper library (not for general use) check-in: 59356166dc user: rkeene tags: trunk | |
| 18:48 | Added a wrapper PKCS#11 module which uses GNU dlmopen to segregate loading cackey and its libraries to avoid issues with different linkspaces Closed-Leaf check-in: 45c70bc44d user: rkeene tags: dlopen-wrapper | |
|
2017-07-17
| ||
| 13:56 | Updated to treat returning a zero-length signed message as an error check-in: 0c7c510048 user: rkeene tags: trunk | |
Changes
Modified .fossil-settings/ignore-glob from [9b544d0473] to [3e95b51b2f].
| ︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | libcackey_g.so libcackey.so libcackey_g.dll libcackey.dll libcackey_g.a libcackey.a libcackey.syms build/certs test test-afl test-afl.data build/chrome/archive build/chrome/workdir-* build/chrome/lib | > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | libcackey_g.so libcackey.so libcackey_g.dll libcackey.dll libcackey_g.a libcackey.a libcackey.syms libcackey_wrap.so libcackey_wrap.o libcackey_wrap.c build/certs test test-afl test-afl.data build/chrome/archive build/chrome/workdir-* build/chrome/lib |
| ︙ | ︙ |
Modified Makefile.in from [6effe24266] to [abdaf2d437].
| ︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
-$(RANLIB) libcackey.a
libcackey_g.a: cackey_g.o
rm -f libcackey_g.a
$(AR) rc libcackey_g.a cackey_g.o
-$(RANLIB) libcackey_g.a
test: test.c libcackey_g.@SHOBJEXT@
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test test.c -Wl,-R,. libcackey_g.@SHOBJEXT@ $(LIBS)
test-afl.data: test
tmpLogFile='log.$(shell openssl rand -hex 16)'; \
./test 2> $${tmpLogFile}; \
echo -ne "$$( \
| > > > > > > > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
-$(RANLIB) libcackey.a
libcackey_g.a: cackey_g.o
rm -f libcackey_g.a
$(AR) rc libcackey_g.a cackey_g.o
-$(RANLIB) libcackey_g.a
libcackey_wrap.@SHOBJEXT@: libcackey_wrap.o
$(CC) $(SHOBJFLAGS) $(SHOBJLDFLAGS) -o libcackey_wrap.@SHOBJEXT@ libcackey_wrap.o
-@WEAKENSYMS@ "libcackey_wrap.@SHOBJEXT@"
-@REMOVESYMS@ "libcackey_wrap.@SHOBJEXT@"
libcackey_wrap.o: libcackey_wrap.c
$(CC) $(SHOBJFLAGS) -o libcackey_wrap.o -c libcackey_wrap.c
test: test.c libcackey_g.@SHOBJEXT@
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test test.c -Wl,-R,. libcackey_g.@SHOBJEXT@ $(LIBS)
test-afl.data: test
tmpLogFile='log.$(shell openssl rand -hex 16)'; \
./test 2> $${tmpLogFile}; \
echo -ne "$$( \
|
| ︙ | ︙ | |||
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | cp "libcackey.@SHOBJEXT@" "$(DESTDIR)$(libdir)/" -cp "libcackey_g.@SHOBJEXT@" "$(DESTDIR)$(libdir)/" clean: rm -f libcackey.@SHOBJEXT@ libcackey_g.@SHOBJEXT@ rm -f libcackey.@SHOBJEXT@.def libcackey_g.@SHOBJEXT@.def rm -f libcackey.@SHOBJEXT@.a libcackey_g.@SHOBJEXT@.a rm -f cackey.o cackey_g.o rm -f test rm -f splint-cackey.txt distclean: clean rm -f config.log config.status config.h Makefile libcackey.syms mrproper: distclean rm -f configure config.h.in aclocal.m4 *~ .PHONY: all shared static clean distclean mrproper install | > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | cp "libcackey.@SHOBJEXT@" "$(DESTDIR)$(libdir)/" -cp "libcackey_g.@SHOBJEXT@" "$(DESTDIR)$(libdir)/" clean: rm -f libcackey.@SHOBJEXT@ libcackey_g.@SHOBJEXT@ rm -f libcackey.@SHOBJEXT@.def libcackey_g.@SHOBJEXT@.def rm -f libcackey.@SHOBJEXT@.a libcackey_g.@SHOBJEXT@.a rm -f libcackey_wrap.@SHOBJEXT@ libcackey_wrap.o rm -f cackey.o cackey_g.o rm -f test rm -f splint-cackey.txt distclean: clean rm -f config.log config.status config.h Makefile libcackey.syms mrproper: distclean rm -f configure config.h.in aclocal.m4 *~ .PHONY: all shared static clean distclean mrproper install |
Modified autogen.sh from [daf2ac0fe1] to [de474aeb75].
1 2 3 4 5 6 7 8 9 10 11 |
#! /bin/sh
rm -f aclocal.m4
${MAKE:-make} -C aclocal
autoconf; autoheader
rm -rf autom4te.cache/
for basefile in install-sh config.sub config.guess; do
for path in /usr/share/automake-*; do
| > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#! /bin/sh
rm -f aclocal.m4
rm -f libcackey_wrap.c
./build/make-libcackey_wrap > libcackey_wrap.c
${MAKE:-make} -C aclocal
autoconf; autoheader
rm -rf autom4te.cache/
for basefile in install-sh config.sub config.guess; do
for path in /usr/share/automake-*; do
|
| ︙ | ︙ |
Added build/libcackey_wrap.c.in version [4c95cbc88b].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
#define _GNU_SOURCE
#include <dlfcn.h>
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define CK_PTR *
#define CK_DEFINE_FUNCTION(returnType, name) returnType name
#define CK_DECLARE_FUNCTION(returnType, name) returnType name
#define CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name)
#define CK_CALLBACK_FUNCTION(returnType, name) returnType (* name)
#ifndef NULL_PTR
# define NULL_PTR 0
#endif
#include "./pkcs11/pkcs11.h"
static void *libcackey_wrap_handle = NULL_PTR;
static void libcackey_wrap_init(void) {
Dl_info libinfo;
int dladdr_ret;
char *library, *libraryDir, *libraryDirLastSlash;
if (libcackey_wrap_handle) {
return;
}
dladdr_ret = dladdr(libcackey_wrap_init, &libinfo);
if (dladdr_ret == 0) {
fprintf(stderr, "Unable to resolve path: %s\n", dlerror());
abort();
return;
}
if (!libinfo.dli_fname) {
fprintf(stderr, "Unable to lookup filename\n");
abort();
return;
}
libraryDir = strdup(libinfo.dli_fname);
libraryDirLastSlash = strrchr(libraryDir, '/');
if (!libraryDirLastSlash) {
fprintf(stderr, "File name returned is not an absolute path: %s\n", libraryDir);
abort();
return;
}
*libraryDirLastSlash = '\0';
asprintf(&library, "%s/libcackey.so", libraryDir);
libcackey_wrap_handle = dlmopen(LM_ID_NEWLM, library, RTLD_LOCAL | RTLD_NOW);
if (!libcackey_wrap_handle) {
fprintf(stderr, "Unable to load \"%s\": %s\n", library, dlerror());
abort();
return;
}
free(library);
return;
}
|
Added build/make-libcackey_wrap version [833dbdb173].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 |
#! /usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
cat libcackey_wrap.c.in
grep '^CK_DEFINE_FUNCTION' ../cackey.c | while IFS='' read -r line; do
function="$(echo "${line}" | cut -f 2 -d , | cut -f 1 -d ')' | sed 's@ *@@g')"
args="$(echo "${line}" | cut -f 3 -d '(' | cut -f 1 -d ')' | tr ',' $'\n' | sed 's@^ *@@')"
argNames=()
while read argType argName; do
argNames=("${argNames[@]}" "${argName}")
done <<<"${args}"
argNamesList=''
for argName in "${argNames[@]}"; do
argNamesList="${argNamesList}, ${argName}"
done
argNamesList="$(echo "${argNamesList}" | cut -c 3-)"
echo ''
echo "${line}"
echo $'\t'"CK_RV (*func)($(echo "${args}" | tr $'\n' ',' | sed 's@,*$@@;s@,@, @g'));"
echo ''
echo $'\t''libcackey_wrap_init();'
echo ''
echo $'\t'"func = dlsym(libcackey_wrap_handle, \"${function}\");"
echo ''
echo $'\t'"return(func($argNamesList));"
echo '}'
done
|