Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
532bffdb
Commit
532bffdb
authored
Jun 12, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Minimize critical section for shared ocsp response
parent
c6c71451
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
14 deletions
+24
-14
src/shrpx_connection_handler.cc
src/shrpx_connection_handler.cc
+2
-1
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+21
-12
src/shrpx_ssl.h
src/shrpx_ssl.h
+1
-1
No files found.
src/shrpx_connection_handler.cc
View file @
532bffdb
...
...
@@ -510,7 +510,8 @@ void ConnectionHandler::handle_ocsp_complete() {
{
std
::
lock_guard
<
std
::
mutex
>
g
(
tls_ctx_data
->
mu
);
tls_ctx_data
->
ocsp_data
=
std
::
move
(
ocsp_
.
resp
);
tls_ctx_data
->
ocsp_data
=
std
::
make_shared
<
std
::
vector
<
uint8_t
>>
(
std
::
move
(
ocsp_
.
resp
));
}
++
ocsp_
.
next
;
...
...
src/shrpx_ssl.cc
View file @
532bffdb
...
...
@@ -150,28 +150,37 @@ int servername_callback(SSL *ssl, int *al, void *arg) {
}
}
// namespace
namespace
{
std
::
shared_ptr
<
std
::
vector
<
uint8_t
>>
get_ocsp_data
(
TLSContextData
*
tls_ctx_data
)
{
std
::
lock_guard
<
std
::
mutex
>
g
(
tls_ctx_data
->
mu
);
return
tls_ctx_data
->
ocsp_data
;
}
}
// namespace
namespace
{
int
ocsp_resp_cb
(
SSL
*
ssl
,
void
*
arg
)
{
auto
ssl_ctx
=
SSL_get_SSL_CTX
(
ssl
);
auto
tls_ctx_data
=
static_cast
<
TLSContextData
*>
(
SSL_CTX_get_app_data
(
ssl_ctx
));
{
std
::
lock_guard
<
std
::
mutex
>
g
(
tls_ctx_data
->
mu
);
auto
&
data
=
tls_ctx_data
->
ocsp_data
;
if
(
!
data
.
empty
())
{
auto
buf
=
static_cast
<
uint8_t
*>
(
CRYPTO_malloc
(
data
.
size
(),
__FILE__
,
__LINE__
));
auto
data
=
get_ocsp_data
(
tls_ctx_data
);
if
(
!
buf
)
{
return
SSL_TLSEXT_ERR_OK
;
}
if
(
!
data
)
{
return
SSL_TLSEXT_ERR_OK
;
}
std
::
copy
(
std
::
begin
(
data
),
std
::
end
(
data
),
buf
);
auto
buf
=
static_cast
<
uint8_t
*>
(
CRYPTO_malloc
(
data
->
size
(),
__FILE__
,
__LINE__
));
SSL_set_tlsext_status_ocsp_resp
(
ssl
,
buf
,
data
.
size
());
}
if
(
!
buf
)
{
return
SSL_TLSEXT_ERR_OK
;
}
std
::
copy
(
std
::
begin
(
*
data
),
std
::
end
(
*
data
),
buf
);
SSL_set_tlsext_status_ocsp_resp
(
ssl
,
buf
,
data
->
size
());
return
SSL_TLSEXT_ERR_OK
;
}
}
// namespace
...
...
src/shrpx_ssl.h
View file @
532bffdb
...
...
@@ -49,7 +49,7 @@ struct TLSContextData {
// Protects ocsp_data;
std
::
mutex
mu
;
// OCSP response
std
::
vector
<
uint8_t
>
ocsp_data
;
std
::
shared_ptr
<
std
::
vector
<
uint8_t
>
>
ocsp_data
;
// Path to certificate file
const
char
*
cert_file
;
...
...
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