1 |
commit: d466db1a9e1c9b8db831c1e3cac3a316be185762 |
2 |
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Nov 15 11:29:49 2018 +0000 |
4 |
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Nov 15 11:31:21 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d466db1a |
7 |
|
8 |
net-libs/liboauth: EAPI-7 revbump and openssl-1.1 fix |
9 |
|
10 |
Closes: https://bugs.gentoo.org/671178 |
11 |
Package-Manager: Portage-2.3.51, Repoman-2.3.12 |
12 |
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org> |
13 |
|
14 |
.../files/liboauth-1.0.3-openssl-1.1.patch | 143 +++++++++++++++++++++ |
15 |
net-libs/liboauth/liboauth-1.0.3-r1.ebuild | 80 ++++++++++++ |
16 |
2 files changed, 223 insertions(+) |
17 |
|
18 |
diff --git a/net-libs/liboauth/files/liboauth-1.0.3-openssl-1.1.patch b/net-libs/liboauth/files/liboauth-1.0.3-openssl-1.1.patch |
19 |
new file mode 100644 |
20 |
index 00000000000..f39747fd12f |
21 |
--- /dev/null |
22 |
+++ b/net-libs/liboauth/files/liboauth-1.0.3-openssl-1.1.patch |
23 |
@@ -0,0 +1,143 @@ |
24 |
+From bf51f1f17bdfcdbf09b7edad9995ccbf17c41109 Mon Sep 17 00:00:00 2001 |
25 |
+From: Lars Wendler <polynomial-c@g.o> |
26 |
+Date: Thu, 15 Nov 2018 12:11:11 +0100 |
27 |
+Subject: [PATCH] Fixed build with openssl-1.1 |
28 |
+ |
29 |
+https://github.com/x42/liboauth/issues/9 |
30 |
+--- |
31 |
+ src/hash.c | 60 +++++++++++++++++++++++++++++++++++------------------- |
32 |
+ 1 file changed, 39 insertions(+), 21 deletions(-) |
33 |
+ |
34 |
+diff --git a/src/hash.c b/src/hash.c |
35 |
+index 17ff5c8..551991f 100644 |
36 |
+--- a/src/hash.c |
37 |
++++ b/src/hash.c |
38 |
+@@ -362,6 +362,11 @@ looser: |
39 |
+ #include "oauth.h" // base64 encode fn's. |
40 |
+ #include <openssl/hmac.h> |
41 |
+ |
42 |
++#if OPENSSL_VERSION_NUMBER < 0x10100000 |
43 |
++#define EVP_MD_CTX_new EVP_MD_CTX_create |
44 |
++#define EVP_MD_CTX_free EVP_MD_CTX_destroy |
45 |
++#endif |
46 |
++ |
47 |
+ char *oauth_sign_hmac_sha1 (const char *m, const char *k) { |
48 |
+ return(oauth_sign_hmac_sha1_raw (m, strlen(m), k, strlen(k))); |
49 |
+ } |
50 |
+@@ -386,7 +391,7 @@ char *oauth_sign_rsa_sha1 (const char *m, const char *k) { |
51 |
+ unsigned char *sig = NULL; |
52 |
+ unsigned char *passphrase = NULL; |
53 |
+ unsigned int len=0; |
54 |
+- EVP_MD_CTX md_ctx; |
55 |
++ EVP_MD_CTX *md_ctx; |
56 |
+ |
57 |
+ EVP_PKEY *pkey; |
58 |
+ BIO *in; |
59 |
+@@ -399,24 +404,31 @@ char *oauth_sign_rsa_sha1 (const char *m, const char *k) { |
60 |
+ return xstrdup("liboauth/OpenSSL: can not read private key"); |
61 |
+ } |
62 |
+ |
63 |
++ md_ctx = EVP_MD_CTX_new(); |
64 |
++ if (md_ctx == NULL) { |
65 |
++ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX"); |
66 |
++ } |
67 |
++ |
68 |
+ len = EVP_PKEY_size(pkey); |
69 |
+ sig = (unsigned char*)xmalloc((len+1)*sizeof(char)); |
70 |
+ |
71 |
+- EVP_SignInit(&md_ctx, EVP_sha1()); |
72 |
+- EVP_SignUpdate(&md_ctx, m, strlen(m)); |
73 |
+- if (EVP_SignFinal (&md_ctx, sig, &len, pkey)) { |
74 |
++ EVP_SignInit(md_ctx, EVP_sha1()); |
75 |
++ EVP_SignUpdate(md_ctx, m, strlen(m)); |
76 |
++ if (EVP_SignFinal (md_ctx, sig, &len, pkey)) { |
77 |
+ char *tmp; |
78 |
+ sig[len] = '\0'; |
79 |
+ tmp = oauth_encode_base64(len,sig); |
80 |
+ OPENSSL_free(sig); |
81 |
+ EVP_PKEY_free(pkey); |
82 |
++ EVP_MD_CTX_free(md_ctx); |
83 |
+ return tmp; |
84 |
+ } |
85 |
++ EVP_MD_CTX_free(md_ctx); |
86 |
+ return xstrdup("liboauth/OpenSSL: rsa-sha1 signing failed"); |
87 |
+ } |
88 |
+ |
89 |
+ int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) { |
90 |
+- EVP_MD_CTX md_ctx; |
91 |
++ EVP_MD_CTX *md_ctx; |
92 |
+ EVP_PKEY *pkey; |
93 |
+ BIO *in; |
94 |
+ X509 *cert = NULL; |
95 |
+@@ -440,10 +452,10 @@ int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) { |
96 |
+ b64d= (unsigned char*) xmalloc(sizeof(char)*strlen(s)); |
97 |
+ slen = oauth_decode_base64(b64d, s); |
98 |
+ |
99 |
+- EVP_VerifyInit(&md_ctx, EVP_sha1()); |
100 |
+- EVP_VerifyUpdate(&md_ctx, m, strlen(m)); |
101 |
+- err = EVP_VerifyFinal(&md_ctx, b64d, slen, pkey); |
102 |
+- EVP_MD_CTX_cleanup(&md_ctx); |
103 |
++ EVP_VerifyInit(md_ctx, EVP_sha1()); |
104 |
++ EVP_VerifyUpdate(md_ctx, m, strlen(m)); |
105 |
++ err = EVP_VerifyFinal(md_ctx, b64d, slen, pkey); |
106 |
++ EVP_MD_CTX_cleanup(md_ctx); |
107 |
+ EVP_PKEY_free(pkey); |
108 |
+ xfree(b64d); |
109 |
+ return (err); |
110 |
+@@ -455,35 +467,41 @@ int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) { |
111 |
+ */ |
112 |
+ char *oauth_body_hash_file(char *filename) { |
113 |
+ unsigned char fb[BUFSIZ]; |
114 |
+- EVP_MD_CTX ctx; |
115 |
++ EVP_MD_CTX *ctx; |
116 |
+ size_t len=0; |
117 |
+ unsigned char *md; |
118 |
+ FILE *F= fopen(filename, "r"); |
119 |
+ if (!F) return NULL; |
120 |
+ |
121 |
+- EVP_MD_CTX_init(&ctx); |
122 |
+- EVP_DigestInit(&ctx,EVP_sha1()); |
123 |
++ ctx = EVP_MD_CTX_new(); |
124 |
++ if (ctx == NULL) { |
125 |
++ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX"); |
126 |
++ } |
127 |
++ EVP_DigestInit(ctx,EVP_sha1()); |
128 |
+ while (!feof(F) && (len=fread(fb,sizeof(char),BUFSIZ, F))>0) { |
129 |
+- EVP_DigestUpdate(&ctx, fb, len); |
130 |
++ EVP_DigestUpdate(ctx, fb, len); |
131 |
+ } |
132 |
+ fclose(F); |
133 |
+ len=0; |
134 |
+ md=(unsigned char*) xcalloc(EVP_MD_size(EVP_sha1()),sizeof(unsigned char)); |
135 |
+- EVP_DigestFinal(&ctx, md,(unsigned int*) &len); |
136 |
+- EVP_MD_CTX_cleanup(&ctx); |
137 |
++ EVP_DigestFinal(ctx, md,(unsigned int*) &len); |
138 |
++ EVP_MD_CTX_cleanup(ctx); |
139 |
+ return oauth_body_hash_encode(len, md); |
140 |
+ } |
141 |
+ |
142 |
+ char *oauth_body_hash_data(size_t length, const char *data) { |
143 |
+- EVP_MD_CTX ctx; |
144 |
++ EVP_MD_CTX *ctx; |
145 |
+ size_t len=0; |
146 |
+ unsigned char *md; |
147 |
+ md=(unsigned char*) xcalloc(EVP_MD_size(EVP_sha1()),sizeof(unsigned char)); |
148 |
+- EVP_MD_CTX_init(&ctx); |
149 |
+- EVP_DigestInit(&ctx,EVP_sha1()); |
150 |
+- EVP_DigestUpdate(&ctx, data, length); |
151 |
+- EVP_DigestFinal(&ctx, md,(unsigned int*) &len); |
152 |
+- EVP_MD_CTX_cleanup(&ctx); |
153 |
++ ctx = EVP_MD_CTX_new(); |
154 |
++ if (ctx == NULL) { |
155 |
++ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX"); |
156 |
++ } |
157 |
++ EVP_DigestInit(ctx,EVP_sha1()); |
158 |
++ EVP_DigestUpdate(ctx, data, length); |
159 |
++ EVP_DigestFinal(ctx, md,(unsigned int*) &len); |
160 |
++ EVP_MD_CTX_free(ctx); |
161 |
+ return oauth_body_hash_encode(len, md); |
162 |
+ } |
163 |
+ |
164 |
+-- |
165 |
+2.19.1 |
166 |
+ |
167 |
|
168 |
diff --git a/net-libs/liboauth/liboauth-1.0.3-r1.ebuild b/net-libs/liboauth/liboauth-1.0.3-r1.ebuild |
169 |
new file mode 100644 |
170 |
index 00000000000..96cf577256e |
171 |
--- /dev/null |
172 |
+++ b/net-libs/liboauth/liboauth-1.0.3-r1.ebuild |
173 |
@@ -0,0 +1,80 @@ |
174 |
+# Copyright 1999-2018 Gentoo Authors |
175 |
+# Distributed under the terms of the GNU General Public License v2 |
176 |
+ |
177 |
+EAPI=7 |
178 |
+ |
179 |
+DESCRIPTION="C library implementing the OAuth secure authentication protocol" |
180 |
+HOMEPAGE="http://liboauth.sourceforge.net/" |
181 |
+SRC_URI="mirror://sourceforge/project/${PN}/${P}.tar.gz" |
182 |
+ |
183 |
+LICENSE="|| ( GPL-2 MIT )" |
184 |
+SLOT="0" |
185 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x64-macos" |
186 |
+IUSE="bindist curl doc libressl +nss" |
187 |
+ |
188 |
+REQUIRED_USE="bindist? ( nss )" |
189 |
+ |
190 |
+PATCHES=( |
191 |
+ "${FILESDIR}"/${PN}-1.0.1-doxygen-out-of-tree.patch |
192 |
+ "${FILESDIR}"/${PN}-1.0.3-openssl-1.1.patch |
193 |
+) |
194 |
+ |
195 |
+CDEPEND=" |
196 |
+ curl? ( net-misc/curl ) |
197 |
+ nss? ( dev-libs/nss |
198 |
+ curl? ( || ( |
199 |
+ net-misc/curl[ssl,curl_ssl_nss] |
200 |
+ net-misc/curl[-ssl] |
201 |
+ ) ) |
202 |
+ ) |
203 |
+ !nss? ( |
204 |
+ !libressl? ( dev-libs/openssl:0= ) |
205 |
+ libressl? ( dev-libs/libressl:= ) |
206 |
+ curl? ( || ( |
207 |
+ net-misc/curl[ssl,curl_ssl_openssl] |
208 |
+ net-misc/curl[-ssl] |
209 |
+ ) ) |
210 |
+ ) |
211 |
+" |
212 |
+ |
213 |
+RDEPEND="${CDEPEND}" |
214 |
+ |
215 |
+DEPEND=" |
216 |
+ ${CDEPEND} |
217 |
+ doc? ( |
218 |
+ app-doc/doxygen |
219 |
+ media-gfx/graphviz |
220 |
+ media-fonts/freefont |
221 |
+ ) |
222 |
+" |
223 |
+BDEPEND=" |
224 |
+ virtual/pkgconfig |
225 |
+" |
226 |
+ |
227 |
+src_configure() { |
228 |
+ local myeconfargs=( |
229 |
+ --disable-static |
230 |
+ $(use_enable !curl curl) |
231 |
+ $(use_enable curl libcurl) |
232 |
+ $(use_enable nss) |
233 |
+ ) |
234 |
+ econf "${myeconfargs[@]}" |
235 |
+} |
236 |
+ |
237 |
+src_compile() { |
238 |
+ default |
239 |
+ |
240 |
+ if use doc ; then |
241 |
+ # make sure fonts are found |
242 |
+ export DOTFONTPATH="${EPREFIX}"/usr/share/fonts/freefont-ttf |
243 |
+ emake dox |
244 |
+ fi |
245 |
+} |
246 |
+ |
247 |
+DOCS=( AUTHORS ChangeLog LICENSE.OpenSSL README ) |
248 |
+ |
249 |
+src_install() { |
250 |
+ use doc && HTML_DOCS=( doc/html/. ) |
251 |
+ default |
252 |
+ find "${ED}" -name "*.la" -delete || die |
253 |
+} |