Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
798c6ecc
Commit
798c6ecc
authored
Oct 09, 2016
by
Matt Oliver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
openssl: Support version 1.1.0.
Fixes #5675 Signed-off-by:
Matt Oliver
<
protogonoi@gmail.com
>
parent
0cfd6cce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
64 deletions
+102
-64
configure
configure
+2
-1
tls_openssl.c
libavformat/tls_openssl.c
+100
-63
No files found.
configure
View file @
798c6ecc
...
...
@@ -5828,7 +5828,8 @@ enabled omx && { check_header OMX_Core.h ||
add_cflags
-isystem
/opt/vc/include/IL
;
}
check_header OMX_Core.h
;
}
||
die
"ERROR: OpenMAX IL headers not found"
;
}
enabled openssl
&&
{
use_pkg_config openssl openssl/ssl.h SSL_library_init
||
enabled openssl
&&
{
use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl
||
use_pkg_config openssl openssl/ssl.h SSL_library_init
||
check_lib openssl/ssl.h SSL_library_init
-lssl
-lcrypto
||
check_lib openssl/ssl.h SSL_library_init
-lssl32
-leay32
||
check_lib openssl/ssl.h SSL_library_init
-lssl
-lcrypto
-lws2_32
-lgdi32
||
...
...
libavformat/tls_openssl.c
View file @
798c6ecc
...
...
@@ -43,6 +43,9 @@ typedef struct TLSContext {
TLSShared
tls_shared
;
SSL_CTX
*
ctx
;
SSL
*
ssl
;
#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
BIO_METHOD
*
url_bio_method
;
#endif
}
TLSContext
;
#if HAVE_THREADS
...
...
@@ -63,6 +66,87 @@ static unsigned long openssl_thread_id(void)
#endif
#endif
static
int
url_bio_create
(
BIO
*
b
)
{
#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
BIO_set_init
(
b
,
1
);
BIO_set_data
(
b
,
NULL
);
BIO_set_flags
(
b
,
0
);
#else
b
->
init
=
1
;
b
->
ptr
=
NULL
;
b
->
flags
=
0
;
#endif
return
1
;
}
static
int
url_bio_destroy
(
BIO
*
b
)
{
return
1
;
}
#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
#define GET_BIO_DATA(x) BIO_get_data(x);
#else
#define GET_BIO_DATA(x) (x)->ptr;
#endif
static
int
url_bio_bread
(
BIO
*
b
,
char
*
buf
,
int
len
)
{
URLContext
*
h
;
int
ret
;
h
=
GET_BIO_DATA
(
b
);
ret
=
ffurl_read
(
h
,
buf
,
len
);
if
(
ret
>=
0
)
return
ret
;
BIO_clear_retry_flags
(
b
);
if
(
ret
==
AVERROR_EXIT
)
return
0
;
return
-
1
;
}
static
int
url_bio_bwrite
(
BIO
*
b
,
const
char
*
buf
,
int
len
)
{
URLContext
*
h
;
int
ret
;
h
=
GET_BIO_DATA
(
b
);
ret
=
ffurl_write
(
h
,
buf
,
len
);
if
(
ret
>=
0
)
return
ret
;
BIO_clear_retry_flags
(
b
);
if
(
ret
==
AVERROR_EXIT
)
return
0
;
return
-
1
;
}
static
long
url_bio_ctrl
(
BIO
*
b
,
int
cmd
,
long
num
,
void
*
ptr
)
{
if
(
cmd
==
BIO_CTRL_FLUSH
)
{
BIO_clear_retry_flags
(
b
);
return
1
;
}
return
0
;
}
static
int
url_bio_bputs
(
BIO
*
b
,
const
char
*
str
)
{
return
url_bio_bwrite
(
b
,
str
,
strlen
(
str
));
}
#if OPENSSL_VERSION_NUMBER < 0x1010000fL
static
BIO_METHOD
url_bio_method
=
{
.
type
=
BIO_TYPE_SOURCE_SINK
,
.
name
=
"urlprotocol bio"
,
.
bwrite
=
url_bio_bwrite
,
.
bread
=
url_bio_bread
,
.
bputs
=
url_bio_bputs
,
.
bgets
=
NULL
,
.
ctrl
=
url_bio_ctrl
,
.
create
=
url_bio_create
,
.
destroy
=
url_bio_destroy
,
};
#endif
int
ff_openssl_init
(
void
)
{
avpriv_lock_avformat
();
...
...
@@ -128,73 +212,14 @@ static int tls_close(URLContext *h)
SSL_CTX_free
(
c
->
ctx
);
if
(
c
->
tls_shared
.
tcp
)
ffurl_close
(
c
->
tls_shared
.
tcp
);
#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
if
(
c
->
url_bio_method
)
BIO_meth_free
(
c
->
url_bio_method
);
#endif
ff_openssl_deinit
();
return
0
;
}
static
int
url_bio_create
(
BIO
*
b
)
{
b
->
init
=
1
;
b
->
ptr
=
NULL
;
b
->
flags
=
0
;
return
1
;
}
static
int
url_bio_destroy
(
BIO
*
b
)
{
return
1
;
}
static
int
url_bio_bread
(
BIO
*
b
,
char
*
buf
,
int
len
)
{
URLContext
*
h
=
b
->
ptr
;
int
ret
=
ffurl_read
(
h
,
buf
,
len
);
if
(
ret
>=
0
)
return
ret
;
BIO_clear_retry_flags
(
b
);
if
(
ret
==
AVERROR_EXIT
)
return
0
;
return
-
1
;
}
static
int
url_bio_bwrite
(
BIO
*
b
,
const
char
*
buf
,
int
len
)
{
URLContext
*
h
=
b
->
ptr
;
int
ret
=
ffurl_write
(
h
,
buf
,
len
);
if
(
ret
>=
0
)
return
ret
;
BIO_clear_retry_flags
(
b
);
if
(
ret
==
AVERROR_EXIT
)
return
0
;
return
-
1
;
}
static
long
url_bio_ctrl
(
BIO
*
b
,
int
cmd
,
long
num
,
void
*
ptr
)
{
if
(
cmd
==
BIO_CTRL_FLUSH
)
{
BIO_clear_retry_flags
(
b
);
return
1
;
}
return
0
;
}
static
int
url_bio_bputs
(
BIO
*
b
,
const
char
*
str
)
{
return
url_bio_bwrite
(
b
,
str
,
strlen
(
str
));
}
static
BIO_METHOD
url_bio_method
=
{
.
type
=
BIO_TYPE_SOURCE_SINK
,
.
name
=
"urlprotocol bio"
,
.
bwrite
=
url_bio_bwrite
,
.
bread
=
url_bio_bread
,
.
bputs
=
url_bio_bputs
,
.
bgets
=
NULL
,
.
ctrl
=
url_bio_ctrl
,
.
create
=
url_bio_create
,
.
destroy
=
url_bio_destroy
,
};
static
int
tls_open
(
URLContext
*
h
,
const
char
*
uri
,
int
flags
,
AVDictionary
**
options
)
{
TLSContext
*
p
=
h
->
priv_data
;
...
...
@@ -240,8 +265,20 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
ret
=
AVERROR
(
EIO
);
goto
fail
;
}
#if OPENSSL_VERSION_NUMBER >= 0x1010000fL
p
->
url_bio_method
=
BIO_meth_new
(
BIO_TYPE_SOURCE_SINK
,
"urlprotocol bio"
);
BIO_meth_set_write
(
p
->
url_bio_method
,
url_bio_bwrite
);
BIO_meth_set_read
(
p
->
url_bio_method
,
url_bio_bread
);
BIO_meth_set_puts
(
p
->
url_bio_method
,
url_bio_bputs
);
BIO_meth_set_ctrl
(
p
->
url_bio_method
,
url_bio_ctrl
);
BIO_meth_set_create
(
p
->
url_bio_method
,
url_bio_create
);
BIO_meth_set_destroy
(
p
->
url_bio_method
,
url_bio_destroy
);
bio
=
BIO_new
(
p
->
url_bio_method
);
BIO_set_data
(
bio
,
c
->
tcp
);
#else
bio
=
BIO_new
(
&
url_bio_method
);
bio
->
ptr
=
c
->
tcp
;
#endif
SSL_set_bio
(
p
->
ssl
,
bio
,
bio
);
if
(
!
c
->
listen
&&
!
c
->
numerichost
)
SSL_set_tlsext_host_name
(
p
->
ssl
,
c
->
host
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment