Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jannik Hoelling
alpaca-libraries
Commits
26e4b74e
Commit
26e4b74e
authored
Nov 04, 2021
by
Jannik Hoelling
Browse files
bearSSL strict alpn clientside
parent
ad6283e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
bearssl/client/client.c
View file @
26e4b74e
...
...
@@ -75,6 +75,7 @@ int main(int argc, char *argv[]) {
alpn_ptr
=
malloc
(
sizeof
(
char
)
*
strlen
(
alpn
));
alpn_ptr
[
0
]
=
alpn
;
br_ssl_engine_set_protocol_names
(
&
sc
.
eng
,
alpn_ptr
,
1
);
br_ssl_engine_add_flags
(
&
sc
.
eng
,
BR_OPT_FAIL_ON_ALPN_MISMATCH
);
/*
* Reset the client context, for a new handshake. We provide the
...
...
@@ -92,15 +93,7 @@ int main(int argc, char *argv[]) {
/* Strict ALPN */
const
char
*
alpn_received
=
br_ssl_engine_get_selected_protocol
(
&
sc
.
eng
);
err
=
br_ssl_engine_last_error
(
&
sc
.
eng
);
if
(
alpn_received
==
NULL
||
strcmp
(
alpn_ptr
[
0
],
alpn_received
)
!=
0
)
{
printf
(
"Invalid ALPN received: %s
\n
"
,
alpn_received
);
//br_sslio_close(&ioc);
close
(
fd
);
return
120
;
}
else
{
printf
(
"ALPN negotiatiated: %s
\n
"
,
alpn_received
);
}
printf
(
"ALPN negotiatiated: %s
\n
"
,
alpn_received
);
// send message to server
//const char *message = "Hello from Client!";
...
...
Write
Preview
Supports
Markdown
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