2424 */
2525#ifdef HAVE_CONFIG_H
2626# include <config.h>
27- #endif /* HAVE_CONFIG_H */
27+ #endif /* defined( HAVE_CONFIG_H) */
2828
2929#include <assert.h>
3030#include <string.h>
@@ -52,15 +52,15 @@ typedef struct ngtcp2_crypto_boringssl_cipher {
5252} ngtcp2_crypto_boringssl_cipher;
5353
5454static ngtcp2_crypto_boringssl_cipher crypto_cipher_aes_128 = {
55- NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_AES_128,
55+ NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_AES_128,
5656};
5757
5858static ngtcp2_crypto_boringssl_cipher crypto_cipher_aes_256 = {
59- NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_AES_256,
59+ NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_AES_256,
6060};
6161
6262static ngtcp2_crypto_boringssl_cipher crypto_cipher_chacha20 = {
63- NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_CHACHA20,
63+ NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_CHACHA20,
6464};
6565
6666ngtcp2_crypto_aead *ngtcp2_crypto_aead_aes_128_gcm(ngtcp2_crypto_aead *aead) {
@@ -175,7 +175,7 @@ static ngtcp2_crypto_ctx *crypto_ctx_cipher_id(ngtcp2_crypto_ctx *ctx,
175175 ctx->hp.native_handle = (void *)crypto_cipher_id_get_hp(cipher_id);
176176 ctx->max_encryption = crypto_cipher_id_get_aead_max_encryption(cipher_id);
177177 ctx->max_decryption_failure =
178- crypto_cipher_id_get_aead_max_decryption_failure(cipher_id);
178+ crypto_cipher_id_get_aead_max_decryption_failure(cipher_id);
179179
180180 return ctx;
181181}
@@ -413,12 +413,12 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp,
413413 AES_ecb_encrypt(sample, dest, &ctx->aes_key, 1);
414414 return 0;
415415 case NGTCP2_CRYPTO_BORINGSSL_CIPHER_TYPE_CHACHA20:
416- #if defined( WORDS_BIGENDIAN)
416+ #ifdef WORDS_BIGENDIAN
417417 counter = (uint32_t)sample[0] + (uint32_t)(sample[1] << 8) +
418418 (uint32_t)(sample[2] << 16) + (uint32_t)(sample[3] << 24);
419- #else /* !WORDS_BIGENDIAN */
419+ #else /* !defined( WORDS_BIGENDIAN) */
420420 memcpy(&counter, sample, sizeof(counter));
421- #endif /* !WORDS_BIGENDIAN */
421+ #endif /* !defined( WORDS_BIGENDIAN) */
422422 CRYPTO_chacha_20(dest, PLAINTEXT, sizeof(PLAINTEXT) - 1, ctx->key,
423423 sample + sizeof(counter), counter);
424424 return 0;
@@ -429,17 +429,16 @@ int ngtcp2_crypto_hp_mask(uint8_t *dest, const ngtcp2_crypto_cipher *hp,
429429}
430430
431431int ngtcp2_crypto_read_write_crypto_data(
432- ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level,
433- const uint8_t *data, size_t datalen) {
432+ ngtcp2_conn *conn, ngtcp2_encryption_level encryption_level,
433+ const uint8_t *data, size_t datalen) {
434434 SSL *ssl = ngtcp2_conn_get_tls_native_handle(conn);
435435 int rv;
436436 int err;
437437
438438 if (SSL_provide_quic_data(
439- ssl,
440- ngtcp2_crypto_boringssl_from_ngtcp2_encryption_level(
441- encryption_level),
442- data, datalen) != 1) {
439+ ssl,
440+ ngtcp2_crypto_boringssl_from_ngtcp2_encryption_level(encryption_level),
441+ data, datalen) != 1) {
443442 return -1;
444443 }
445444
@@ -522,7 +521,7 @@ int ngtcp2_crypto_set_local_transport_params(void *tls, const uint8_t *buf,
522521}
523522
524523ngtcp2_encryption_level ngtcp2_crypto_boringssl_from_ssl_encryption_level(
525- enum ssl_encryption_level_t ssl_level) {
524+ enum ssl_encryption_level_t ssl_level) {
526525 switch (ssl_level) {
527526 case ssl_encryption_initial:
528527 return NGTCP2_ENCRYPTION_LEVEL_INITIAL;
@@ -540,7 +539,7 @@ ngtcp2_encryption_level ngtcp2_crypto_boringssl_from_ssl_encryption_level(
540539
541540enum ssl_encryption_level_t
542541ngtcp2_crypto_boringssl_from_ngtcp2_encryption_level(
543- ngtcp2_encryption_level encryption_level) {
542+ ngtcp2_encryption_level encryption_level) {
544543 switch (encryption_level) {
545544 case NGTCP2_ENCRYPTION_LEVEL_INITIAL:
546545 return ssl_encryption_initial;
@@ -582,7 +581,7 @@ static int set_read_secret(SSL *ssl, enum ssl_encryption_level_t bssl_level,
582581 ngtcp2_crypto_conn_ref *conn_ref = SSL_get_app_data(ssl);
583582 ngtcp2_conn *conn = conn_ref->get_conn(conn_ref);
584583 ngtcp2_encryption_level level =
585- ngtcp2_crypto_boringssl_from_ssl_encryption_level(bssl_level);
584+ ngtcp2_crypto_boringssl_from_ssl_encryption_level(bssl_level);
586585 (void)cipher;
587586
588587 if (ngtcp2_crypto_derive_and_install_rx_key(conn, NULL, NULL, NULL, level,
@@ -599,7 +598,7 @@ static int set_write_secret(SSL *ssl, enum ssl_encryption_level_t bssl_level,
599598 ngtcp2_crypto_conn_ref *conn_ref = SSL_get_app_data(ssl);
600599 ngtcp2_conn *conn = conn_ref->get_conn(conn_ref);
601600 ngtcp2_encryption_level level =
602- ngtcp2_crypto_boringssl_from_ssl_encryption_level(bssl_level);
601+ ngtcp2_crypto_boringssl_from_ssl_encryption_level(bssl_level);
603602 (void)cipher;
604603
605604 if (ngtcp2_crypto_derive_and_install_tx_key(conn, NULL, NULL, NULL, level,
@@ -615,7 +614,7 @@ static int add_handshake_data(SSL *ssl, enum ssl_encryption_level_t bssl_level,
615614 ngtcp2_crypto_conn_ref *conn_ref = SSL_get_app_data(ssl);
616615 ngtcp2_conn *conn = conn_ref->get_conn(conn_ref);
617616 ngtcp2_encryption_level level =
618- ngtcp2_crypto_boringssl_from_ssl_encryption_level(bssl_level);
617+ ngtcp2_crypto_boringssl_from_ssl_encryption_level(bssl_level);
619618 int rv;
620619
621620 rv = ngtcp2_conn_submit_crypto_data(conn, level, data, datalen);
@@ -644,8 +643,8 @@ static int send_alert(SSL *ssl, enum ssl_encryption_level_t bssl_level,
644643}
645644
646645static SSL_QUIC_METHOD quic_method = {
647- set_read_secret, set_write_secret, add_handshake_data,
648- flush_flight, send_alert,
646+ set_read_secret, set_write_secret, add_handshake_data,
647+ flush_flight, send_alert,
649648};
650649
651650static void crypto_boringssl_configure_context(SSL_CTX *ssl_ctx) {
0 commit comments