Bug 1297662 - Remove gf2_8.c & gf2_8.h as they are unused. r=jesup
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 26 Sep 2016 06:40:59 -0500
changeset 315346 8009d19e29e0c4312cbc5f6dca6c32697dafd46f
parent 315345 29af8ec8706ea4d82d861aa0c1862486648d0ee6
child 315347 114ea1bc2c234d52f0e9c1a2b1d29da046e6d036
push id30748
push usercbook@mozilla.com
push dateWed, 28 Sep 2016 13:53:19 +0000
treeherdermozilla-central@8c84b7618840 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1297662
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1297662 - Remove gf2_8.c & gf2_8.h as they are unused. r=jesup Move the used #define where it is actually used MozReview-Commit-ID: DSfoLN7W5ae
netwerk/srtp/src/crypto/cipher/aes.c
netwerk/srtp/src/crypto/include/aes.h
netwerk/srtp/src/crypto/include/gf2_8.h
netwerk/srtp/src/crypto/math/gf2_8.c
netwerk/srtp/src/moz.build
--- a/netwerk/srtp/src/crypto/cipher/aes.c
+++ b/netwerk/srtp/src/crypto/cipher/aes.c
@@ -41,16 +41,30 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  */
 
 
 #include "aes.h"
 #include "err.h"
+#include "datatypes.h"
+
+typedef uint8_t gf2_8;
+
+#define gf2_8_field_polynomial 0x1B
+
+/*
+ * gf2_8_shift(z) returns the result of the GF(2^8) 'multiply by x'
+ * operation, using the field representation from AES; that is, the
+ * next gf2_8 value in the cyclic representation of that field.  The
+ * value z should be an uint8_t.
+ */
+#define gf2_8_shift(z) (((z) & 128) ?                       \
+       (((z) << 1) ^ gf2_8_field_polynomial) : ((z) << 1))
 
 /* 
  * we use the tables T0, T1, T2, T3, and T4 to compute AES, and 
  * the tables U0, U1, U2, and U4 to compute its inverse
  *
  * different tables are used on little-endian (Intel, VMS) and
  * big-endian processors (everything else)
  *
--- a/netwerk/srtp/src/crypto/include/aes.h
+++ b/netwerk/srtp/src/crypto/include/aes.h
@@ -44,17 +44,16 @@
  */
 
 #ifndef _AES_H
 #define _AES_H
 
 #include "config.h"
 
 #include "datatypes.h"
-#include "gf2_8.h"
 #include "err.h"
 
 /* aes internals */
 
 typedef struct {
   v128_t round[15];
   int num_rounds;
 } aes_expanded_key_t;
deleted file mode 100644
--- a/netwerk/srtp/src/crypto/include/gf2_8.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * gf2_8.h
- *
- * GF(256) implementation
- *
- * David A. McGrew
- * Cisco Systems, Inc.
- */
-
-/*
- *	
- * Copyright (c) 2001-2006, Cisco Systems, Inc.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 
- *   Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- *   Redistributions in binary form must reproduce the above
- *   copyright notice, this list of conditions and the following
- *   disclaimer in the documentation and/or other materials provided
- *   with the distribution.
- * 
- *   Neither the name of the Cisco Systems, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-
-#ifndef GF2_8_H
-#define GF2_8_H
-
-#include "datatypes.h"  /* for uint8_t definition */
-
-typedef uint8_t gf2_8;
-
-#define gf2_8_field_polynomial 0x1B
-
-/*
- * gf2_8_shift(x) returns 
- */
-
-/*
- * gf2_8_shift(z) returns the result of the GF(2^8) 'multiply by x' 
- * operation, using the field representation from AES; that is, the 
- * next gf2_8 value in the cyclic representation of that field.  The 
- * value z should be an uint8_t.
- */
-
-#define gf2_8_shift(z) (((z) & 128) ? \
-       (((z) << 1) ^ gf2_8_field_polynomial) : ((z) << 1))
-
-gf2_8
-gf2_8_compute_inverse(gf2_8 x);
-
-void
-test_gf2_8(void);
-
-gf2_8
-gf2_8_multiply(gf2_8 x, gf2_8 y);
-
-#endif /* GF2_8_H */
deleted file mode 100644
--- a/netwerk/srtp/src/crypto/math/gf2_8.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * gf2_8.c
- *
- * GF(256) finite field implementation, with the representation used
- * in the AES cipher.
- * 
- * David A. McGrew
- * Cisco Systems, Inc.
- */
-
-/*
- *	
- * Copyright (c) 2001-2006, Cisco Systems, Inc.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 
- *   Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * 
- *   Redistributions in binary form must reproduce the above
- *   copyright notice, this list of conditions and the following
- *   disclaimer in the documentation and/or other materials provided
- *   with the distribution.
- * 
- *   Neither the name of the Cisco Systems, Inc. nor the names of its
- *   contributors may be used to endorse or promote products derived
- *   from this software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-
-#include "datatypes.h"
-#include "gf2_8.h"
-
-/* gf2_8_shift() moved to gf2_8.h as an inline function */
-
-gf2_8
-gf2_8_multiply(gf2_8 x, gf2_8 y) {
-  gf2_8 z = 0;
-
-  if (y &   1) z ^= x; x = gf2_8_shift(x);
-  if (y &   2) z ^= x; x = gf2_8_shift(x);
-  if (y &   4) z ^= x; x = gf2_8_shift(x);
-  if (y &   8) z ^= x; x = gf2_8_shift(x);
-  if (y &  16) z ^= x; x = gf2_8_shift(x);
-  if (y &  32) z ^= x; x = gf2_8_shift(x);
-  if (y &  64) z ^= x; x = gf2_8_shift(x);
-  if (y & 128) z ^= x; 
-  
-  return z;
-}
-
-
-/* this should use the euclidean algorithm */
-
-gf2_8
-gf2_8_compute_inverse(gf2_8 x) {
-  unsigned int i;
-
-  if (x == 0) return 0;    /* zero is a special case */
-  for (i=0; i < 256; i++)
-    if (gf2_8_multiply((gf2_8) i, x) == 1)
-      return (gf2_8) i;
-
-    return 0;
-}
-
--- a/netwerk/srtp/src/moz.build
+++ b/netwerk/srtp/src/moz.build
@@ -14,17 +14,16 @@ UNIFIED_SOURCES += [
     'crypto/hash/hmac.c',
     'crypto/hash/null_auth.c',
     'crypto/hash/sha1.c',
     'crypto/kernel/alloc.c',
     'crypto/kernel/crypto_kernel.c',
     'crypto/kernel/err.c',
     'crypto/kernel/key.c',
     'crypto/math/datatypes.c',
-    'crypto/math/gf2_8.c',
     'crypto/math/stat.c',
     'crypto/replay/rdb.c',
     'crypto/replay/rdbx.c',
     'crypto/replay/ut_sim.c',
     'crypto/rng/ctr_prng.c',
     'crypto/rng/prng.c',
     'crypto/rng/rand_source.c',
     'srtp/ekt.c',