liboauth con soporte para libressl
This commit is contained in:
parent
b4be238e85
commit
65e72f04ba
6 changed files with 306 additions and 0 deletions
BIN
net-libs/liboauth/.liboauth-1.0.3-r100.ebuild.swp
Normal file
BIN
net-libs/liboauth/.liboauth-1.0.3-r100.ebuild.swp
Normal file
Binary file not shown.
5
net-libs/liboauth/Manifest
Normal file
5
net-libs/liboauth/Manifest
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
AUX liboauth-1.0.1-doxygen-out-of-tree.patch 2231 BLAKE2B 61523955ac500d63879dae34d5cb3507916b49edbf487ce007db7b20d2da58404161a5a6ba063cec86d9507c074a232ea58688f5de2deb6147815b9b5501cd9b SHA512 c7ac48e30ededc7079a08504ae78f421b843100dec2c8658d75ff7a3101660087de962d73ac73bf1023286b0a89c1d1b3187ba36336d1caf051b03d445571dd6
|
||||||
|
AUX liboauth-1.0.3-openssl-1.1.patch 4483 BLAKE2B 4d2628448a1341cc41a676d5002c7f0f17af384fafde77687bc83235d90f4b6b853bbc9a4262fd4acaa0b04cb67d586bca308bb9c66fafbe7de1734fb39a4c1b SHA512 90ae75bbaf7296826f813df852263901ad8632579b5e5dd1e8b1edc4719d3f749ffc30e6348ffc2ddd5239de544c934382f52c4d62e90b3e655fd9630b5b4880
|
||||||
|
DIST liboauth-1.0.3.tar.gz 504950 BLAKE2B 56cf10574af58995de9bf86bb7f00becb360cc899bf1ddb23804820d63ae2c7af29aa29031f68ce79a6cc441cbce27aebf5f1c9dfa029243d7732592d03620c7 SHA512 5a13818dbb3e0df76f7a3fde451eff4f90c9bebfe2076a294921af0c07c2b0789f717f0f862ac6961562d4227e016dc198ddd7efb9c7ac599c3bfbcdb2ac33fa
|
||||||
|
EBUILD liboauth-1.0.3-r100.ebuild 1628 BLAKE2B 7fb8143c4accae8ee5fede5a0d8e4b4eebff934fb482054f7e454edaeaeaf81343e6974737b65d931466340bc547660008c046b265ab954b23313e3af1d4f02b SHA512 a9fe5440ab98a02b5effc4c08db73127b6e4a7fffacf6624a5f9c2b5229513bce376433c9a9bb4f6af175b713ee164c088c2f675063dd2531a30a5ff8209effd
|
||||||
|
MISC metadata.xml 879 BLAKE2B 499e638089270b30e1fc4a15008592e036c05032719e05ef06cc4c897be1bebe3d4873caacec09f6c54f65240da2582fee0776aa7e0b89508e98c4a3a668f870 SHA512 05625ec768286997f291d95e40e024c692bb8dd3be2d2eea1c3d7c90b452b9a98988a2ca43a5c6134a0e084e0a4ae40af4a00e809092edbcf3a0630781657a07
|
|
@ -0,0 +1,50 @@
|
||||||
|
diff -urp liboauth-1.0.1-orig/Doxyfile.in liboauth-1.0.1/Doxyfile.in
|
||||||
|
--- liboauth-1.0.1-orig/Doxyfile.in 2012-11-01 04:34:49.000000000 +0000
|
||||||
|
+++ liboauth-1.0.1/Doxyfile.in 2013-03-14 14:25:11.000000000 +0000
|
||||||
|
@@ -45,7 +45,7 @@ PROJECT_BRIEF =
|
||||||
|
# exceed 55 pixels and the maximum width should not exceed 200 pixels.
|
||||||
|
# Doxygen will copy the logo to the output directory.
|
||||||
|
|
||||||
|
-PROJECT_LOGO = doc/libOAuth.png
|
||||||
|
+PROJECT_LOGO = @top_srcdir@/doc/libOAuth.png
|
||||||
|
|
||||||
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
|
# base path where the generated documentation will be put.
|
||||||
|
@@ -130,7 +130,7 @@ FULL_PATH_NAMES = YES
|
||||||
|
# relative paths, which will be relative from the directory where doxygen is
|
||||||
|
# started.
|
||||||
|
|
||||||
|
-STRIP_FROM_PATH = src/
|
||||||
|
+STRIP_FROM_PATH = @top_srcdir@/src/
|
||||||
|
|
||||||
|
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
|
||||||
|
# the path mentioned in the documentation of a class, which tells
|
||||||
|
@@ -661,8 +661,8 @@ WARN_LOGFILE =
|
||||||
|
# directories like "/usr/src/myproject". Separate the files or directories
|
||||||
|
# with spaces.
|
||||||
|
|
||||||
|
-INPUT = src/oauth.h \
|
||||||
|
- doc/mainpage.dox
|
||||||
|
+INPUT = @top_srcdir@/src/oauth.h \
|
||||||
|
+ @top_srcdir@/doc/mainpage.dox
|
||||||
|
|
||||||
|
# This tag can be used to specify the character encoding of the source files
|
||||||
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||||
|
@@ -722,7 +722,7 @@ EXCLUDE_SYMBOLS =
|
||||||
|
# directories that contain example code fragments that are included (see
|
||||||
|
# the \include command).
|
||||||
|
|
||||||
|
-EXAMPLE_PATH = tests/
|
||||||
|
+EXAMPLE_PATH = @top_srcdir@/tests/
|
||||||
|
|
||||||
|
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
|
||||||
|
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
|
||||||
|
@@ -742,7 +742,7 @@ EXAMPLE_RECURSIVE = NO
|
||||||
|
# directories that contain image that are included in the documentation (see
|
||||||
|
# the \image command).
|
||||||
|
|
||||||
|
-IMAGE_PATH = doc/
|
||||||
|
+IMAGE_PATH = @top_srcdir@/doc/
|
||||||
|
|
||||||
|
# The INPUT_FILTER tag can be used to specify a program that doxygen should
|
||||||
|
# invoke to filter for each input file. Doxygen will invoke the filter program
|
143
net-libs/liboauth/files/liboauth-1.0.3-openssl-1.1.patch
Normal file
143
net-libs/liboauth/files/liboauth-1.0.3-openssl-1.1.patch
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
From bf51f1f17bdfcdbf09b7edad9995ccbf17c41109 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Lars Wendler <polynomial-c@gentoo.org>
|
||||||
|
Date: Thu, 15 Nov 2018 12:11:11 +0100
|
||||||
|
Subject: [PATCH] Fixed build with openssl-1.1
|
||||||
|
|
||||||
|
https://github.com/x42/liboauth/issues/9
|
||||||
|
---
|
||||||
|
src/hash.c | 60 +++++++++++++++++++++++++++++++++++-------------------
|
||||||
|
1 file changed, 39 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/hash.c b/src/hash.c
|
||||||
|
index 17ff5c8..551991f 100644
|
||||||
|
--- a/src/hash.c
|
||||||
|
+++ b/src/hash.c
|
||||||
|
@@ -362,6 +362,11 @@ looser:
|
||||||
|
#include "oauth.h" // base64 encode fn's.
|
||||||
|
#include <openssl/hmac.h>
|
||||||
|
|
||||||
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000
|
||||||
|
+#define EVP_MD_CTX_new EVP_MD_CTX_create
|
||||||
|
+#define EVP_MD_CTX_free EVP_MD_CTX_destroy
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
char *oauth_sign_hmac_sha1 (const char *m, const char *k) {
|
||||||
|
return(oauth_sign_hmac_sha1_raw (m, strlen(m), k, strlen(k)));
|
||||||
|
}
|
||||||
|
@@ -386,7 +391,7 @@ char *oauth_sign_rsa_sha1 (const char *m, const char *k) {
|
||||||
|
unsigned char *sig = NULL;
|
||||||
|
unsigned char *passphrase = NULL;
|
||||||
|
unsigned int len=0;
|
||||||
|
- EVP_MD_CTX md_ctx;
|
||||||
|
+ EVP_MD_CTX *md_ctx;
|
||||||
|
|
||||||
|
EVP_PKEY *pkey;
|
||||||
|
BIO *in;
|
||||||
|
@@ -399,24 +404,31 @@ char *oauth_sign_rsa_sha1 (const char *m, const char *k) {
|
||||||
|
return xstrdup("liboauth/OpenSSL: can not read private key");
|
||||||
|
}
|
||||||
|
|
||||||
|
+ md_ctx = EVP_MD_CTX_new();
|
||||||
|
+ if (md_ctx == NULL) {
|
||||||
|
+ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
len = EVP_PKEY_size(pkey);
|
||||||
|
sig = (unsigned char*)xmalloc((len+1)*sizeof(char));
|
||||||
|
|
||||||
|
- EVP_SignInit(&md_ctx, EVP_sha1());
|
||||||
|
- EVP_SignUpdate(&md_ctx, m, strlen(m));
|
||||||
|
- if (EVP_SignFinal (&md_ctx, sig, &len, pkey)) {
|
||||||
|
+ EVP_SignInit(md_ctx, EVP_sha1());
|
||||||
|
+ EVP_SignUpdate(md_ctx, m, strlen(m));
|
||||||
|
+ if (EVP_SignFinal (md_ctx, sig, &len, pkey)) {
|
||||||
|
char *tmp;
|
||||||
|
sig[len] = '\0';
|
||||||
|
tmp = oauth_encode_base64(len,sig);
|
||||||
|
OPENSSL_free(sig);
|
||||||
|
EVP_PKEY_free(pkey);
|
||||||
|
+ EVP_MD_CTX_free(md_ctx);
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
+ EVP_MD_CTX_free(md_ctx);
|
||||||
|
return xstrdup("liboauth/OpenSSL: rsa-sha1 signing failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) {
|
||||||
|
- EVP_MD_CTX md_ctx;
|
||||||
|
+ EVP_MD_CTX *md_ctx;
|
||||||
|
EVP_PKEY *pkey;
|
||||||
|
BIO *in;
|
||||||
|
X509 *cert = NULL;
|
||||||
|
@@ -440,10 +452,10 @@ int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) {
|
||||||
|
b64d= (unsigned char*) xmalloc(sizeof(char)*strlen(s));
|
||||||
|
slen = oauth_decode_base64(b64d, s);
|
||||||
|
|
||||||
|
- EVP_VerifyInit(&md_ctx, EVP_sha1());
|
||||||
|
- EVP_VerifyUpdate(&md_ctx, m, strlen(m));
|
||||||
|
- err = EVP_VerifyFinal(&md_ctx, b64d, slen, pkey);
|
||||||
|
- EVP_MD_CTX_cleanup(&md_ctx);
|
||||||
|
+ EVP_VerifyInit(md_ctx, EVP_sha1());
|
||||||
|
+ EVP_VerifyUpdate(md_ctx, m, strlen(m));
|
||||||
|
+ err = EVP_VerifyFinal(md_ctx, b64d, slen, pkey);
|
||||||
|
+ EVP_MD_CTX_cleanup(md_ctx);
|
||||||
|
EVP_PKEY_free(pkey);
|
||||||
|
xfree(b64d);
|
||||||
|
return (err);
|
||||||
|
@@ -455,35 +467,41 @@ int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) {
|
||||||
|
*/
|
||||||
|
char *oauth_body_hash_file(char *filename) {
|
||||||
|
unsigned char fb[BUFSIZ];
|
||||||
|
- EVP_MD_CTX ctx;
|
||||||
|
+ EVP_MD_CTX *ctx;
|
||||||
|
size_t len=0;
|
||||||
|
unsigned char *md;
|
||||||
|
FILE *F= fopen(filename, "r");
|
||||||
|
if (!F) return NULL;
|
||||||
|
|
||||||
|
- EVP_MD_CTX_init(&ctx);
|
||||||
|
- EVP_DigestInit(&ctx,EVP_sha1());
|
||||||
|
+ ctx = EVP_MD_CTX_new();
|
||||||
|
+ if (ctx == NULL) {
|
||||||
|
+ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX");
|
||||||
|
+ }
|
||||||
|
+ EVP_DigestInit(ctx,EVP_sha1());
|
||||||
|
while (!feof(F) && (len=fread(fb,sizeof(char),BUFSIZ, F))>0) {
|
||||||
|
- EVP_DigestUpdate(&ctx, fb, len);
|
||||||
|
+ EVP_DigestUpdate(ctx, fb, len);
|
||||||
|
}
|
||||||
|
fclose(F);
|
||||||
|
len=0;
|
||||||
|
md=(unsigned char*) xcalloc(EVP_MD_size(EVP_sha1()),sizeof(unsigned char));
|
||||||
|
- EVP_DigestFinal(&ctx, md,(unsigned int*) &len);
|
||||||
|
- EVP_MD_CTX_cleanup(&ctx);
|
||||||
|
+ EVP_DigestFinal(ctx, md,(unsigned int*) &len);
|
||||||
|
+ EVP_MD_CTX_cleanup(ctx);
|
||||||
|
return oauth_body_hash_encode(len, md);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *oauth_body_hash_data(size_t length, const char *data) {
|
||||||
|
- EVP_MD_CTX ctx;
|
||||||
|
+ EVP_MD_CTX *ctx;
|
||||||
|
size_t len=0;
|
||||||
|
unsigned char *md;
|
||||||
|
md=(unsigned char*) xcalloc(EVP_MD_size(EVP_sha1()),sizeof(unsigned char));
|
||||||
|
- EVP_MD_CTX_init(&ctx);
|
||||||
|
- EVP_DigestInit(&ctx,EVP_sha1());
|
||||||
|
- EVP_DigestUpdate(&ctx, data, length);
|
||||||
|
- EVP_DigestFinal(&ctx, md,(unsigned int*) &len);
|
||||||
|
- EVP_MD_CTX_cleanup(&ctx);
|
||||||
|
+ ctx = EVP_MD_CTX_new();
|
||||||
|
+ if (ctx == NULL) {
|
||||||
|
+ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX");
|
||||||
|
+ }
|
||||||
|
+ EVP_DigestInit(ctx,EVP_sha1());
|
||||||
|
+ EVP_DigestUpdate(ctx, data, length);
|
||||||
|
+ EVP_DigestFinal(ctx, md,(unsigned int*) &len);
|
||||||
|
+ EVP_MD_CTX_free(ctx);
|
||||||
|
return oauth_body_hash_encode(len, md);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.19.1
|
||||||
|
|
84
net-libs/liboauth/liboauth-1.0.3-r100.ebuild
Normal file
84
net-libs/liboauth/liboauth-1.0.3-r100.ebuild
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
# Copyright 1999-2018 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=7
|
||||||
|
|
||||||
|
DESCRIPTION="C library implementing the OAuth secure authentication protocol"
|
||||||
|
HOMEPAGE="http://liboauth.sourceforge.net/"
|
||||||
|
SRC_URI="mirror://sourceforge/project/${PN}/${P}.tar.gz"
|
||||||
|
|
||||||
|
LICENSE="|| ( GPL-2 MIT )"
|
||||||
|
SLOT="0"
|
||||||
|
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x64-macos"
|
||||||
|
IUSE="bindist curl doc libressl +nss"
|
||||||
|
|
||||||
|
REQUIRED_USE="bindist? ( nss )"
|
||||||
|
|
||||||
|
PATCHES=(
|
||||||
|
"${FILESDIR}"/${PN}-1.0.1-doxygen-out-of-tree.patch
|
||||||
|
"${FILESDIR}"/${PN}-1.0.3-openssl-1.1.patch
|
||||||
|
)
|
||||||
|
|
||||||
|
CDEPEND="
|
||||||
|
curl? ( net-misc/curl )
|
||||||
|
nss? ( dev-libs/nss
|
||||||
|
curl? ( || (
|
||||||
|
net-misc/curl[ssl,curl_ssl_nss]
|
||||||
|
net-misc/curl[-ssl]
|
||||||
|
) )
|
||||||
|
)
|
||||||
|
!nss? (
|
||||||
|
!libressl? ( dev-libs/openssl:0=
|
||||||
|
curl? ( || (
|
||||||
|
net-misc/curl[ssl,curl_ssl_openssl]
|
||||||
|
net-misc/curl[-ssl]
|
||||||
|
) ) )
|
||||||
|
libressl? ( dev-libs/libressl:=
|
||||||
|
curl? ( || (
|
||||||
|
net-misc/curl[ssl,curl_ssl_libressl]
|
||||||
|
net-misc/curl[-ssl]
|
||||||
|
) ) )
|
||||||
|
)
|
||||||
|
"
|
||||||
|
|
||||||
|
RDEPEND="${CDEPEND}"
|
||||||
|
|
||||||
|
DEPEND="
|
||||||
|
${CDEPEND}
|
||||||
|
doc? (
|
||||||
|
app-doc/doxygen
|
||||||
|
media-gfx/graphviz
|
||||||
|
media-fonts/freefont
|
||||||
|
)
|
||||||
|
"
|
||||||
|
BDEPEND="
|
||||||
|
virtual/pkgconfig
|
||||||
|
"
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
local myeconfargs=(
|
||||||
|
--disable-static
|
||||||
|
$(use_enable !curl curl)
|
||||||
|
$(use_enable curl libcurl)
|
||||||
|
$(use_enable nss)
|
||||||
|
)
|
||||||
|
econf "${myeconfargs[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
default
|
||||||
|
|
||||||
|
if use doc ; then
|
||||||
|
# make sure fonts are found
|
||||||
|
export DOTFONTPATH="${EPREFIX}"/usr/share/fonts/freefont-ttf
|
||||||
|
emake dox
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
DOCS=( AUTHORS ChangeLog LICENSE.OpenSSL README )
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
use doc && HTML_DOCS=( doc/html/. )
|
||||||
|
default
|
||||||
|
find "${ED}" -name "*.la" -delete || die
|
||||||
|
}
|
24
net-libs/liboauth/metadata.xml
Normal file
24
net-libs/liboauth/metadata.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<!-- maintainer-needed -->
|
||||||
|
<use>
|
||||||
|
<flag name="nss">
|
||||||
|
Use Mozilla NSS (<pkg>dev-libs/nss</pkg>) as hash library; if
|
||||||
|
this is disabled, <pkg>dev-libs/openssl</pkg> is used instead.
|
||||||
|
</flag>
|
||||||
|
<flag name="bindist">
|
||||||
|
Alias for the nss USE flag, since there are license compliancy
|
||||||
|
trouble when using OpenSSL.
|
||||||
|
</flag>
|
||||||
|
<flag name="curl">
|
||||||
|
If enabled, <pkg>net-misc/curl</pkg> is used thorugh the libcurl
|
||||||
|
library; if it's not, the curl command is used instead. Some
|
||||||
|
features are only available when using the library, but using it
|
||||||
|
as library requires matching SSL implementations.
|
||||||
|
</flag>
|
||||||
|
</use>
|
||||||
|
<upstream>
|
||||||
|
<remote-id type="sourceforge">liboauth</remote-id>
|
||||||
|
</upstream>
|
||||||
|
</pkgmetadata>
|
Loading…
Reference in a new issue