Browse Source

l/liboauth: Upgraded to liboauth-1.0.3.

current-20191101
parent
commit
0a4985da0d
  1. 1
      l/liboauth/liboauth-0.9.7.tar.gz.sha1
  2. 152
      l/liboauth/liboauth-1.0.3-openssl-1.1.0-3.patch
  3. 1
      l/liboauth/liboauth-1.0.3.tar.gz.sha256
  4. 14
      l/liboauth/liboauth.SlackBuild

1
l/liboauth/liboauth-0.9.7.tar.gz.sha1

@ -1 +0,0 @@
a5a957ac1538b23a286de4e39a2c9f98ef4c3c0e liboauth-0.9.7.tar.gz

152
l/liboauth/liboauth-1.0.3-openssl-1.1.0-3.patch

@ -0,0 +1,152 @@
Submitted by: DJ Lucas (dj at linuxfromscratch dot org)
Date: 2017-05-27
Initial Package Version: 1.0.3
Update by: Bruce Dubbs
Date: 2017-06-14
Update by (#2): Douglas R. Reno <renodr at linuxfromscratch dot org>
Date: 2019-01-02
Upstream Status: Submitted
Origin: https://github.com/x42/liboauth/issues/9
Description: Fixes build issue with OpenSSL_1.1.0.
Update: Additional fix from upstream. Three lines changed.
Update #2: Rebased patch, and fixed one more missed reference to md_ctx.
diff -Naurp liboauth-1.0.3.orig/src/hash.c liboauth-1.0.3/src/hash.c
--- liboauth-1.0.3.orig/src/hash.c 2013-10-04 08:02:50.000000000 -0500
+++ liboauth-1.0.3/src/hash.c 2019-01-01 23:41:47.027037421 -0600
@@ -362,6 +362,12 @@ 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 +392,7 @@ char *oauth_sign_rsa_sha1 (const char *m
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 +405,31 @@ char *oauth_sign_rsa_sha1 (const char *m
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;
@@ -437,13 +450,19 @@ int oauth_verify_rsa_sha1 (const char *m
return -2;
}
+
+ md_ctx = EVP_MD_CTX_new();
+ if (md_ctx == NULL) {
+ return -2;
+ }
+
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_free(md_ctx);
EVP_PKEY_free(pkey);
xfree(b64d);
return (err);
@@ -455,35 +474,41 @@ int oauth_verify_rsa_sha1 (const char *m
*/
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_free(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);
}

1
l/liboauth/liboauth-1.0.3.tar.gz.sha256

@ -0,0 +1 @@
0df60157b052f0e774ade8a8bac59d6e8d4b464058cc55f9208d72e41156811f liboauth-1.0.3.tar.gz

14
l/liboauth/liboauth.SlackBuild

@ -1,6 +1,6 @@
#!/bin/bash
# Build script for Slackware
# Copyright (C) 2012 Damien Goutte-Gattat
# Copyright (C) 2012,2019 Damien Goutte-Gattat
#
# Redistribution and use of this script, with or without modifications,
# is permitted provided that the following conditions are met:
@ -27,7 +27,7 @@
# Source package infos
NAMESRC=${NAMESRC:-liboauth}
VERSION=${VERSION:-0.9.7}
VERSION=${VERSION:-1.0.3}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
WGET=${WGET:-http://downloads.sourceforge.net/liboauth/$ARCHIVE}
@ -76,7 +76,7 @@ if [ ! -r $ARCHIVE ]; then
wget -c -O $ARCHIVE.part "$WGET"
mv $ARCHIVE.part $ARCHIVE
fi
sha1sum -c $ARCHIVE.sha1
sha256sum -c $ARCHIVE.sha256
NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
# Compile
@ -84,14 +84,16 @@ cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
# Apply patch from LFS to build against recent OpenSSL
# <http://www.linuxfromscratch.org/patches/blfs/svn/liboauth-1.0.3-openssl-1.1.0-3.patch>
patch -p 1 < $CWD/liboauth-1.0.3-openssl-1.1.0-3.patch
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
./configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--mandir=/usr/man \
--disable-static \
--enable-nss
--disable-static
make -j $JOBS
make install-strip DESTDIR=$PKG
@ -100,7 +102,7 @@ find $PKG/usr/man -type f -exec gzip -9 {} \;
# Install the documentation
mkdir -p $PKG/usr/doc/$NAME
install -m 644 AUTHORS COPYING{,.GPL,.MIT} ChangeLog NEWS README \
install -m 644 AUTHORS COPYING{,.GPL,.MIT} ChangeLog README \
$PKG/usr/doc/$NAME
# Copy slack-desc file

Loading…
Cancel
Save