quic : refactor function naming 00/22100/6
authorMathiasRaoul <mathias.raoul@gmail.com>
Tue, 17 Sep 2019 14:37:13 +0000 (14:37 +0000)
committerDave Wallace <dwallacelf@gmail.com>
Wed, 18 Sep 2019 14:58:40 +0000 (14:58 +0000)
- functions renaming to be consistent with the other plugin functions name
- removing useless logs

Type: style

Signed-off-by: MathiasRaoul <mathias.raoul@gmail.com>
Change-Id: Iea212a799448975e01a92f16cc329de13907ff07
Signed-off-by: MathiasRaoul <mathias.raoul@gmail.com>
src/plugins/quic/quic.c
src/plugins/quic/quic_crypto.c
src/plugins/quic/quic_crypto.h

index 97f03e5..19004ea 100644 (file)
@@ -2226,7 +2226,7 @@ quic_init (vlib_main_t * vm)
   transport_register_protocol (TRANSPORT_PROTO_QUIC, &quic_proto,
                               FIB_PROTOCOL_IP6, ~0);
 
-  quic_register_cipher_suite (CRYPTO_ENGINE_VPP, vpp_crypto_cipher_suites);
+  quic_register_cipher_suite (CRYPTO_ENGINE_VPP, quic_crypto_cipher_suites);
   quic_register_cipher_suite (CRYPTO_ENGINE_PICOTLS,
                              ptls_openssl_cipher_suites);
   qm->default_cipher = CRYPTO_ENGINE_PICOTLS;
index 6c19896..c30e68c 100644 (file)
@@ -41,7 +41,7 @@ struct aead_crypto_context_t
 vnet_crypto_main_t *cm = &crypto_main;
 
 static void
-vpp_crypto_cipher_do_init (ptls_cipher_context_t * _ctx, const void *iv)
+quic_crypto_cipher_do_init (ptls_cipher_context_t * _ctx, const void *iv)
 {
   struct cipher_context_t *ctx = (struct cipher_context_t *) _ctx;
 
@@ -67,14 +67,14 @@ vpp_crypto_cipher_do_init (ptls_cipher_context_t * _ctx, const void *iv)
 }
 
 static void
-vpp_crypto_cipher_dispose (ptls_cipher_context_t * _ctx)
+quic_crypto_cipher_dispose (ptls_cipher_context_t * _ctx)
 {
   /* Do nothing */
 }
 
 static void
