mirror of
https://github.com/strophe/libstrophe.git
synced 2026-08-05 03:16:21 +00:00
Compare commits
2 Commits
next
...
scram-chan
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d13b5d87c | ||
|
|
419b616b87 |
@@ -17,7 +17,9 @@ if TLS_WITH_GNUTLS
|
|||||||
SSL_CFLAGS = @gnutls_CFLAGS@
|
SSL_CFLAGS = @gnutls_CFLAGS@
|
||||||
SSL_LIBS = @gnutls_LIBS@
|
SSL_LIBS = @gnutls_LIBS@
|
||||||
else
|
else
|
||||||
if !TLS_WITH_SCHANNEL
|
if TLS_WITH_SCHANNEL
|
||||||
|
SSL_CFLAGS = -DSTROPHE_TLS_SCHANNEL
|
||||||
|
else
|
||||||
SSL_CFLAGS = @openssl_CFLAGS@
|
SSL_CFLAGS = @openssl_CFLAGS@
|
||||||
SSL_LIBS = @openssl_LIBS@
|
SSL_LIBS = @openssl_LIBS@
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -602,8 +602,10 @@ static int _make_scram_init_msg(struct scram_user_data *scram)
|
|||||||
l = strophe_snprintf(message, message_len, "p=%s,,n=%s,r=%s",
|
l = strophe_snprintf(message, message_len, "p=%s,,n=%s,r=%s",
|
||||||
binding_type, node, buf);
|
binding_type, node, buf);
|
||||||
} else {
|
} else {
|
||||||
l = strophe_snprintf(message, message_len, "%c,,n=%s,r=%s",
|
l = strophe_snprintf(
|
||||||
is_secured ? 'y' : 'n', node, buf);
|
message, message_len, "%c,,n=%s,r=%s",
|
||||||
|
is_secured && tls_supports_channel_binding(conn->tls) ? 'y' : 'n',
|
||||||
|
node, buf);
|
||||||
}
|
}
|
||||||
if (l < 0 || (size_t)l >= message_len) {
|
if (l < 0 || (size_t)l >= message_len) {
|
||||||
goto err_msg;
|
goto err_msg;
|
||||||
|
|||||||
@@ -93,12 +93,14 @@ const struct hash_alg scram_sha512_plus = {
|
|||||||
* https://datatracker.ietf.org/doc/html/draft-ietf-kitten-password-storage
|
* https://datatracker.ietf.org/doc/html/draft-ietf-kitten-password-storage
|
||||||
*/
|
*/
|
||||||
const struct hash_alg *scram_algs[] = {
|
const struct hash_alg *scram_algs[] = {
|
||||||
|
#if !defined(STROPHE_TLS_SCHANNEL)
|
||||||
/* *1 */
|
/* *1 */
|
||||||
&scram_sha512_plus,
|
&scram_sha512_plus,
|
||||||
/* *1 */
|
/* *1 */
|
||||||
&scram_sha256_plus,
|
&scram_sha256_plus,
|
||||||
/* *1 */
|
/* *1 */
|
||||||
&scram_sha1_plus,
|
&scram_sha1_plus,
|
||||||
|
#endif
|
||||||
/* *1 */
|
/* *1 */
|
||||||
&scram_sha512,
|
&scram_sha512,
|
||||||
/* *1 */
|
/* *1 */
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ unsigned int tls_id_on_xmppaddr_num(xmpp_conn_t *conn);
|
|||||||
|
|
||||||
xmpp_tlscert_t *tls_peer_cert(xmpp_conn_t *conn);
|
xmpp_tlscert_t *tls_peer_cert(xmpp_conn_t *conn);
|
||||||
int tls_set_credentials(tls_t *tls, const char *cafilename);
|
int tls_set_credentials(tls_t *tls, const char *cafilename);
|
||||||
|
int tls_supports_channel_binding(tls_t *tls);
|
||||||
int tls_init_channel_binding(tls_t *tls,
|
int tls_init_channel_binding(tls_t *tls,
|
||||||
const char **binding_prefix,
|
const char **binding_prefix,
|
||||||
size_t *binding_prefix_len);
|
size_t *binding_prefix_len);
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ int tls_set_credentials(tls_t *tls, const char *cafilename)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tls_supports_channel_binding(tls_t *tls)
|
||||||
|
{
|
||||||
|
UNUSED(tls);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int tls_init_channel_binding(tls_t *tls,
|
int tls_init_channel_binding(tls_t *tls,
|
||||||
const char **binding_prefix,
|
const char **binding_prefix,
|
||||||
size_t *binding_prefix_len)
|
size_t *binding_prefix_len)
|
||||||
|
|||||||
@@ -577,6 +577,20 @@ int tls_set_credentials(tls_t *tls, const char *cafilename)
|
|||||||
return err == GNUTLS_E_SUCCESS;
|
return err == GNUTLS_E_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tls_supports_channel_binding(tls_t *tls)
|
||||||
|
{
|
||||||
|
switch (gnutls_protocol_get_version(tls->session)) {
|
||||||
|
case GNUTLS_SSL3:
|
||||||
|
case GNUTLS_TLS1_0:
|
||||||
|
case GNUTLS_TLS1_1:
|
||||||
|
case GNUTLS_TLS1_2:
|
||||||
|
case GNUTLS_TLS1_3:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int tls_init_channel_binding(tls_t *tls,
|
int tls_init_channel_binding(tls_t *tls,
|
||||||
const char **binding_prefix,
|
const char **binding_prefix,
|
||||||
size_t *binding_prefix_len)
|
size_t *binding_prefix_len)
|
||||||
|
|||||||
@@ -793,6 +793,22 @@ int tls_set_credentials(tls_t *tls, const char *cafilename)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tls_supports_channel_binding(tls_t *tls)
|
||||||
|
{
|
||||||
|
switch (SSL_version(tls->ssl)) {
|
||||||
|
case SSL3_VERSION:
|
||||||
|
case TLS1_VERSION:
|
||||||
|
case TLS1_1_VERSION:
|
||||||
|
case TLS1_2_VERSION:
|
||||||
|
#ifdef TLS1_3_VERSION
|
||||||
|
case TLS1_3_VERSION:
|
||||||
|
#endif
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int tls_init_channel_binding(tls_t *tls,
|
int tls_init_channel_binding(tls_t *tls,
|
||||||
const char **binding_prefix,
|
const char **binding_prefix,
|
||||||
size_t *binding_prefix_len)
|
size_t *binding_prefix_len)
|
||||||
|
|||||||
@@ -237,6 +237,12 @@ int tls_set_credentials(tls_t *tls, const char *cafilename)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tls_supports_channel_binding(tls_t *tls)
|
||||||
|
{
|
||||||
|
UNUSED(tls);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int tls_init_channel_binding(tls_t *tls,
|
int tls_init_channel_binding(tls_t *tls,
|
||||||
const char **binding_prefix,
|
const char **binding_prefix,
|
||||||
size_t *binding_prefix_len)
|
size_t *binding_prefix_len)
|
||||||
|
|||||||
Reference in New Issue
Block a user