From bceaae302ec202e9137d5017193b6f7507deb683 Mon Sep 17 00:00:00 2001
From: Erhan Nergiz <anergiz@google.com>
Date: Fri, 19 May 2017 16:03:55 -0700
Subject: [PATCH] Fixes lint errors in Ed25519 and Ed25519Constants.

Change-Id: I6ff8c4c641b604f9dc459f3edc971427dfcb3cc9
ORIGINAL_AUTHOR=Erhan Nergiz <anergiz@google.com>
GitOrigin-RevId: 305bd7801a418f33101079c7a9f93f2be292f8c9
---
 README.md                                          | 14 +++++++-------
 .../com/google/cloud/crypto/tink/PrimitiveSet.java |  2 +-
 .../google/cloud/crypto/tink/subtle/Ed25519.java   |  3 ++-
 .../cloud/crypto/tink/subtle/Ed25519Constants.java |  2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md
index dfb3aefc0..3dc188bac 100644
--- a/README.md
+++ b/README.md
@@ -22,9 +22,9 @@ two operations:
    ciphertext
  * `decrypt(ciphertext, associated_data)`, which decrypts the given `ciphertext`
    (using `associated_data` as additional AEAD-input) and returns the resulting
-   plaintext
+   ciphertext
 
-Currently Tink already provides primitives for several common cryptographic
+Currently Tink already provides primitives for several common crryptographic
 operations (like symmetric encryption, message authentication codes, digital
 signatures, hybrid encryption), and additional primitives are in preparation.
 Moreover, adding new primitives or adding custom implementations of existing
@@ -34,7 +34,7 @@ The basic use of Tink proceeds in three steps:
 
 1. Load or generate the cryptographic key material.
 2. Use the key material to get an instance of a primitive.
-3. Use the primitive to accomplish the cryptographic task.
+3. Use the primitive to acomplish the cryptographic task.
 
 To be more concrete, here is how these steps would look like to perform
 symmetric encryption (AEAD) in a Java program:
@@ -83,7 +83,7 @@ primitive:
 
 Before a specific implementation of a primitive can be used the Tink library
 must be the initialized so that it "knows" the desired implementations. This
-initialization happens via _registration_ of the implementations.  For
+intialization happens via _registration_ of the implementations.  For
 example if one would like to use the standard implementations of AEAD and MAC
 primitives offered by Tink, the initialization would look as follows:
 
@@ -101,7 +101,7 @@ Now that you already know how to use Tink (it is really that simple!), you can
 proceed with using it in your code.  Alternatively, you can continue reading the
 sections below to get more information about the library: its features,
 security, structure, extensibility, and more.  To get direct instructions on how
-to accomplish certain tasks with Tink
+to acomplish certain tasks with Tink
 see [Java HOW-TO](https://github.com/google/tink/blob/master/doc/JAVA-HOWTO.md).
 
 ## Tink overview
@@ -131,7 +131,7 @@ data and DEK, use the KMS to decrypt DEK, and use decrypted DEK to decrypt the
 data.
 
 **Key Management** In addition to cryptographic operations Tink provides also
-support for key management features like key versioning, key rotation, storing
+support for key management featuers like key versioning, key rotation, storing
 and loading keys from key management systems, and more. For example, if a
 cryptographic scheme is found broken, one can switch to a new implementation of
 the primitive by rotating the key without changing or recompiling code.
@@ -212,7 +212,7 @@ type.
 To take advantage of key rotation and other key management features, a Tink user
 works usually not with single keys, but with **keysets**, which are just sets of
 keys with some additional parameters and metadata.  In particular, this extra
-information in the keyset determines which key is _primary_ (i.e. will be used to
+information in the keyset dermines which key is _primary_ (i.e. will be used to
 create new cryptographic data like ciphertexts, or signatures), which keys are
 _enabled_ (i.e. can be used to process existing cryptographic data, like decrypt
 ciphertext or verify signatures), and which keys should not be used any more.
diff --git a/java/src/main/java/com/google/cloud/crypto/tink/PrimitiveSet.java b/java/src/main/java/com/google/cloud/crypto/tink/PrimitiveSet.java
index 247da61c2..5cd93b79a 100644
--- a/java/src/main/java/com/google/cloud/crypto/tink/PrimitiveSet.java
+++ b/java/src/main/java/com/google/cloud/crypto/tink/PrimitiveSet.java
@@ -35,7 +35,7 @@ import java.util.concurrent.ConcurrentMap;
  * PrimitiveSet is an auxiliary class used for supporting key rotation: primitives in a set
  * correspond to keys in a keyset.  Users will usually work with primitive instances,
  * which essentially wrap primitive sets.  For example an instance of an Aead-primitive
- * for a given keyset holds a set of Aead-primitives corresponding to the keys in the keyset,
+ * for a given keyset holds a set of Aead-primitivies corresponding to the keys in the keyset,
  * and uses the set members to do the actual crypto operations: to encrypt data the primary
  * Aead-primitive from the set is used, and upon decryption the ciphertext's prefix
  * determines the id of the primitive from the set. <p>
diff --git a/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519.java b/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519.java
index 6b9b1154f..a2d649abc 100644
--- a/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519.java
+++ b/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519.java
@@ -538,6 +538,7 @@ public final class Ed25519 {
    * Preconditions:
    * a[31] <= 127
    */
+  @SuppressWarnings("NarrowingCompoundAssignment")
   private static XYZ scalarMult(byte[] a) {
     byte[] e = new byte[2 * FIELD_LEN];
     for (int i = 0; i < FIELD_LEN; i++) {
@@ -601,8 +602,8 @@ public final class Ed25519 {
     return scalarMult(a).toBytes();
   }
 
+  @SuppressWarnings("NarrowingCompoundAssignment")
   private static byte[] slide(byte[] a) {
-
     byte[] r = new byte[256];
     // Writes each bit in a[0..31] into r[0..255]:
     // a = a[0]+256*a[1]+...+256^31*a[31] is equal to
diff --git a/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519Constants.java b/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519Constants.java
index d347f307b..4284f3eb6 100644
--- a/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519Constants.java
+++ b/java/src/main/java/com/google/cloud/crypto/tink/subtle/Ed25519Constants.java
@@ -16,7 +16,7 @@
 
 package com.google.cloud.crypto.tink.subtle;
 
-import static com.google.cloud.crypto.tink.subtle.Ed25519.CachedXYT;
+import com.google.cloud.crypto.tink.subtle.Ed25519.CachedXYT;
 
 /**
  * Constants used in {@link Ed25519}.
-- 
GitLab