Skip to content

Commit

Permalink
0.2.44.1
Browse files Browse the repository at this point in the history
  • Loading branch information
philippe44 committed Mar 4, 2021
1 parent e7a5d73 commit af42b53
Show file tree
Hide file tree
Showing 37 changed files with 128 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ _backup/
*.#*
*.bin
*.log
tests/
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.2.44.1
- (aircast) reset "Remove" flag when adding

0.2.44.0
- openssl 1.1.x compatibility

0.2.43.1
- address valgrind complaints

Expand Down
3 changes: 2 additions & 1 deletion aircast/src/aircast.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "config_cast.h"
#include "sslsym.h"

#define VERSION "v0.2.43.1"" ("__DATE__" @ "__TIME__")"
#define VERSION "v0.2.44.1"" ("__DATE__" @ "__TIME__")"

#define DISCOVERY_TIME 20
#define MEDIA_VOLUME 0.5
Expand Down Expand Up @@ -638,6 +638,7 @@ static bool AddCastDevice(struct sMR *Device, char *Name, char *UDN, bool group,
Device->Raop = NULL;
Device->RaopState = RAOP_STOP;
Device->Group = group;
Device->Remove = false;
Device->VolumeStampRx = Device->VolumeStampTx = gettime_ms() - 2000;

if (group) {
Expand Down
6 changes: 3 additions & 3 deletions airupnp/Makefile.x86
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ LDFLAGS ?= -s -lpthread -ldl -lm -lrt -lz -L.
# -l:libssl.a -l:libcrypto.a to force link with static version
# for LD debug -s

OBJ = bin/x86
EXECUTABLE = ../bin/airupnp-x86
#EXECUTABLE_STATIC = ../bin/airupnp-x86-static
OBJ = bin/x86
EXECUTABLE = ../bin/airupnp-x86
EXECUTABLE_STATIC = ../bin/airupnp-x86-static

include Makefile

2 changes: 1 addition & 1 deletion airupnp/src/airupnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "log_util.h"
#include "sslsym.h"

#define VERSION "v0.2.43.1"" ("__DATE__" @ "__TIME__")"
#define VERSION "v0.2.44.1"" ("__DATE__" @ "__TIME__")"

#define AV_TRANSPORT "urn:schemas-upnp-org:service:AVTransport"
#define RENDERING_CTRL "urn:schemas-upnp-org:service:RenderingControl"
Expand Down
Binary file modified bin/aircast-aarch64
Binary file not shown.
Binary file modified bin/aircast-aarch64-static
Binary file not shown.
Binary file modified bin/aircast-arm
Binary file not shown.
Binary file modified bin/aircast-arm-static
Binary file not shown.
Binary file modified bin/aircast-arm5
Binary file not shown.
Binary file modified bin/aircast-bsd-x64
Binary file not shown.
Binary file modified bin/aircast-bsd-x64-static
Binary file not shown.
Binary file modified bin/aircast-i86pc-solaris
Binary file not shown.
Binary file modified bin/aircast-osx-multi
Binary file not shown.
Binary file modified bin/aircast-ppc
Binary file not shown.
Binary file modified bin/aircast-ppc-static
Binary file not shown.
Binary file modified bin/aircast-win.exe
Binary file not shown.
Binary file modified bin/aircast-x86
Binary file not shown.
Binary file modified bin/aircast-x86-64
Binary file not shown.
Binary file modified bin/airupnp-aarch64
Binary file not shown.
Binary file modified bin/airupnp-aarch64-static
Binary file not shown.
Binary file modified bin/airupnp-arm
Binary file not shown.
Binary file modified bin/airupnp-arm-static
Binary file not shown.
Binary file modified bin/airupnp-arm5
Binary file not shown.
Binary file modified bin/airupnp-bsd-x64
Binary file not shown.
Binary file modified bin/airupnp-i86pc-solaris
Binary file not shown.
Binary file modified bin/airupnp-osx-multi
Binary file not shown.
Binary file modified bin/airupnp-ppc
Binary file not shown.
Binary file modified bin/airupnp-ppc-static
Binary file not shown.
Binary file modified bin/airupnp-win.exe
Binary file not shown.
Binary file modified bin/airupnp-x86
Binary file not shown.
Binary file modified bin/airupnp-x86-64
Binary file not shown.
Binary file modified bin/airupnp-x86-64-static
Binary file not shown.
Binary file added bin/airupnp-x86-static
Binary file not shown.
2 changes: 1 addition & 1 deletion common/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ char *trim(char *s)
/*----------------------------------------------------------------------------*/
bool http_parse(int sock, char *method, char *resource, char *proto, key_data_t *rkd, char **body, int *len)
{
char line[256], *dp;
char line[512], *dp;
unsigned j;
int i, timeout = 100;

Expand Down
30 changes: 30 additions & 0 deletions tools/sslshim.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* SSL symbols dynamic loader
*
* (c) Philippe, [email protected]
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

#ifndef SSLSHIM_H
#define SSLSHIM_H

// this must be include after various openssl includes

#if OPENSSL_VERSION_NUMBER < 0x10100000
int RSA_set0_key(RSA* r, BIGNUM* n, BIGNUM* e, BIGNUM* d);
#endif

#endif
124 changes: 84 additions & 40 deletions tools/sslsym.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SSL symboles dynamic loader
* SSL symbols dynamic loader
*
* (c) Philippe, [email protected]
*
Expand All @@ -25,17 +25,84 @@
#include <dlfcn.h>
#endif

#ifdef __BORLANDC__
#pragma warn -8081
#endif

#include "openssl/ssl.h"
#include "openssl/err.h"
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/engine.h>
#include <openssl/aes.h>
#include <openssl/bio.h>
#include "sslshim.h"

static void *SSLhandle = NULL;
static void *CRYPThandle = NULL;

#define P0() void
#define P1(t1, p1) t1 p1
#define P2(t1, p1, t2, p2) t1 p1, t2 p2
#define P3(t1, p1, t2, p2, t3, p3) t1 p1, t2 p2, t3 p3
#define P4(t1, p1, t2, p2, t3, p3, t4, p4) t1 p1, t2 p2, t3 p3, t4 p4
#define P5(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) t1 p1, t2 p2, t3 p3, t4 p4, t5 p5
#define P6(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) t1 p1, t2 p2, t3 p3, t4 p4, t5 p5, t6 p6
#define V0()
#define V1(t1, p1) p1
#define V2(t1, p1, t2, p2) p1, p2
#define V3(t1, p1, t2, p2, t3, p3) p1, p2, p3
#define V4(t1, p1, t2, p2, t3, p3, t4, p4) p1, p2, p3, p4
#define V5(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) p1, p2, p3, p4, p5
#define V6(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) p1, p2, p3, p4, p5, p6

#define P(n, ...) P##n(__VA_ARGS__)
#define V(n, ...) V##n(__VA_ARGS__)

#ifndef LINKALL

#define SYMDECL(fn, ret, n, ...) \
static ret (*dlsym_##fn)(P(n,__VA_ARGS__)); \
ret fn(P(n,__VA_ARGS__)) { \
return (*dlsym_##fn)(V(n,__VA_ARGS__)); \
}

#define SYMSHIMDECL(fn, ret, n, ...) \
static ret (*dlsym_##fn)(P(n,__VA_ARGS__)); \
ret fn(P(n,__VA_ARGS__)) { \
if (dlsym_##fn) \
return (*dlsym_##fn)(V(n,__VA_ARGS__)); \
else \
return (shim_##fn)(V(n,__VA_ARGS__)); \
}

#else

#define SYMDECL(fn, ret, n, ...)

#define SYMSHIMDECL(fn, ret, n, ...) \
ret fn(P(n,__VA_ARGS__)) { \
return (shim_##fn)(V(n,__VA_ARGS__)); \
}

#endif

/*
MNNFFPPS: major minor fix patch status
0x101ffpps = 1.1. fix->ff patch->pp status->s
*/

// create shim functions
#if OPENSSL_VERSION_NUMBER < 0x10100000
static int shim_RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) {
r->n = n; r->e = e; r->d = d;
return 1;
}
SYMSHIMDECL(RSA_set0_key, int, 4, RSA*, r, BIGNUM*, n, BIGNUM*, e, BIGNUM*, d);
#else
SYMDECL(RSA_set0_key, int, 4, RSA*, r, BIGNUM*, n, BIGNUM*, e, BIGNUM*, d);
#endif

#ifndef LINKALL

#if WIN
Expand Down Expand Up @@ -65,46 +132,19 @@ static char *LIBCRYPTO[] = {
"libcrypto.so.1.0.0", NULL };
#endif

#define P0() void
#define P1(t1, p1) t1 p1
#define P2(t1, p1, t2, p2) t1 p1, t2 p2
#define P3(t1, p1, t2, p2, t3, p3) t1 p1, t2 p2, t3 p3
#define P4(t1, p1, t2, p2, t3, p3, t4, p4) t1 p1, t2 p2, t3 p3, t4 p4
#define P5(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) t1 p1, t2 p2, t3 p3, t4 p4, t5 p5
#define P6(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) t1 p1, t2 p2, t3 p3, t4 p4, t5 p5, t6 p6
#define V0()
#define V1(t1, p1) p1
#define V2(t1, p1, t2, p2) p1, p2
#define V3(t1, p1, t2, p2, t3, p3) p1, p2, p3
#define V4(t1, p1, t2, p2, t3, p3, t4, p4) p1, p2, p3, p4
#define V5(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) p1, p2, p3, p4, p5
#define V6(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) p1, p2, p3, p4, p5, p6

#define P(n, ...) P##n(__VA_ARGS__)
#define V(n, ...) V##n(__VA_ARGS__)

#define SYM(fn) dlsym_##fn
#define SYMDECL(fn, ret, n, ...) \
static ret (*dlsym_##fn)(P(n,__VA_ARGS__)); \
ret fn(P(n,__VA_ARGS__)) { \
return (*dlsym_##fn)(V(n,__VA_ARGS__)); \
}

#define SYMDECLVOID(fn, n, ...) \
static void (*dlsym_##fn)(P(n,__VA_ARGS__)); \
void fn(P(n,__VA_ARGS__)) { \
(*dlsym_##fn)(V(n,__VA_ARGS__)); \
}

#if 0
#define SYMLOAD(h, fn) { \
dlsym_##fn = dlsym(h, #fn); \
printf("%s %p\n", #fn, dlsym_##fn); \
#define SYMLOAD(h, fn) { \
dlsym_##fn = dlsym(h, #fn); \
printf("%s %p\n", #fn, dlsym_##fn); \
}
#else
#define SYMLOAD(h, fn) dlsym_##fn = dlsym(h, #fn)
#endif

#define SHIMSET(fn) if (!SYM(fn)) SYM(fn) = &(shim_##fn)

SYMDECL(SSL_read, int, 3, SSL*, s, void*, buf, int, len);
SYMDECL(SSL_write, int, 3, SSL*, s, const void*, buf, int, len);
SYMDECL(SSLv23_client_method, const SSL_METHOD*, 0);
Expand All @@ -124,8 +164,8 @@ SYMDECL(SSL_get_error, int, 2, const SSL*, s, int, ret_code);
SYMDECL(SSL_ctrl, long, 4, SSL*, ssl, int, cmd, long, larg, void*, parg);
SYMDECL(SSL_pending, int, 1, const SSL*, s);

SYMDECLVOID(SSL_free, 1, SSL*, s);
SYMDECLVOID(SSL_CTX_free, 1, SSL_CTX *, ctx);
SYMDECL(SSL_free, void, 1, SSL*, s);
SYMDECL(SSL_CTX_free, void, 1, SSL_CTX *, ctx);

SYMDECL(ERR_get_error, unsigned long, 0);
SYMDECL(SHA512_Init, int, 1, SHA512_CTX*, c);
Expand All @@ -144,11 +184,11 @@ SYMDECL(BIO_new_mem_buf, BIO*, 2, const void*, buf, int, len);
SYMDECL(BIO_free, int, 1, BIO*, a);
SYMDECL(PEM_read_bio_RSAPrivateKey, RSA *, 4, BIO*, bp, RSA**, x, pem_password_cb*, cb, void*, u);

SYMDECLVOID(AES_cbc_encrypt, 6, const unsigned char*, in, unsigned char*, out, size_t, length, const AES_KEY*, key, unsigned char*, ivec, const int, enc);
SYMDECLVOID(RAND_seed, 2, const void*, buf, int, num);
SYMDECLVOID(RSA_free, 1, RSA*, r);
SYMDECLVOID(ERR_clear_error, 0);
SYMDECLVOID(ERR_remove_state, 1, unsigned long, pid);
SYMDECL(AES_cbc_encrypt, void, 6, const unsigned char*, in, unsigned char*, out, size_t, length, const AES_KEY*, key, unsigned char*, ivec, const int, enc);
SYMDECL(RAND_seed, void, 2, const void*, buf, int, num);
SYMDECL(RSA_free, void, 1, RSA*, r);
SYMDECL(ERR_clear_error, void, 0);
SYMDECL(ERR_remove_state, void, 1, unsigned long, pid);

#if WIN
static void *dlopen(const char *filename, int flag) {
Expand Down Expand Up @@ -222,6 +262,7 @@ bool load_ssl_symbols(void) {
SYMLOAD(CRYPThandle, RSA_public_decrypt);
SYMLOAD(CRYPThandle, RSA_private_decrypt);
SYMLOAD(CRYPThandle, RSA_free);
SYMLOAD(CRYPThandle, RSA_set0_key);
SYMLOAD(CRYPThandle, BN_bin2bn);
SYMLOAD(CRYPThandle, AES_set_decrypt_key);
SYMLOAD(CRYPThandle, AES_cbc_encrypt);
Expand All @@ -233,6 +274,9 @@ bool load_ssl_symbols(void) {
if (!SYM(SSLv23_client_method)) SYM(SSLv23_client_method) = SYM(TLS_client_method);
if (!SYM(SSL_library_init)) SYM(SSL_library_init) = &lambda;

// manage mandatory new functions
SHIMSET(RSA_set0_key);

return true;
}

Expand Down

0 comments on commit af42b53

Please sign in to comment.