#define NGX_QUIC_MAX_TOKEN_SIZE 64
/* SHA-1(addr)=20 + sizeof(time_t) + retry(1) + odcid.len(1) + odcid */
+/* RFC 3602, 2.1 and 2.4 for AES-CBC block size and IV length */
+#define NGX_QUIC_AES_256_CBC_IV_LEN 16
+#define NGX_QUIC_AES_256_CBC_BLOCK_SIZE 16
+
static void ngx_quic_address_hash(struct sockaddr *sockaddr, socklen_t socklen,
ngx_uint_t no_port, u_char buf[20]);
len = p - in;
cipher = EVP_aes_256_cbc();
- iv_len = EVP_CIPHER_iv_length(cipher);
+ iv_len = NGX_QUIC_AES_256_CBC_IV_LEN;
- token->len = iv_len + len + EVP_CIPHER_block_size(cipher);
+ token->len = iv_len + len + NGX_QUIC_AES_256_CBC_BLOCK_SIZE;
token->data = ngx_pnalloc(c->pool, token->len);
if (token->data == NULL) {
return NGX_ERROR;
cipher = EVP_aes_256_cbc();
iv = pkt->token.data;
- iv_len = EVP_CIPHER_iv_length(cipher);
+ iv_len = NGX_QUIC_AES_256_CBC_IV_LEN;
/* sanity checks */
- if (pkt->token.len < (size_t) iv_len + EVP_CIPHER_block_size(cipher)) {
+ if (pkt->token.len < (size_t) iv_len + NGX_QUIC_AES_256_CBC_BLOCK_SIZE) {
goto garbage;
}