Chained callbacks
Dieser Commit ist enthalten in:
Ursprung
c78bc6101d
Commit
79d0b7cc5a
@ -11,6 +11,7 @@
|
||||
|
||||
#define PORT 1443
|
||||
#define SSL_CONN_DATA 0x01
|
||||
#define SSL_DEF_CB 0x02
|
||||
#define SERVER "localhost"
|
||||
#define CLIENT "localhost"
|
||||
#define CACERT "etc/ca/ca.cert.pem"
|
||||
|
@ -113,12 +113,26 @@ static uint64_t time_now() {
|
||||
return ts.tv_sec * 1000000000 + ts.tv_nsec;
|
||||
}
|
||||
|
||||
// Starts counting time after key has been generated on client side
|
||||
typedef void(*ngx_default_info_cb_t)(const SSL *ssl, int type, int value);
|
||||
static void chained_cb(const SSL *ssl, int type, int value) {
|
||||
if (!ssl) {
|
||||
return;
|
||||
}
|
||||
|
||||
//printf("CHAINED > \n");
|
||||
ngx_default_info_cb_t cb =
|
||||
SSL_CTX_get_ex_data(
|
||||
SSL_get_SSL_CTX(ssl), SSL_DEF_CB);
|
||||
|
||||
if (cb) {
|
||||
cb(ssl,type,value);
|
||||
}
|
||||
}
|
||||
|
||||
static void after_keygen_handshake_time(const SSL *ssl, int type, int value) {
|
||||
|
||||
static const char* ss_exp = "send_server_hello";
|
||||
// OZAPTF: should be static
|
||||
const size_t ss_exp_len = strlen(ss_exp);
|
||||
static const size_t ss_exp_len = 17;
|
||||
|
||||
switch (type) {
|
||||
case SSL_CB_ACCEPT_LOOP: {
|
||||
@ -181,6 +195,9 @@ static SSL_CTX* setup_server_ctx(const char* cert_name) {
|
||||
|
||||
}
|
||||
SSL_CTX_set_info_callback(ctx, after_keygen_handshake_time);
|
||||
ngx_default_info_cb_t cb = SSL_CTX_get_info_callback(ctx);
|
||||
SSL_CTX_set_ex_data(ctx, SSL_DEF_CB, (void*)cb);
|
||||
SSL_CTX_set_info_callback(ctx, chained_cb);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren