diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-libs/libp11 | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-libs/libp11')
-rw-r--r-- | dev-libs/libp11/Manifest | 1 | ||||
-rw-r--r-- | dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch | 196 | ||||
-rw-r--r-- | dev-libs/libp11/files/libp11-0.2.8-variable-buffer-size.patch | 114 | ||||
-rw-r--r-- | dev-libs/libp11/libp11-0.2.8-r3.ebuild | 41 | ||||
-rw-r--r-- | dev-libs/libp11/metadata.xml | 18 |
5 files changed, 370 insertions, 0 deletions
diff --git a/dev-libs/libp11/Manifest b/dev-libs/libp11/Manifest new file mode 100644 index 000000000000..be0fb11751da --- /dev/null +++ b/dev-libs/libp11/Manifest @@ -0,0 +1 @@ +DIST libp11-0.2.8.tar.gz 377508 SHA256 a4121015503ade98074b5e2a2517fc8a139f8b28aed10021db2bb77283f40691 SHA512 917c6623942c83e7657c9b9c4ce0482ffc4539fc29edec9ace412dcece640be3785bf82e09e344c0866b55619ea011ab829ef3d4f8205f2019121d837b1d6c17 WHIRLPOOL fe4f8c6ce952e8a0985bf90af1413c0ba2c2ac84309b1cad55c12f65aa77655e4b9154e1af53d55ba968f9c88a960efd44a4033bcbaa309958f35327eeeac0d9 diff --git a/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch b/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch new file mode 100644 index 000000000000..f3997ba65ba1 --- /dev/null +++ b/dev-libs/libp11/files/libp11-0.2.8-no-ltdl.patch @@ -0,0 +1,196 @@ +patch from upstream + +From 1c872a3e9c4cbf3cbd485168a7e98b589bbad57a Mon Sep 17 00:00:00 2001 +From: alonbl <alonbl@6d86ddd8-19ff-0310-a323-aa2ba648d307> +Date: Wed, 14 Dec 2011 10:46:45 +0000 +Subject: [PATCH] Remove ltdl usage + +Use native POSIX/Windows + + +git-svn-id: http://www.opensc-project.org/svn/libp11/trunk@202 6d86ddd8-19ff-0310-a323-aa2ba648d307 +--- + configure.ac | 23 +++++------------------ + src/Makefile.am | 4 ++-- + src/Makefile.mak | 7 ++----- + src/libpkcs11.c | 52 +++++++++++++++++++++++++++++++++++++++------------- + 4 files changed, 48 insertions(+), 38 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 679b8da..9fa96bf 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -180,25 +180,14 @@ if test "${svn_checkout}" = "yes"; then + fi + fi + +-AC_ARG_VAR([LTLIB_CFLAGS], [C compiler flags for libltdl]) +-AC_ARG_VAR([LTLIB_LIBS], [linker flags for libltdl]) +-if test -z "${LTLIB_LIBS}"; then ++if test "${WIN32}" != "yes"; then + AC_CHECK_LIB( +- [ltdl], +- [lt_dlopen], +- [LTLIB_LIBS="-lltdl"], +- [AC_MSG_ERROR([ltdl not found, please install libltdl and/or libtool])] ++ [dl], ++ [dlopen], ++ , ++ [AC_MSG_ERROR([libdl required])] + ) +- + fi +-saved_CFLAGS="${CFLAGS}" +-CFLAGS="${CFLAGS} ${LTLIB_CFLAGS}" +-AC_CHECK_HEADER( +- [ltdl.h], +- , +- [AC_MSG_ERROR([ltdl.h not found, please install libltdl and/or libtool])] +-) +-CFLAGS="${saved_CFLAGS}" + + PKG_CHECK_MODULES( + [OPENSSL], +@@ -273,8 +262,6 @@ Compiler flags: ${CFLAGS} + Linker flags: ${LDFLAGS} + Libraries: ${LIBS} + +-LTLIB_CFLAGS: ${LTLIB_CFLAGS} +-LTLIB_LIBS: ${LTLIB_LIBS} + OPENSSL_CFLAGS: ${OPENSSL_CFLAGS} + OPENSSL_LIBS: ${OPENSSL_LIBS} + +diff --git a/src/Makefile.am b/src/Makefile.am +index c66a8cd..0910f44 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -16,8 +16,8 @@ libp11_la_SOURCES += versioninfo.rc + else + dist_noinst_DATA = versioninfo.rc + endif +-libp11_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS) $(LTLIB_CFLAGS) +-libp11_la_LIBADD = $(OPENSSL_LIBS) $(LTLIB_LIBS) ++libp11_la_CFLAGS = $(AM_CFLAGS) $(OPENSSL_CFLAGS) ++libp11_la_LIBADD = $(OPENSSL_LIBS) + libp11_la_LDFLAGS = $(AM_LDFLAGS) \ + -version-info @LIBP11_LT_CURRENT@:@LIBP11_LT_REVISION@:@LIBP11_LT_AGE@ \ + -export-symbols "$(srcdir)/libp11.exports" \ +diff --git a/src/Makefile.mak b/src/Makefile.mak +index 73b5428..fa0809c 100644 +--- a/src/Makefile.mak ++++ b/src/Makefile.mak +@@ -1,10 +1,7 @@ +-LIBLTDL_INC = # E.g. /IC:\libtool-1.5.8-lib\include +-LIBLTDL_LIB = # E.g. C:\libtool-1.5.8-lib\lib\libltdl.lib +- + OPENSSL_INC = /IC:\openssl\include + OPENSSL_LIB = C:\openssl\out32dll\libeay32.lib + +-COPTS = /Zi /MD /nologo /I..\ /I. $(OPENSSL_INC) $(LIBLTDL_INC) /D_WIN32_WINNT=0x0400 /DWIN32 /DWIN32_LEAN_AND_MEAN ++COPTS = /Zi /MD /nologo /I..\ /I. $(OPENSSL_INC) /D_WIN32_WINNT=0x0400 /DWIN32 /DWIN32_LEAN_AND_MEAN + LINKFLAGS = /DEBUG /NOLOGO /INCREMENTAL:NO /MACHINE:IX86 + + TARGET = libp11.dll +@@ -28,6 +25,6 @@ $(TARGET): $(OBJECTS) versioninfo.res + echo EXPORTS >> $*.def + type $*.exports >> $*.def + link $(LINKFLAGS) /dll /def:$*.def /implib:$*.lib /out:$(TARGET) \ +- $(OBJECTS) $(OPENSSL_LIB) $(LIBLTDL_LIB) versioninfo.res ++ $(OBJECTS) $(OPENSSL_LIB) versioninfo.res + if EXIST $*.dll.manifest mt -manifest $*.dll.manifest -outputresource:$*.dll;2 + +diff --git a/src/libpkcs11.c b/src/libpkcs11.c +index a146361..93584d9 100644 +--- a/src/libpkcs11.c ++++ b/src/libpkcs11.c +@@ -27,14 +27,18 @@ + #include <stdlib.h> + #include <stdio.h> + #include <string.h> +-#include <ltdl.h> ++#ifdef WIN32 ++#include <windows.h> ++#else ++#include <dlfcn.h> ++#endif + #include "libp11-int.h" + + #define MAGIC 0xd00bed00 + + struct sc_pkcs11_module { + unsigned int _magic; +- lt_dlhandle handle; ++ void *handle; + }; + typedef struct sc_pkcs11_module sc_pkcs11_module_t; + +@@ -52,19 +56,40 @@ C_LoadModule(const char *mspec, CK_FUNCTION_LIST_PTR_PTR funcs) + if (mspec == NULL) + return NULL; + +- if (lt_dlinit() != 0) +- return NULL; +- + mod = (sc_pkcs11_module_t *) calloc(1, sizeof(*mod)); + mod->_magic = MAGIC; + +- mod->handle = lt_dlopen(mspec); ++#ifdef WIN32 ++ mod->handle = LoadLibraryA(mspec); ++#else ++ mod->handle = dlopen(mspec, RTLD_NOW); ++#endif ++ + if (mod->handle == NULL) + goto failed; + +- /* Get the list of function pointers */ +- c_get_function_list = (CK_RV (*)(CK_FUNCTION_LIST_PTR_PTR)) +- lt_dlsym(mod->handle, "C_GetFunctionList"); ++#ifdef WIN32 ++ c_get_function_list = (CK_C_GetFunctionList)GetProcAddress ( ++ mod->handle, ++ "C_GetFunctionList" ++ ); ++#else ++ { ++ /* ++ * Make compiler happy! ++ */ ++ void *p = dlsym( ++ mod->handle, ++ "C_GetFunctionList" ++ ); ++ memmove( ++ &c_get_function_list, ++ &p, ++ sizeof(void *) ++ ); ++ } ++#endif ++ + if (!c_get_function_list) + goto failed; + rv = c_get_function_list(funcs); +@@ -89,13 +114,14 @@ C_UnloadModule(void *module) + if (!mod || mod->_magic != MAGIC) + return CKR_ARGUMENTS_BAD; + +- if (lt_dlclose(mod->handle) < 0) +- return CKR_FUNCTION_FAILED; ++#ifdef WIN32 ++ FreeLibrary(mod->handle); ++#else ++ dlclose(mod->handle); ++#endif + + memset(mod, 0, sizeof(*mod)); + free(mod); + +- lt_dlexit(); +- + return CKR_OK; + } +-- +1.7.6.1 + diff --git a/dev-libs/libp11/files/libp11-0.2.8-variable-buffer-size.patch b/dev-libs/libp11/files/libp11-0.2.8-variable-buffer-size.patch new file mode 100644 index 000000000000..8cee3fb3f058 --- /dev/null +++ b/dev-libs/libp11/files/libp11-0.2.8-variable-buffer-size.patch @@ -0,0 +1,114 @@ +3 year old upstream proposal https://www.opensc-project.org/opensc/ticket/350 + +The fixed buffers allocated in pkcs11_init_cert are too small to hold the +output data for some certificates. It causes a "Buffer too small" error +to be returned from pkcs11_getattr_var. + +Fix from Chromium OS: +Use heap instead of stack for variable length data when reading +certificate attributes. + +Patch by Paul Stewart <pstew@chromium.org> + +--- a/src/libp11-int.h ++++ b/src/libp11-int.h +@@ -136,6 +136,8 @@ + unsigned int, void *, size_t *); + extern int pkcs11_getattr_bn(PKCS11_TOKEN *, CK_OBJECT_HANDLE, + unsigned int, BIGNUM **); ++extern void *pkcs11_getattr_alloc(PKCS11_TOKEN *, CK_OBJECT_HANDLE, ++ unsigned int, size_t *); + + #define key_getattr(key, t, p, s) \ + pkcs11_getattr(KEY2TOKEN((key)), PRIVKEY((key))->object, (t), (p), (s)) +--- a/src/p11_attr.c ++++ b/src/p11_attr.c +@@ -98,6 +98,32 @@ + return *bn ? 0 : -1; + } + ++void * ++pkcs11_getattr_alloc(PKCS11_TOKEN * token, CK_OBJECT_HANDLE object, ++ unsigned int type, size_t *size_out) ++{ ++ size_t size = 0; ++ void *data = NULL; ++ ++ if (pkcs11_getattr_var(token, object, type, NULL, &size)) ++ return NULL; ++ ++ data = malloc(size); ++ if (data == NULL) ++ return NULL; ++ ++ memset(data, 0, size); ++ if (pkcs11_getattr_var(token, object, type, data, &size)) { ++ free(data); ++ return NULL; ++ } ++ ++ if (size_out != NULL) ++ *size_out = size; ++ ++ return data; ++} ++ + /* + * Add attributes to template + */ +--- a/src/p11_cert.c ++++ b/src/p11_cert.c +@@ -136,10 +136,9 @@ + PKCS11_TOKEN_private *tpriv; + PKCS11_CERT_private *kpriv; + PKCS11_CERT *cert, *tmp; +- char label[256], data[2048]; +- unsigned char id[256]; + CK_CERTIFICATE_TYPE cert_type; + size_t size; ++ void *data; + + size = sizeof(cert_type); + if (pkcs11_getattr_var(token, obj, CKA_CERTIFICATE_TYPE, &cert_type, &size)) +@@ -165,18 +164,32 @@ + kpriv->object = obj; + kpriv->parent = token; + +- if (!pkcs11_getattr_s(token, obj, CKA_LABEL, label, sizeof(label))) +- cert->label = BUF_strdup(label); +- size = sizeof(data); +- if (!pkcs11_getattr_var(token, obj, CKA_VALUE, data, &size)) { +- const unsigned char *p = (unsigned char *) data; ++ data = pkcs11_getattr_alloc(token, obj, CKA_LABEL, &size); ++ if (data != NULL) { ++ char *label = data; ++ /* Fix any null-termination issues with the label */ ++ if (label[size - 1] != '\0') { ++ label = realloc(label, size + 1); ++ if (label == NULL) { ++ free(data); ++ return -1; ++ } ++ label[size] = '\0'; ++ } ++ cert->label = label; ++ } + ++ data = pkcs11_getattr_alloc(token, obj, CKA_VALUE, &size); ++ if (data != NULL) { ++ const unsigned char *p = data; + cert->x509 = d2i_X509(NULL, &p, size); ++ free(data); + } +- cert->id_len = sizeof(id); +- if (!pkcs11_getattr_var(token, obj, CKA_ID, id, &cert->id_len)) { +- cert->id = (unsigned char *) malloc(cert->id_len); +- memcpy(cert->id, id, cert->id_len); ++ data = pkcs11_getattr_alloc(token, obj, CKA_ID, &cert->id_len); ++ if (data != NULL) { ++ cert->id = data; ++ } else { ++ cert->id_len = 0; + } + + /* Initialize internal information */ diff --git a/dev-libs/libp11/libp11-0.2.8-r3.ebuild b/dev-libs/libp11/libp11-0.2.8-r3.ebuild new file mode 100644 index 000000000000..69765ed31517 --- /dev/null +++ b/dev-libs/libp11/libp11-0.2.8-r3.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +inherit eutils autotools + +DESCRIPTION="A library implementing a layer on top of PKCS#11 API to make using PKCS#11 implementations easier" +HOMEPAGE="https://github.com/opensc/libp11/wiki" +SRC_URI="mirror://sourceforge/opensc/${PN}/${P}.tar.gz" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 ~s390 ~sh sparc x86" +IUSE="doc" + +RDEPEND="dev-libs/openssl:0" +DEPEND="${RDEPEND} + virtual/pkgconfig + doc? ( app-doc/doxygen )" + +src_prepare() { + epatch "${FILESDIR}"/${P}-no-ltdl.patch + epatch "${FILESDIR}"/${P}-variable-buffer-size.patch + eautoreconf +} + +src_configure() { + econf \ + --docdir="/usr/share/doc/${PF}" \ + --htmldir="/usr/share/doc/${PF}/html" \ + --enable-shared --disable-static \ + --enable-doc \ + $(use_enable doc api-doc) +} + +src_install() { + default + prune_libtool_files +} diff --git a/dev-libs/libp11/metadata.xml b/dev-libs/libp11/metadata.xml new file mode 100644 index 000000000000..4330eeef4bae --- /dev/null +++ b/dev-libs/libp11/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>crypto</herd> + <longdescription> + Library implementing a small layer on top of PKCS#11 API to make + using PKCS#11 implementations easier. + </longdescription> + <use> + <flag name="doc"> + Generate and install API documentation for the package. + </flag> + </use> + <upstream> + <remote-id type="github">opensc/libp11</remote-id> + <remote-id type="sourceforge">opensc</remote-id> + </upstream> +</pkgmetadata> |