comparison src/event/ngx_event_quic_protection.c @ 7853:2d0f4aa78ed6 quic

Restored ngx_quic_encrypt return type. It was inadvertently changed while working on removing memory allocations.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 06 May 2020 14:34:44 +0300
parents 0aa6b02a1546
children 7ea34e13937f
comparison
equal deleted inserted replaced
7852:0aa6b02a1546 7853:2d0f4aa78ed6
51 static ngx_int_t ngx_quic_tls_hp(ngx_log_t *log, const EVP_CIPHER *cipher, 51 static ngx_int_t ngx_quic_tls_hp(ngx_log_t *log, const EVP_CIPHER *cipher,
52 ngx_quic_secret_t *s, u_char *out, u_char *in); 52 ngx_quic_secret_t *s, u_char *out, u_char *in);
53 static ngx_int_t ngx_quic_hkdf_expand(ngx_pool_t *pool, const EVP_MD *digest, 53 static ngx_int_t ngx_quic_hkdf_expand(ngx_pool_t *pool, const EVP_MD *digest,
54 ngx_str_t *out, ngx_str_t *label, const uint8_t *prk, size_t prk_len); 54 ngx_str_t *out, ngx_str_t *label, const uint8_t *prk, size_t prk_len);
55 55
56 static ssize_t ngx_quic_create_long_packet(ngx_quic_header_t *pkt, 56 static ngx_int_t ngx_quic_create_long_packet(ngx_quic_header_t *pkt,
57 ngx_ssl_conn_t *ssl_conn, ngx_str_t *res); 57 ngx_ssl_conn_t *ssl_conn, ngx_str_t *res);
58 static ssize_t ngx_quic_create_short_packet(ngx_quic_header_t *pkt, 58 static ngx_int_t ngx_quic_create_short_packet(ngx_quic_header_t *pkt,
59 ngx_ssl_conn_t *ssl_conn, ngx_str_t *res); 59 ngx_ssl_conn_t *ssl_conn, ngx_str_t *res);
60 60
61 61
62 static ngx_int_t 62 static ngx_int_t
63 ngx_quic_ciphers(ngx_ssl_conn_t *ssl_conn, ngx_quic_ciphers_t *ciphers, 63 ngx_quic_ciphers(ngx_ssl_conn_t *ssl_conn, ngx_quic_ciphers_t *ciphers,
750 750
751 return NGX_OK; 751 return NGX_OK;
752 } 752 }
753 753
754 754
755 static ssize_t 755 static ngx_int_t
756 ngx_quic_create_long_packet(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn, 756 ngx_quic_create_long_packet(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
757 ngx_str_t *res) 757 ngx_str_t *res)
758 { 758 {
759 u_char *pnp, *sample; 759 u_char *pnp, *sample;
760 ngx_str_t ad, out; 760 ngx_str_t ad, out;
817 817
818 return NGX_OK; 818 return NGX_OK;
819 } 819 }
820 820
821 821
822 static ssize_t 822 static ngx_int_t
823 ngx_quic_create_short_packet(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn, 823 ngx_quic_create_short_packet(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
824 ngx_str_t *res) 824 ngx_str_t *res)
825 { 825 {
826 u_char *pnp, *sample; 826 u_char *pnp, *sample;
827 ngx_str_t ad, out; 827 ngx_str_t ad, out;
942 nonce[len - 2] ^= (pn & 0x0000ff00) >> 8; 942 nonce[len - 2] ^= (pn & 0x0000ff00) >> 8;
943 nonce[len - 1] ^= (pn & 0x000000ff); 943 nonce[len - 1] ^= (pn & 0x000000ff);
944 } 944 }
945 945
946 946
947 ssize_t 947 ngx_int_t
948 ngx_quic_encrypt(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn, 948 ngx_quic_encrypt(ngx_quic_header_t *pkt, ngx_ssl_conn_t *ssl_conn,
949 ngx_str_t *res) 949 ngx_str_t *res)
950 { 950 {
951 if (ngx_quic_short_pkt(pkt->flags)) { 951 if (ngx_quic_short_pkt(pkt->flags)) {
952 return ngx_quic_create_short_packet(pkt, ssl_conn, res); 952 return ngx_quic_create_short_packet(pkt, ssl_conn, res);