@@ -21,7 +21,7 @@ typedef struct {
21
21
u_char * key ;
22
22
u_char * iv ;
23
23
time_t expires ;
24
-
24
+ ngx_flag_t iv_in_content ;
25
25
} ngx_http_encrypted_session_conf_t ;
26
26
27
27
@@ -42,6 +42,8 @@ static char *ngx_http_encrypted_session_iv(ngx_conf_t *cf, ngx_command_t *cmd,
42
42
static char * ngx_http_encrypted_session_expires (ngx_conf_t * cf ,
43
43
ngx_command_t * cmd , void * conf );
44
44
45
+ static char * ngx_http_encrypted_iv_in_content (ngx_conf_t * cf ,
46
+ ngx_command_t * cmd , void * conf );
45
47
46
48
static ngx_int_t ngx_http_encrypted_session_init (ngx_conf_t * cf );
47
49
static void * ngx_http_encrypted_session_create_main_conf (ngx_conf_t * cf );
@@ -53,7 +55,6 @@ static void *ngx_http_encrypted_session_create_conf(ngx_conf_t *cf);
53
55
static char * ngx_http_encrypted_session_merge_conf (ngx_conf_t * cf , void * parent ,
54
56
void * child );
55
57
56
-
57
58
static ndk_set_var_t ngx_http_set_encode_encrypted_session_filter = {
58
59
NDK_SET_VAR_VALUE ,
59
60
(void * ) ngx_http_set_encode_encrypted_session ,
@@ -115,7 +116,14 @@ static ngx_command_t ngx_http_encrypted_session_commands[] = {
115
116
0 ,
116
117
& ngx_http_set_decode_encrypted_session_filter
117
118
},
118
-
119
+ { ngx_string ("include_iv_in_encrypted_payload" ),
120
+ NGX_HTTP_MAIN_CONF |NGX_HTTP_SRV_CONF |NGX_HTTP_SIF_CONF
121
+ |NGX_HTTP_LOC_CONF |NGX_HTTP_LIF_CONF |NGX_CONF_NOARGS ,
122
+ ngx_http_encrypted_iv_in_content ,
123
+ NGX_HTTP_LOC_CONF_OFFSET ,
124
+ 0 ,
125
+ NULL
126
+ },
119
127
ngx_null_command
120
128
};
121
129
@@ -360,6 +368,13 @@ ngx_http_encrypted_session_expires(ngx_conf_t *cf, ngx_command_t *cmd,
360
368
return NGX_CONF_OK ;
361
369
}
362
370
371
+ static char * ngx_http_encrypted_iv_in_content (ngx_conf_t * cf ,
372
+ ngx_command_t * cmd , void * conf )
373
+ {
374
+ ngx_http_encrypted_session_conf_t * llcf = conf ;
375
+ llcf -> iv_in_content = 1 ;
376
+ return NGX_CONF_OK ;
377
+ }
363
378
364
379
static void
365
380
ngx_http_encrypted_session_free_cipher_ctx (void * data )
@@ -437,6 +452,7 @@ ngx_http_encrypted_session_create_conf(ngx_conf_t *cf)
437
452
conf -> key = NGX_CONF_UNSET_PTR ;
438
453
conf -> iv = NGX_CONF_UNSET_PTR ;
439
454
conf -> expires = NGX_CONF_UNSET ;
455
+ conf -> iv_in_content = NGX_CONF_UNSET ;
440
456
441
457
return conf ;
442
458
}
@@ -455,6 +471,7 @@ ngx_http_encrypted_session_merge_conf(ngx_conf_t *cf, void *parent, void *child)
455
471
456
472
ngx_conf_merge_value (conf -> expires , prev -> expires ,
457
473
ngx_http_encrypted_session_default_expires );
474
+ ngx_conf_merge_value (conf -> iv_in_content , prev -> iv_in_content , 0 );
458
475
459
476
return NGX_CONF_OK ;
460
477
}
0 commit comments