diff options
| author | Khem Raj <raj.khem@gmail.com> | 2018-09-13 00:10:04 -0700 |
|---|---|---|
| committer | Andrei Gherzan <andrei@gherzan.com> | 2018-09-20 22:27:18 +0300 |
| commit | c1aabba056b491cd53333c2b20ba381032edf24a (patch) | |
| tree | 10e299ae63c77c00efb55b3082e8a6e057141b07 | |
| parent | ab8a44d655386bdac50224832585266a52ccaaf8 (diff) | |
| download | meta-raspberrypi-c1aabba056b491cd53333c2b20ba381032edf24a.tar.gz | |
omxplayer: Update and add fixes for OpenSSL 1.1.x and thumb2
* Update to latest from upstream
* Backport OpenSSL 1.1.x related patches for ffmpeg
* Pass --cpu based on machine, instead of hardcoding it to arm1176jzf-s
* Make --cc, --cxx and --ld be used from environment, helps building
with clang
* It requires userland graphics driver to build to encode that in
COMPATIBLE_HOST
Signed-off-by: Khem Raj <raj.khem@gmail.com>
5 files changed, 588 insertions, 3 deletions
diff --git a/recipes-multimedia/omxplayer/omxplayer/0001-Specify-cc-cxx-and-ld-variables-from-environment.patch b/recipes-multimedia/omxplayer/omxplayer/0001-Specify-cc-cxx-and-ld-variables-from-environment.patch new file mode 100644 index 0000000..c7a0fd4 --- /dev/null +++ b/recipes-multimedia/omxplayer/omxplayer/0001-Specify-cc-cxx-and-ld-variables-from-environment.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From 9b4b7f8726171e97f12c587d50e54bab0dc42da5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 12 Sep 2018 22:18:07 -0700 | ||
| 4 | Subject: [PATCH] Specify --cc, --cxx and --ld variables from environment | ||
| 5 | |||
| 6 | This helps in compiling with non-gcc compilers | ||
| 7 | |||
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 9 | --- | ||
| 10 | Makefile.ffmpeg | 22 ++++++++++++++-------- | ||
| 11 | 1 file changed, 14 insertions(+), 8 deletions(-) | ||
| 12 | |||
| 13 | Index: git/Makefile.ffmpeg | ||
| 14 | =================================================================== | ||
| 15 | --- git.orig/Makefile.ffmpeg | ||
| 16 | +++ git/Makefile.ffmpeg | ||
| 17 | @@ -23,13 +23,16 @@ configure: | ||
| 18 | CFLAGS="$(CFLAGS) ${INCLUDES}" \ | ||
| 19 | LDFLAGS="" \ | ||
| 20 | ./configure \ | ||
| 21 | + --ld="${CCLD}" \ | ||
| 22 | + --cc="${CC}" \ | ||
| 23 | + --cxx="${CXX}" \ | ||
| 24 | --extra-cflags="$(FFMPEG_EXTRA_CFLAGS)" \ | ||
| 25 | --extra-ldflags="$(FFMPEG_EXTRA_LDFLAGS)" \ | ||
| 26 | --enable-cross-compile \ | ||
| 27 | --enable-shared \ | ||
| 28 | --disable-static \ | ||
| 29 | --arch=arm \ | ||
| 30 | - --cpu=arm1176jzf-s \ | ||
| 31 | + --cpu=$(CPU) \ | ||
| 32 | --target-os=linux \ | ||
| 33 | --disable-hwaccels \ | ||
| 34 | --enable-parsers \ | ||
| 35 | @@ -44,7 +47,7 @@ configure: | ||
| 36 | --enable-gpl \ | ||
| 37 | --enable-version3 \ | ||
| 38 | --enable-protocols \ | ||
| 39 | - --enable-libsmbclient \ | ||
| 40 | + --disable-libsmbclient \ | ||
| 41 | --enable-libssh \ | ||
| 42 | --enable-nonfree \ | ||
| 43 | --enable-openssl \ | ||
diff --git a/recipes-multimedia/omxplayer/omxplayer/0001-openssl-Support-version-1.1.0.patch b/recipes-multimedia/omxplayer/omxplayer/0001-openssl-Support-version-1.1.0.patch new file mode 100644 index 0000000..950d3fe --- /dev/null +++ b/recipes-multimedia/omxplayer/omxplayer/0001-openssl-Support-version-1.1.0.patch | |||
| @@ -0,0 +1,233 @@ | |||
| 1 | From 3e085f3e5ff4b45672ccb43b4556ddf86f805c1f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Matt Oliver <protogonoi@gmail.com> | ||
| 3 | Date: Wed, 12 Sep 2018 22:47:20 -0700 | ||
| 4 | Subject: [PATCH] openssl: Support version 1.1.0 | ||
| 5 | |||
| 6 | Fixes #5675 | ||
| 7 | |||
| 8 | Upstream-Status: Backport | ||
| 9 | |||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | configure | 3 +- | ||
| 13 | libavformat/tls_openssl.c | 163 +++++++++++++++++++++++--------------- | ||
| 14 | 2 files changed, 102 insertions(+), 64 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/configure b/configure | ||
| 17 | index 592df195ac..cc5c8e70fc 100755 | ||
| 18 | --- a/configure | ||
| 19 | +++ b/configure | ||
| 20 | @@ -5788,7 +5788,8 @@ enabled omx && { check_header OMX_Core.h || | ||
| 21 | add_cflags -isystem/opt/vc/include/IL ; } | ||
| 22 | check_header OMX_Core.h ; } || | ||
| 23 | die "ERROR: OpenMAX IL headers not found"; } | ||
| 24 | -enabled openssl && { use_pkg_config openssl openssl/ssl.h SSL_library_init || | ||
| 25 | +enabled openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl || | ||
| 26 | + use_pkg_config openssl openssl/ssl.h SSL_library_init || | ||
| 27 | check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || | ||
| 28 | check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || | ||
| 29 | check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || | ||
| 30 | diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c | ||
| 31 | index 46eb3e68c7..c551ac74e2 100644 | ||
| 32 | --- a/libavformat/tls_openssl.c | ||
| 33 | +++ b/libavformat/tls_openssl.c | ||
| 34 | @@ -43,6 +43,9 @@ typedef struct TLSContext { | ||
| 35 | TLSShared tls_shared; | ||
| 36 | SSL_CTX *ctx; | ||
| 37 | SSL *ssl; | ||
| 38 | +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL | ||
| 39 | + BIO_METHOD* url_bio_method; | ||
| 40 | +#endif | ||
| 41 | } TLSContext; | ||
| 42 | |||
| 43 | #if HAVE_THREADS | ||
| 44 | @@ -63,6 +66,87 @@ static unsigned long openssl_thread_id(void) | ||
| 45 | #endif | ||
| 46 | #endif | ||
| 47 | |||
| 48 | +static int url_bio_create(BIO *b) | ||
| 49 | +{ | ||
| 50 | +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL | ||
| 51 | + BIO_set_init(b, 1); | ||
| 52 | + BIO_set_data(b, NULL); | ||
| 53 | + BIO_set_flags(b, 0); | ||
| 54 | +#else | ||
| 55 | + b->init = 1; | ||
| 56 | + b->ptr = NULL; | ||
| 57 | + b->flags = 0; | ||
| 58 | +#endif | ||
| 59 | + return 1; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +static int url_bio_destroy(BIO *b) | ||
| 63 | +{ | ||
| 64 | + return 1; | ||
| 65 | +} | ||
| 66 | + | ||
| 67 | +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL | ||
| 68 | +#define GET_BIO_DATA(x) BIO_get_data(x); | ||
| 69 | +#else | ||
| 70 | +#define GET_BIO_DATA(x) (x)->ptr; | ||
| 71 | +#endif | ||
| 72 | + | ||
| 73 | +static int url_bio_bread(BIO *b, char *buf, int len) | ||
| 74 | +{ | ||
| 75 | + URLContext *h; | ||
| 76 | + int ret; | ||
| 77 | + h = GET_BIO_DATA(b); | ||
| 78 | + ret = ffurl_read(h, buf, len); | ||
| 79 | + if (ret >= 0) | ||
| 80 | + return ret; | ||
| 81 | + BIO_clear_retry_flags(b); | ||
| 82 | + if (ret == AVERROR_EXIT) | ||
| 83 | + return 0; | ||
| 84 | + return -1; | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +static int url_bio_bwrite(BIO *b, const char *buf, int len) | ||
| 88 | +{ | ||
| 89 | + URLContext *h; | ||
| 90 | + int ret; | ||
| 91 | + h = GET_BIO_DATA(b); | ||
| 92 | + ret = ffurl_write(h, buf, len); | ||
| 93 | + if (ret >= 0) | ||
| 94 | + return ret; | ||
| 95 | + BIO_clear_retry_flags(b); | ||
| 96 | + if (ret == AVERROR_EXIT) | ||
| 97 | + return 0; | ||
| 98 | + return -1; | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 102 | +{ | ||
| 103 | + if (cmd == BIO_CTRL_FLUSH) { | ||
| 104 | + BIO_clear_retry_flags(b); | ||
| 105 | + return 1; | ||
| 106 | + } | ||
| 107 | + return 0; | ||
| 108 | +} | ||
| 109 | + | ||
| 110 | +static int url_bio_bputs(BIO *b, const char *str) | ||
| 111 | +{ | ||
| 112 | + return url_bio_bwrite(b, str, strlen(str)); | ||
| 113 | +} | ||
| 114 | + | ||
| 115 | +#if OPENSSL_VERSION_NUMBER < 0x1010000fL | ||
| 116 | +static BIO_METHOD url_bio_method = { | ||
| 117 | + .type = BIO_TYPE_SOURCE_SINK, | ||
| 118 | + .name = "urlprotocol bio", | ||
| 119 | + .bwrite = url_bio_bwrite, | ||
| 120 | + .bread = url_bio_bread, | ||
| 121 | + .bputs = url_bio_bputs, | ||
| 122 | + .bgets = NULL, | ||
| 123 | + .ctrl = url_bio_ctrl, | ||
| 124 | + .create = url_bio_create, | ||
| 125 | + .destroy = url_bio_destroy, | ||
| 126 | +}; | ||
| 127 | +#endif | ||
| 128 | + | ||
| 129 | int ff_openssl_init(void) | ||
| 130 | { | ||
| 131 | avpriv_lock_avformat(); | ||
| 132 | @@ -128,73 +212,14 @@ static int tls_close(URLContext *h) | ||
| 133 | SSL_CTX_free(c->ctx); | ||
| 134 | if (c->tls_shared.tcp) | ||
| 135 | ffurl_close(c->tls_shared.tcp); | ||
| 136 | +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL | ||
| 137 | + if (c->url_bio_method) | ||
| 138 | + BIO_meth_free(c->url_bio_method); | ||
| 139 | +#endif | ||
| 140 | ff_openssl_deinit(); | ||
| 141 | return 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | -static int url_bio_create(BIO *b) | ||
| 145 | -{ | ||
| 146 | - b->init = 1; | ||
| 147 | - b->ptr = NULL; | ||
| 148 | - b->flags = 0; | ||
| 149 | - return 1; | ||
| 150 | -} | ||
| 151 | - | ||
| 152 | -static int url_bio_destroy(BIO *b) | ||
| 153 | -{ | ||
| 154 | - return 1; | ||
| 155 | -} | ||
| 156 | - | ||
| 157 | -static int url_bio_bread(BIO *b, char *buf, int len) | ||
| 158 | -{ | ||
| 159 | - URLContext *h = b->ptr; | ||
| 160 | - int ret = ffurl_read(h, buf, len); | ||
| 161 | - if (ret >= 0) | ||
| 162 | - return ret; | ||
| 163 | - BIO_clear_retry_flags(b); | ||
| 164 | - if (ret == AVERROR_EXIT) | ||
| 165 | - return 0; | ||
| 166 | - return -1; | ||
| 167 | -} | ||
| 168 | - | ||
| 169 | -static int url_bio_bwrite(BIO *b, const char *buf, int len) | ||
| 170 | -{ | ||
| 171 | - URLContext *h = b->ptr; | ||
| 172 | - int ret = ffurl_write(h, buf, len); | ||
| 173 | - if (ret >= 0) | ||
| 174 | - return ret; | ||
| 175 | - BIO_clear_retry_flags(b); | ||
| 176 | - if (ret == AVERROR_EXIT) | ||
| 177 | - return 0; | ||
| 178 | - return -1; | ||
| 179 | -} | ||
| 180 | - | ||
| 181 | -static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr) | ||
| 182 | -{ | ||
| 183 | - if (cmd == BIO_CTRL_FLUSH) { | ||
| 184 | - BIO_clear_retry_flags(b); | ||
| 185 | - return 1; | ||
| 186 | - } | ||
| 187 | - return 0; | ||
| 188 | -} | ||
| 189 | - | ||
| 190 | -static int url_bio_bputs(BIO *b, const char *str) | ||
| 191 | -{ | ||
| 192 | - return url_bio_bwrite(b, str, strlen(str)); | ||
| 193 | -} | ||
| 194 | - | ||
| 195 | -static BIO_METHOD url_bio_method = { | ||
| 196 | - .type = BIO_TYPE_SOURCE_SINK, | ||
| 197 | - .name = "urlprotocol bio", | ||
| 198 | - .bwrite = url_bio_bwrite, | ||
| 199 | - .bread = url_bio_bread, | ||
| 200 | - .bputs = url_bio_bputs, | ||
| 201 | - .bgets = NULL, | ||
| 202 | - .ctrl = url_bio_ctrl, | ||
| 203 | - .create = url_bio_create, | ||
| 204 | - .destroy = url_bio_destroy, | ||
| 205 | -}; | ||
| 206 | - | ||
| 207 | static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options) | ||
| 208 | { | ||
| 209 | TLSContext *p = h->priv_data; | ||
| 210 | @@ -240,8 +265,20 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op | ||
| 211 | ret = AVERROR(EIO); | ||
| 212 | goto fail; | ||
| 213 | } | ||
| 214 | +#if OPENSSL_VERSION_NUMBER >= 0x1010000fL | ||
| 215 | + p->url_bio_method = BIO_meth_new(BIO_TYPE_SOURCE_SINK, "urlprotocol bio"); | ||
| 216 | + BIO_meth_set_write(p->url_bio_method, url_bio_bwrite); | ||
| 217 | + BIO_meth_set_read(p->url_bio_method, url_bio_bread); | ||
| 218 | + BIO_meth_set_puts(p->url_bio_method, url_bio_bputs); | ||
| 219 | + BIO_meth_set_ctrl(p->url_bio_method, url_bio_ctrl); | ||
| 220 | + BIO_meth_set_create(p->url_bio_method, url_bio_create); | ||
| 221 | + BIO_meth_set_destroy(p->url_bio_method, url_bio_destroy); | ||
| 222 | + bio = BIO_new(p->url_bio_method); | ||
| 223 | + BIO_set_data(bio, c->tcp); | ||
| 224 | +#else | ||
| 225 | bio = BIO_new(&url_bio_method); | ||
| 226 | bio->ptr = c->tcp; | ||
| 227 | +#endif | ||
| 228 | SSL_set_bio(p->ssl, bio, bio); | ||
| 229 | if (!c->listen && !c->numerichost) | ||
| 230 | SSL_set_tlsext_host_name(p->ssl, c->host); | ||
| 231 | -- | ||
| 232 | 2.19.0 | ||
| 233 | |||
diff --git a/recipes-multimedia/omxplayer/omxplayer/0001-rtmpdh-Stop-using-OpenSSL-provided-DH-functions-to-s.patch b/recipes-multimedia/omxplayer/omxplayer/0001-rtmpdh-Stop-using-OpenSSL-provided-DH-functions-to-s.patch new file mode 100644 index 0000000..3328f4b --- /dev/null +++ b/recipes-multimedia/omxplayer/omxplayer/0001-rtmpdh-Stop-using-OpenSSL-provided-DH-functions-to-s.patch | |||
| @@ -0,0 +1,223 @@ | |||
| 1 | From db251a3d71020ef15094158ccd69d2c32ddd194d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 12 Sep 2018 23:55:42 -0700 | ||
| 4 | Subject: [PATCH] rtmpdh: Stop using OpenSSL-provided DH functions to support | ||
| 5 | 1.1.0 | ||
| 6 | |||
| 7 | DH (struct dh_st) was made private in the 1.1 series, instead | ||
| 8 | DH is now done the same way as with gcrypt / libgmp. | ||
| 9 | |||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | libavformat/rtmpdh.c | 95 +++++++++++++++++++++----------------------- | ||
| 13 | libavformat/rtmpdh.h | 14 +++---- | ||
| 14 | 2 files changed, 52 insertions(+), 57 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c | ||
| 17 | index 1876fd44f9..8eb088237b 100644 | ||
| 18 | --- a/libavformat/rtmpdh.c | ||
| 19 | +++ b/libavformat/rtmpdh.c | ||
| 20 | @@ -54,7 +54,6 @@ | ||
| 21 | "F71C35FDAD44CFD2D74F9208BE258FF324943328F67329C0" \ | ||
| 22 | "FFFFFFFFFFFFFFFF" | ||
| 23 | |||
| 24 | -#if CONFIG_GMP || CONFIG_GCRYPT | ||
| 25 | #if CONFIG_GMP | ||
| 26 | #define bn_new(bn) \ | ||
| 27 | do { \ | ||
| 28 | @@ -93,7 +92,6 @@ | ||
| 29 | else \ | ||
| 30 | ret = 1; \ | ||
| 31 | } while (0) | ||
| 32 | -#define bn_modexp(bn, y, q, p) mpz_powm(bn, y, q, p) | ||
| 33 | #define bn_random(bn, num_bits) \ | ||
| 34 | do { \ | ||
| 35 | int bits = num_bits; \ | ||
| 36 | @@ -104,6 +102,11 @@ | ||
| 37 | } \ | ||
| 38 | mpz_fdiv_r_2exp(bn, bn, num_bits); \ | ||
| 39 | } while (0) | ||
| 40 | +static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) | ||
| 41 | +{ | ||
| 42 | + mpz_powm(bn, y, q, p); | ||
| 43 | + return 0; | ||
| 44 | +} | ||
| 45 | #elif CONFIG_GCRYPT | ||
| 46 | #define bn_new(bn) \ | ||
| 47 | do { \ | ||
| 48 | @@ -125,13 +128,42 @@ | ||
| 49 | #define bn_bn2bin(bn, buf, len) gcry_mpi_print(GCRYMPI_FMT_USG, buf, len, NULL, bn) | ||
| 50 | #define bn_bin2bn(bn, buf, len) gcry_mpi_scan(&bn, GCRYMPI_FMT_USG, buf, len, NULL) | ||
| 51 | #define bn_hex2bn(bn, buf, ret) ret = (gcry_mpi_scan(&bn, GCRYMPI_FMT_HEX, buf, 0, 0) == 0) | ||
| 52 | -#define bn_modexp(bn, y, q, p) gcry_mpi_powm(bn, y, q, p) | ||
| 53 | #define bn_random(bn, num_bits) gcry_mpi_randomize(bn, num_bits, GCRY_WEAK_RANDOM) | ||
| 54 | +static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) | ||
| 55 | +{ | ||
| 56 | + gcry_mpi_powm(bn, y, q, p); | ||
| 57 | + return 0; | ||
| 58 | +} | ||
| 59 | +#elif CONFIG_OPENSSL | ||
| 60 | +#define bn_new(bn) bn = BN_new() | ||
| 61 | +#define bn_free(bn) BN_free(bn) | ||
| 62 | +#define bn_set_word(bn, w) BN_set_word(bn, w) | ||
| 63 | +#define bn_cmp(a, b) BN_cmp(a, b) | ||
| 64 | +#define bn_copy(to, from) BN_copy(to, from) | ||
| 65 | +#define bn_sub_word(bn, w) BN_sub_word(bn, w) | ||
| 66 | +#define bn_cmp_1(bn) BN_cmp(bn, BN_value_one()) | ||
| 67 | +#define bn_num_bytes(bn) BN_num_bytes(bn) | ||
| 68 | +#define bn_bn2bin(bn, buf, len) BN_bn2bin(bn, buf) | ||
| 69 | +#define bn_bin2bn(bn, buf, len) bn = BN_bin2bn(buf, len, 0) | ||
| 70 | +#define bn_hex2bn(bn, buf, ret) ret = BN_hex2bn(&bn, buf) | ||
| 71 | +#define bn_random(bn, num_bits) BN_rand(bn, num_bits, 0, 0) | ||
| 72 | +static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) | ||
| 73 | +{ | ||
| 74 | + BN_CTX *ctx = BN_CTX_new(); | ||
| 75 | + if (!ctx) | ||
| 76 | + return AVERROR(ENOMEM); | ||
| 77 | + if (!BN_mod_exp(bn, y, q, p, ctx)) { | ||
| 78 | + BN_CTX_free(ctx); | ||
| 79 | + return AVERROR(EINVAL); | ||
| 80 | + } | ||
| 81 | + BN_CTX_free(ctx); | ||
| 82 | + return 0; | ||
| 83 | +} | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #define MAX_BYTES 18000 | ||
| 87 | |||
| 88 | -#define dh_new() av_malloc(sizeof(FF_DH)) | ||
| 89 | +#define dh_new() av_mallocz(sizeof(FF_DH)) | ||
| 90 | |||
| 91 | static FFBigNum dh_generate_key(FF_DH *dh) | ||
| 92 | { | ||
| 93 | @@ -152,7 +184,8 @@ static FFBigNum dh_generate_key(FF_DH *dh) | ||
| 94 | return NULL; | ||
| 95 | } | ||
| 96 | |||
| 97 | - bn_modexp(dh->pub_key, dh->g, dh->priv_key, dh->p); | ||
| 98 | + if (bn_modexp(dh->pub_key, dh->g, dh->priv_key, dh->p) < 0) | ||
| 99 | + return NULL; | ||
| 100 | |||
| 101 | return dh->pub_key; | ||
| 102 | } | ||
| 103 | @@ -161,12 +194,16 @@ static int dh_compute_key(FF_DH *dh, FFBigNum pub_key_bn, | ||
| 104 | uint32_t secret_key_len, uint8_t *secret_key) | ||
| 105 | { | ||
| 106 | FFBigNum k; | ||
| 107 | + int ret; | ||
| 108 | |||
| 109 | bn_new(k); | ||
| 110 | if (!k) | ||
| 111 | return -1; | ||
| 112 | |||
| 113 | - bn_modexp(k, pub_key_bn, dh->priv_key, dh->p); | ||
| 114 | + if ((ret = bn_modexp(k, pub_key_bn, dh->priv_key, dh->p)) < 0) { | ||
| 115 | + bn_free(k); | ||
| 116 | + return ret; | ||
| 117 | + } | ||
| 118 | bn_bn2bin(k, secret_key, secret_key_len); | ||
| 119 | bn_free(k); | ||
| 120 | |||
| 121 | @@ -184,48 +221,6 @@ void ff_dh_free(FF_DH *dh) | ||
| 122 | bn_free(dh->priv_key); | ||
| 123 | av_free(dh); | ||
| 124 | } | ||
| 125 | -#elif CONFIG_OPENSSL | ||
| 126 | -#define bn_new(bn) bn = BN_new() | ||
| 127 | -#define bn_free(bn) BN_free(bn) | ||
| 128 | -#define bn_set_word(bn, w) BN_set_word(bn, w) | ||
| 129 | -#define bn_cmp(a, b) BN_cmp(a, b) | ||
| 130 | -#define bn_copy(to, from) BN_copy(to, from) | ||
| 131 | -#define bn_sub_word(bn, w) BN_sub_word(bn, w) | ||
| 132 | -#define bn_cmp_1(bn) BN_cmp(bn, BN_value_one()) | ||
| 133 | -#define bn_num_bytes(bn) BN_num_bytes(bn) | ||
| 134 | -#define bn_bn2bin(bn, buf, len) BN_bn2bin(bn, buf) | ||
| 135 | -#define bn_bin2bn(bn, buf, len) bn = BN_bin2bn(buf, len, 0) | ||
| 136 | -#define bn_hex2bn(bn, buf, ret) ret = BN_hex2bn(&bn, buf) | ||
| 137 | -#define bn_modexp(bn, y, q, p) \ | ||
| 138 | - do { \ | ||
| 139 | - BN_CTX *ctx = BN_CTX_new(); \ | ||
| 140 | - if (!ctx) \ | ||
| 141 | - return AVERROR(ENOMEM); \ | ||
| 142 | - if (!BN_mod_exp(bn, y, q, p, ctx)) { \ | ||
| 143 | - BN_CTX_free(ctx); \ | ||
| 144 | - return AVERROR(EINVAL); \ | ||
| 145 | - } \ | ||
| 146 | - BN_CTX_free(ctx); \ | ||
| 147 | - } while (0) | ||
| 148 | - | ||
| 149 | -#define dh_new() DH_new() | ||
| 150 | -#define dh_generate_key(dh) DH_generate_key(dh) | ||
| 151 | - | ||
| 152 | -static int dh_compute_key(FF_DH *dh, FFBigNum pub_key_bn, | ||
| 153 | - uint32_t secret_key_len, uint8_t *secret_key) | ||
| 154 | -{ | ||
| 155 | - if (secret_key_len < DH_size(dh)) | ||
| 156 | - return AVERROR(EINVAL); | ||
| 157 | - return DH_compute_key(secret_key, pub_key_bn, dh); | ||
| 158 | -} | ||
| 159 | - | ||
| 160 | -void ff_dh_free(FF_DH *dh) | ||
| 161 | -{ | ||
| 162 | - if (!dh) | ||
| 163 | - return; | ||
| 164 | - DH_free(dh); | ||
| 165 | -} | ||
| 166 | -#endif | ||
| 167 | |||
| 168 | static int dh_is_valid_public_key(FFBigNum y, FFBigNum p, FFBigNum q) | ||
| 169 | { | ||
| 170 | @@ -254,8 +249,10 @@ static int dh_is_valid_public_key(FFBigNum y, FFBigNum p, FFBigNum q) | ||
| 171 | * random data. | ||
| 172 | */ | ||
| 173 | /* y must fulfill y^q mod p = 1 */ | ||
| 174 | - bn_modexp(bn, y, q, p); | ||
| 175 | + if ((ret = bn_modexp(bn, y, q, p)) < 0) | ||
| 176 | + goto fail; | ||
| 177 | |||
| 178 | + ret = AVERROR(EINVAL); | ||
| 179 | if (bn_cmp_1(bn)) | ||
| 180 | goto fail; | ||
| 181 | |||
| 182 | diff --git a/libavformat/rtmpdh.h b/libavformat/rtmpdh.h | ||
| 183 | index 2b250f595d..188aad7a45 100644 | ||
| 184 | --- a/libavformat/rtmpdh.h | ||
| 185 | +++ b/libavformat/rtmpdh.h | ||
| 186 | @@ -26,7 +26,6 @@ | ||
| 187 | |||
| 188 | #include "config.h" | ||
| 189 | |||
| 190 | -#if CONFIG_GMP || CONFIG_GCRYPT | ||
| 191 | #if CONFIG_GMP | ||
| 192 | #include <gmp.h> | ||
| 193 | |||
| 194 | @@ -35,6 +34,12 @@ typedef mpz_ptr FFBigNum; | ||
| 195 | #include <gcrypt.h> | ||
| 196 | |||
| 197 | typedef gcry_mpi_t FFBigNum; | ||
| 198 | + | ||
| 199 | +#elif CONFIG_OPENSSL | ||
| 200 | +#include <openssl/bn.h> | ||
| 201 | +#include <openssl/dh.h> | ||
| 202 | + | ||
| 203 | +typedef BIGNUM *FFBigNum; | ||
| 204 | #endif | ||
| 205 | |||
| 206 | typedef struct FF_DH { | ||
| 207 | @@ -45,13 +50,6 @@ typedef struct FF_DH { | ||
| 208 | long length; | ||
| 209 | } FF_DH; | ||
| 210 | |||
| 211 | -#elif CONFIG_OPENSSL | ||
| 212 | -#include <openssl/bn.h> | ||
| 213 | -#include <openssl/dh.h> | ||
| 214 | - | ||
| 215 | -typedef BIGNUM *FFBigNum; | ||
| 216 | -typedef DH FF_DH; | ||
| 217 | -#endif | ||
| 218 | |||
| 219 | /** | ||
| 220 | * Initialize a Diffie-Hellmann context. | ||
| 221 | -- | ||
| 222 | 2.19.0 | ||
| 223 | |||
diff --git a/recipes-multimedia/omxplayer/omxplayer/0001-swresample-arm-avoid-conditional-branch-to-PLT-in-TH.patch b/recipes-multimedia/omxplayer/omxplayer/0001-swresample-arm-avoid-conditional-branch-to-PLT-in-TH.patch new file mode 100644 index 0000000..6b2664f --- /dev/null +++ b/recipes-multimedia/omxplayer/omxplayer/0001-swresample-arm-avoid-conditional-branch-to-PLT-in-TH.patch | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | From 6616f39fec0aa6270a707c8d0eb0f78c4b616eb9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Rahul Chaudhry <rahulchaudhry@chromium.org> | ||
| 3 | Date: Wed, 18 Apr 2018 16:40:28 -0700 | ||
| 4 | Subject: [PATCH] swresample/arm: avoid conditional branch to PLT in THUMB-2. | ||
| 5 | |||
| 6 | On Wed, Apr 18, 2018 at 3:46 PM, Michael Niedermayer | ||
| 7 | <michael@niedermayer.cc> wrote: | ||
| 8 | > please make sure this works on apple based arm (unless you know it works) | ||
| 9 | > (ive tested qemu linux based) | ||
| 10 | > | ||
| 11 | > Also please add a commit message | ||
| 12 | |||
| 13 | If by 'apple based arm' you mean llvm/clang assembler, then yes, I've verified | ||
| 14 | that the assembly works with armv7a-cros-linux-gnueabi-clang (version 7.0.0). | ||
| 15 | |||
| 16 | Updated patch with new commit message is attached. | ||
| 17 | |||
| 18 | Thanks, | ||
| 19 | Rahul | ||
| 20 | >From 2e3318acf266b519e98b680102a07196d6ddbf93 Mon Sep 17 00:00:00 2001 | ||
| 21 | From: Rahul Chaudhry <rahulchaudhry@chromium.org> | ||
| 22 | Date: Wed, 18 Apr 2018 16:29:39 -0700 | ||
| 23 | Subject: [PATCH] swresample/arm: remove unintentional relocation. | ||
| 24 | |||
| 25 | Branch to global symbol results in reference to PLT, and when compiling | ||
| 26 | for THUMB-2 - in a R_ARM_THM_JUMP19 relocation. Some linkers don't | ||
| 27 | support this relocation (ld.gold), while others can end up truncating | ||
| 28 | the relocation to fit (ld.bfd). | ||
| 29 | |||
| 30 | Convert this branch through PLT into a direct branch that the assembler | ||
| 31 | can resolve locally. | ||
| 32 | |||
| 33 | See https://github.com/android-ndk/ndk/issues/337 for background. | ||
| 34 | |||
| 35 | The current workaround is to disable neon during gstreamer build, | ||
| 36 | which is not optimal and can be reverted after this patch: | ||
| 37 | https://github.com/freedesktop/gstreamer-cerbero/commit/41556c415739fbc3a72c7eaee7e70a565b719b2f | ||
| 38 | --- | ||
| 39 | libswresample/arm/audio_convert_neon.S | 6 ++++-- | ||
| 40 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 41 | |||
| 42 | diff --git a/libswresample/arm/audio_convert_neon.S b/libswresample/arm/audio_convert_neon.S | ||
| 43 | index 1f88316dde..7729514701 100644 | ||
| 44 | --- a/libswresample/arm/audio_convert_neon.S | ||
| 45 | +++ b/libswresample/arm/audio_convert_neon.S | ||
| 46 | @@ -22,6 +22,7 @@ | ||
| 47 | #include "libavutil/arm/asm.S" | ||
| 48 | |||
| 49 | function swri_oldapi_conv_flt_to_s16_neon, export=1 | ||
| 50 | +_swri_oldapi_conv_flt_to_s16_neon: | ||
| 51 | subs r2, r2, #8 | ||
| 52 | vld1.32 {q0}, [r1,:128]! | ||
| 53 | vcvt.s32.f32 q8, q0, #31 | ||
| 54 | @@ -66,6 +67,7 @@ function swri_oldapi_conv_flt_to_s16_neon, export=1 | ||
| 55 | endfunc | ||
| 56 | |||
| 57 | function swri_oldapi_conv_fltp_to_s16_2ch_neon, export=1 | ||
| 58 | +_swri_oldapi_conv_fltp_to_s16_2ch_neon: | ||
| 59 | ldm r1, {r1, r3} | ||
| 60 | subs r2, r2, #8 | ||
| 61 | vld1.32 {q0}, [r1,:128]! | ||
| 62 | @@ -133,8 +135,8 @@ function swri_oldapi_conv_fltp_to_s16_nch_neon, export=1 | ||
| 63 | cmp r3, #2 | ||
| 64 | itt lt | ||
| 65 | ldrlt r1, [r1] | ||
| 66 | - blt X(swri_oldapi_conv_flt_to_s16_neon) | ||
| 67 | - beq X(swri_oldapi_conv_fltp_to_s16_2ch_neon) | ||
| 68 | + blt _swri_oldapi_conv_flt_to_s16_neon | ||
| 69 | + beq _swri_oldapi_conv_fltp_to_s16_2ch_neon | ||
| 70 | |||
| 71 | push {r4-r8, lr} | ||
| 72 | cmp r3, #4 | ||
| 73 | -- | ||
| 74 | 2.19.0 | ||
| 75 | |||
diff --git a/recipes-multimedia/omxplayer/omxplayer_git.bb b/recipes-multimedia/omxplayer/omxplayer_git.bb index 1df41a5..3c9800a 100644 --- a/recipes-multimedia/omxplayer/omxplayer_git.bb +++ b/recipes-multimedia/omxplayer/omxplayer_git.bb | |||
| @@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" | |||
| 10 | DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl libssh libomxil coreutils-native curl-native" | 10 | DEPENDS = "libpcre libav virtual/egl boost freetype dbus openssl libssh libomxil coreutils-native curl-native" |
| 11 | PR = "r4" | 11 | PR = "r4" |
| 12 | 12 | ||
| 13 | SRCREV_default = "b8ff59dccd9307f10dad71bec2525a95bd6c603b" | 13 | SRCREV_default = "7f3faf6cadac913013248de759462bcff92f0102" |
| 14 | 14 | ||
| 15 | # omxplayer builds its own copy of ffmpeg from source instead of using the | 15 | # omxplayer builds its own copy of ffmpeg from source instead of using the |
| 16 | # system's ffmpeg library. This isn't ideal but it's ok for now. We do however | 16 | # system's ffmpeg library. This isn't ideal but it's ok for now. We do however |
| @@ -31,12 +31,23 @@ SRC_URI = "git://github.com/popcornmix/omxplayer.git;protocol=git;branch=master | |||
| 31 | file://use-native-pkg-config.patch \ | 31 | file://use-native-pkg-config.patch \ |
| 32 | file://0005-Don-t-require-internet-connection-during-build.patch \ | 32 | file://0005-Don-t-require-internet-connection-during-build.patch \ |
| 33 | file://0006-Prevent-ffmpeg-configure-compile-race-condition.patch \ | 33 | file://0006-Prevent-ffmpeg-configure-compile-race-condition.patch \ |
| 34 | file://0001-Specify-cc-cxx-and-ld-variables-from-environment.patch \ | ||
| 35 | file://0001-openssl-Support-version-1.1.0.patch;patchdir=ffmpeg \ | ||
| 36 | file://0001-swresample-arm-avoid-conditional-branch-to-PLT-in-TH.patch;patchdir=ffmpeg \ | ||
| 37 | file://0001-rtmpdh-Stop-using-OpenSSL-provided-DH-functions-to-s.patch;patchdir=ffmpeg \ | ||
| 34 | " | 38 | " |
| 35 | S = "${WORKDIR}/git" | 39 | S = "${WORKDIR}/git" |
| 36 | 40 | ||
| 37 | COMPATIBLE_MACHINE ?= "null" | 41 | COMPATIBLE_MACHINE ?= "null" |
| 38 | COMPATIBLE_MACHINE_rpi_aarch64 = "null" | 42 | COMPATIBLE_HOST_rpi = "${@bb.utils.contains('MACHINE_FEATURES', 'vc4graphics', 'null', '(.*)', d)}" |
| 39 | COMPATIBLE_MACHINE_rpi = "(.*)" | 43 | |
| 44 | def cpu(d): | ||
| 45 | for arg in (d.getVar('TUNE_CCARGS') or '').split(): | ||
| 46 | if arg.startswith('-mcpu='): | ||
| 47 | return arg[6:] | ||
| 48 | return 'generic' | ||
| 49 | |||
| 50 | export CPU = "${@cpu(d)}" | ||
| 40 | 51 | ||
| 41 | inherit autotools-brokensep pkgconfig | 52 | inherit autotools-brokensep pkgconfig |
| 42 | 53 | ||