-vpp_crypto_cipher_encrypt (ptls_cipher_context_t * _ctx, void *output,
-                          const void *input, size_t _len)
+quic_crypto_cipher_encrypt (ptls_cipher_context_t * _ctx, void *output,
+                           const void *input, size_t _len)
 {
   vlib_main_t *vm = vlib_get_main ();
   struct cipher_context_t *ctx = (struct cipher_context_t *) _ctx;
@@ -87,14 +87,14 @@ vpp_crypto_cipher_encrypt (ptls_cipher_context_t * _ctx, void *output,
 }
 
 static int
-vpp_crypto_cipher_setup_crypto (ptls_cipher_context_t * _ctx, int is_enc,
-                               const void *key, const EVP_CIPHER * cipher,
-                               quicly_do_transform_fn do_transform)
+quic_crypto_cipher_setup_crypto (ptls_cipher_context_t * _ctx, int is_enc,
+                                const void *key, const EVP_CIPHER * cipher,
+                                quicly_do_transform_fn do_transform)
 {
   struct cipher_context_t *ctx = (struct cipher_context_t *) _ctx;
 
-  ctx->super.do_dispose = vpp_crypto_cipher_dispose;
-  ctx->super.do_init = vpp_crypto_cipher_do_init;
+  ctx->super.do_dispose = quic_crypto_cipher_dispose;
+  ctx->super.do_init = quic_crypto_cipher_do_init;
   ctx->super.do_transform = do_transform;
 
   vlib_main_t *vm = vlib_get_main ();
@@ -124,25 +124,23 @@ static int
 aes128ctr_setup_crypto (ptls_cipher_context_t * ctx, int is_enc,
                        const void *key)
 {
-  return vpp_crypto_cipher_setup_crypto (ctx, 1, key, EVP_aes_128_ctr (),
-                                        vpp_crypto_cipher_encrypt);
+  return quic_crypto_cipher_setup_crypto (ctx, 1, key, EVP_aes_128_ctr (),
+                                         quic_crypto_cipher_encrypt);
 }
 
 static int
 aes256ctr_setup_crypto (ptls_cipher_context_t * ctx, int is_enc,
                        const void *key)
 {
-  return vpp_crypto_cipher_setup_crypto (ctx, 1, key, EVP_aes_256_ctr (),
-                                        vpp_crypto_cipher_encrypt);
+  return quic_crypto_cipher_setup_crypto (ctx, 1, key, EVP_aes_256_ctr (),
+                                         quic_crypto_cipher_encrypt);
 }
 
 size_t
-vpp_crypto_aead_encrypt (ptls_aead_context_t * _ctx, void *output,
-                        const void *input, size_t inlen, uint64_t seq,
-                        const void *iv, const void *aad, size_t aadlen)
+quic_crypto_aead_encrypt (ptls_aead_context_t * _ctx, void *output,
+                         const void *input, size_t inlen, uint64_t seq,
+                         const void *iv, const void *aad, size_t aadlen)
 {
-  QUIC_DBG (1, "[quic] %s", __FUNCTION__);
-
   vlib_main_t *vm = vlib_get_main ();
   struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx;
 
@@ -179,12 +177,10 @@ vpp_crypto_aead_encrypt (ptls_aead_context_t * _ctx, void *output,
 }
 
 size_t
-vpp_crypto_aead_decrypt (ptls_aead_context_t * _ctx, void *_output,
-                        const void *input, size_t inlen, const void *iv,
-                        const void *aad, size_t aadlen)
+quic_crypto_aead_decrypt (ptls_aead_context_t * _ctx, void *_output,
+                         const void *input, size_t inlen, const void *iv,
+                         const void *aad, size_t aadlen)
 {
-  QUIC_DBG (1, "[quic] %s", __FUNCTION__);
-
   vlib_main_t *vm = vlib_get_main ();
   struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx;
 
@@ -221,17 +217,15 @@ vpp_crypto_aead_decrypt (ptls_aead_context_t * _ctx, void *_output,
 }
 
 static void
-vpp_crypto_aead_dispose_crypto (ptls_aead_context_t * _ctx)
+quic_crypto_aead_dispose_crypto (ptls_aead_context_t * _ctx)
 {
-  QUIC_DBG (1, "[quic] %s", __FUNCTION__);
+
 }
 
 static int
-vpp_crypto_aead_setup_crypto (ptls_aead_context_t * _ctx, int is_enc,
-                             const void *key, const EVP_CIPHER * cipher)
+quic_crypto_aead_setup_crypto (ptls_aead_context_t * _ctx, int is_enc,
+                              const void *key, const EVP_CIPHER * cipher)
 {
-  QUIC_DBG (1, "%s, algo : ", __FUNCTION__, _ctx->algo->name);
-
   vlib_main_t *vm = vlib_get_main ();
   struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *) _ctx;
 
@@ -246,13 +240,14 @@ vpp_crypto_aead_setup_crypto (ptls_aead_context_t * _ctx, int is_enc,
     }
   else
     {
-      QUIC_DBG (1, "%s, algo : ", __FUNCTION__, _ctx->algo->name);
+      QUIC_DBG (1, "%s, invalied aead cipher %s", __FUNCTION__,
+               _ctx->algo->name);
       assert (0);
     }
 
-  ctx->super.do_decrypt = vpp_crypto_aead_decrypt;
-  ctx->super.do_encrypt = vpp_crypto_aead_encrypt;
-  ctx->super.dispose_crypto = vpp_crypto_aead_dispose_crypto;
+  ctx->super.do_decrypt = quic_crypto_aead_decrypt;
+  ctx->super.do_encrypt = quic_crypto_aead_encrypt;
+  ctx->super.dispose_crypto = quic_crypto_aead_dispose_crypto;
 
   ctx->key_index = vnet_crypto_key_add (vm, algo,
                                        (u8 *) key, _ctx->algo->key_size);
@@ -261,27 +256,27 @@ vpp_crypto_aead_setup_crypto (ptls_aead_context_t * _ctx, int is_enc,
 }
 
 static int
-vpp_crypto_aead_aes128gcm_setup_crypto (ptls_aead_context_t * ctx, int is_enc,
-                                       const void *key)
+quic_crypto_aead_aes128gcm_setup_crypto (ptls_aead_context_t * ctx,
+                                        int is_enc, const void *key)
 {
-  return vpp_crypto_aead_setup_crypto (ctx, is_enc, key, EVP_aes_128_gcm ());
+  return quic_crypto_aead_setup_crypto (ctx, is_enc, key, EVP_aes_128_gcm ());
 }
 
 static int
-vpp_crypto_aead_aes256gcm_setup_crypto (ptls_aead_context_t * ctx, int is_enc,
-                                       const void *key)
+quic_crypto_aead_aes256gcm_setup_crypto (ptls_aead_context_t * ctx,
+                                        int is_enc, const void *key)
 {
-  return vpp_crypto_aead_setup_crypto (ctx, is_enc, key, EVP_aes_256_gcm ());
+  return quic_crypto_aead_setup_crypto (ctx, is_enc, key, EVP_aes_256_gcm ());
 }
 
-ptls_cipher_algorithm_t vpp_crypto_aes128ctr = { "AES128-CTR",
+ptls_cipher_algorithm_t quic_crypto_aes128ctr = { "AES128-CTR",
   PTLS_AES128_KEY_SIZE,
   1, PTLS_AES_IV_SIZE,
   sizeof (struct cipher_context_t),
   aes128ctr_setup_crypto
 };
 
-ptls_cipher_algorithm_t vpp_crypto_aes256ctr = { "AES256-CTR",
+ptls_cipher_algorithm_t quic_crypto_aes256ctr = { "AES256-CTR",
   PTLS_AES256_KEY_SIZE,
   1 /* block size */ ,
   PTLS_AES_IV_SIZE,
@@ -289,41 +284,41 @@ ptls_cipher_algorithm_t vpp_crypto_aes256ctr = { "AES256-CTR",
   aes256ctr_setup_crypto
 };
 
-ptls_aead_algorithm_t vpp_crypto_aes128gcm = { "AES128-GCM",
-  &vpp_crypto_aes128ctr,
+ptls_aead_algorithm_t quic_crypto_aes128gcm = { "AES128-GCM",
+  &quic_crypto_aes128ctr,
   NULL,
   PTLS_AES128_KEY_SIZE,
   PTLS_AESGCM_IV_SIZE,
   PTLS_AESGCM_TAG_SIZE,
   sizeof (struct aead_crypto_context_t),
-  vpp_crypto_aead_aes128gcm_setup_crypto
+  quic_crypto_aead_aes128gcm_setup_crypto
 };
 
-ptls_aead_algorithm_t vpp_crypto_aes256gcm = { "AES256-GCM",
-  &vpp_crypto_aes256ctr,
+ptls_aead_algorithm_t quic_crypto_aes256gcm = { "AES256-GCM",
+  &quic_crypto_aes256ctr,
   NULL,
   PTLS_AES256_KEY_SIZE,
   PTLS_AESGCM_IV_SIZE,
   PTLS_AESGCM_TAG_SIZE,
   sizeof (struct aead_crypto_context_t),
-  vpp_crypto_aead_aes256gcm_setup_crypto
+  quic_crypto_aead_aes256gcm_setup_crypto
 };
 
-ptls_cipher_suite_t vpp_crypto_aes128gcmsha256 =
+ptls_cipher_suite_t quic_crypto_aes128gcmsha256 =
   { PTLS_CIPHER_SUITE_AES_128_GCM_SHA256,
-  &vpp_crypto_aes128gcm,
+  &quic_crypto_aes128gcm,
   &ptls_openssl_sha256
 };
 
-ptls_cipher_suite_t vpp_crypto_aes256gcmsha384 =
+ptls_cipher_suite_t quic_crypto_aes256gcmsha384 =
   { PTLS_CIPHER_SUITE_AES_256_GCM_SHA384,
-  &vpp_crypto_aes256gcm,
+  &quic_crypto_aes256gcm,
   &ptls_openssl_sha384
 };
 
-ptls_cipher_suite_t *vpp_crypto_cipher_suites[] =
-  { &vpp_crypto_aes256gcmsha384,
-  &vpp_crypto_aes128gcmsha256,
+ptls_cipher_suite_t *quic_crypto_cipher_suites[] =
+  { &quic_crypto_aes256gcmsha384,
+  &quic_crypto_aes128gcmsha256,
   NULL
 };
 
index 8e4bbf9..625d838 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <quicly.h>
 
-extern ptls_cipher_suite_t *vpp_crypto_cipher_suites[];
+extern ptls_cipher_suite_t *quic_crypto_cipher_suites[];
 
 #endif /* __included_vpp_quic_crypto_h__ */