comparison src/stream/ngx_stream_quic_module.c @ 8634:831d1960826f quic

QUIC: generate default stateless reset token key. Previously, if quic_stateless_reset_token_key was empty or unspecified, initial stateless reset token was not generated. However subsequent tokens were generated with empty key, which resulted in error with certain SSL libraries, for example OpenSSL. Now a random 32-byte stateless reset token key is generated if none is specified in the configuration. As a result, stateless reset tokens are now generated for all server ids.
author Roman Arutyunyan <arut@nginx.com>
date Wed, 11 Nov 2020 21:08:48 +0000
parents d8b01c2b8931
children dffb66fb783b
comparison
equal deleted inserted replaced
8633:d8b01c2b8931 8634:831d1960826f
311 } 311 }
312 } 312 }
313 313
314 ngx_conf_merge_str_value(conf->sr_token_key, prev->sr_token_key, ""); 314 ngx_conf_merge_str_value(conf->sr_token_key, prev->sr_token_key, "");
315 315
316 if (conf->sr_token_key.len == 0) {
317 conf->sr_token_key.len = NGX_QUIC_DEFAULT_SRT_KEY_LEN;
318
319 conf->sr_token_key.data = ngx_pnalloc(cf->pool, conf->sr_token_key.len);
320 if (conf->sr_token_key.data == NULL) {
321 return NGX_CONF_ERROR;
322 }
323
324 if (RAND_bytes(conf->sr_token_key.data, conf->sr_token_key.len) <= 0) {
325 return NGX_CONF_ERROR;
326 }
327 }
328
316 scf = ngx_stream_conf_get_module_srv_conf(cf, ngx_stream_ssl_module); 329 scf = ngx_stream_conf_get_module_srv_conf(cf, ngx_stream_ssl_module);
317 conf->ssl = &scf->ssl; 330 conf->ssl = &scf->ssl;
318 331
319 return NGX_CONF_OK; 332 return NGX_CONF_OK;
320 } 333 }