From 65910fb9bf9af117aa833191034bc6282902d6c9 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Tue, 26 May 2020 18:15:38 +0900
Subject: [PATCH] Remove ngtcp2_pkt_retry parameter from ngtcp2_recv_retry

---
 crypto/includes/ngtcp2/ngtcp2_crypto.h |  1 -
 crypto/shared.c                        |  2 --
 lib/includes/ngtcp2/ngtcp2.h           | 10 ----------
 lib/ngtcp2_conn.c                      |  2 +-
 lib/ngtcp2_pkt.h                       |  9 +++++++++
 tests/ngtcp2_conn_test.c               |  3 +--
 6 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/crypto/includes/ngtcp2/ngtcp2_crypto.h b/crypto/includes/ngtcp2/ngtcp2_crypto.h
index 1beac11c..3197c5dc 100644
--- a/crypto/includes/ngtcp2/ngtcp2_crypto.h
+++ b/crypto/includes/ngtcp2/ngtcp2_crypto.h
@@ -449,7 +449,6 @@ NGTCP2_EXTERN int ngtcp2_crypto_client_initial_cb(ngtcp2_conn *conn,
  */
 NGTCP2_EXTERN int ngtcp2_crypto_recv_retry_cb(ngtcp2_conn *conn,
                                               const ngtcp2_pkt_hd *hd,
-                                              const ngtcp2_pkt_retry *retry,
                                               void *user_data);
 
 /**
diff --git a/crypto/shared.c b/crypto/shared.c
index 5b9fe42f..bea088e8 100644
--- a/crypto/shared.c
+++ b/crypto/shared.c
@@ -616,9 +616,7 @@ int ngtcp2_crypto_client_initial_cb(ngtcp2_conn *conn, void *user_data) {
 }
 
 int ngtcp2_crypto_recv_retry_cb(ngtcp2_conn *conn, const ngtcp2_pkt_hd *hd,
-                                const ngtcp2_pkt_retry *retry,
                                 void *user_data) {
-  (void)retry;
   (void)user_data;
 
   if (ngtcp2_crypto_derive_and_install_initial_key(conn, NULL, NULL, NULL, NULL,
diff --git a/lib/includes/ngtcp2/ngtcp2.h b/lib/includes/ngtcp2/ngtcp2.h
index c8ec9723..c205a50e 100644
--- a/lib/includes/ngtcp2/ngtcp2.h
+++ b/lib/includes/ngtcp2/ngtcp2.h
@@ -385,15 +385,6 @@ typedef struct ngtcp2_pkt_stateless_reset {
   size_t randlen;
 } ngtcp2_pkt_stateless_reset;
 
-/* NGTCP2_RETRY_TAGLEN is the length of Retry packet integrity tag. */
-#define NGTCP2_RETRY_TAGLEN 16
-
-typedef struct ngtcp2_pkt_retry {
-  ngtcp2_cid odcid;
-  ngtcp2_vec token;
-  uint8_t tag[NGTCP2_RETRY_TAGLEN];
-} ngtcp2_pkt_retry;
-
 #if defined(__cplusplus) && __cplusplus >= 201103L
 typedef enum ngtcp2_transport_param_id : int {
 #else
@@ -1195,7 +1186,6 @@ typedef int (*ngtcp2_recv_version_negotiation)(ngtcp2_conn *conn,
  * immediately.
  */
 typedef int (*ngtcp2_recv_retry)(ngtcp2_conn *conn, const ngtcp2_pkt_hd *hd,
-                                 const ngtcp2_pkt_retry *retry,
                                  void *user_data);
 
 /**
diff --git a/lib/ngtcp2_conn.c b/lib/ngtcp2_conn.c
index caf94dfc..7289eddc 100644
--- a/lib/ngtcp2_conn.c
+++ b/lib/ngtcp2_conn.c
@@ -3659,7 +3659,7 @@ static int conn_on_retry(ngtcp2_conn *conn, const ngtcp2_pkt_hd *hd,
 
   assert(conn->callbacks.recv_retry);
 
-  rv = conn->callbacks.recv_retry(conn, hd, &retry, conn->user_data);
+  rv = conn->callbacks.recv_retry(conn, hd, conn->user_data);
   if (rv != 0) {
     return NGTCP2_ERR_CALLBACK_FAILURE;
   }
diff --git a/lib/ngtcp2_pkt.h b/lib/ngtcp2_pkt.h
index 6e9249c5..caf4152c 100644
--- a/lib/ngtcp2_pkt.h
+++ b/lib/ngtcp2_pkt.h
@@ -99,6 +99,15 @@
    Reset. */
 #define NGTCP2_MIN_PKT_EXPANDLEN 22
 
+/* NGTCP2_RETRY_TAGLEN is the length of Retry packet integrity tag. */
+#define NGTCP2_RETRY_TAGLEN 16
+
+typedef struct ngtcp2_pkt_retry {
+  ngtcp2_cid odcid;
+  ngtcp2_vec token;
+  uint8_t tag[NGTCP2_RETRY_TAGLEN];
+} ngtcp2_pkt_retry;
+
 typedef enum {
   NGTCP2_FRAME_PADDING = 0x00,
   NGTCP2_FRAME_PING = 0x01,
diff --git a/tests/ngtcp2_conn_test.c b/tests/ngtcp2_conn_test.c
index 256b3c1e..8b64f385 100644
--- a/tests/ngtcp2_conn_test.c
+++ b/tests/ngtcp2_conn_test.c
@@ -318,10 +318,9 @@ recv_stream_data_shutdown_stream_read(ngtcp2_conn *conn, int64_t stream_id,
 }
 
 static int recv_retry(ngtcp2_conn *conn, const ngtcp2_pkt_hd *hd,
-                      const ngtcp2_pkt_retry *retry, void *user_data) {
+                      void *user_data) {
   (void)conn;
   (void)hd;
-  (void)retry;
   (void)user_data;
   return 0;
 }
-- 
GitLab