Fixed spelling / typos (from PowerDNS:codespell)
diff --git a/ChangeLog b/ChangeLog
index 2a2130c..7c0471b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -650,7 +650,7 @@
      in a function to allow easy future expansion
    * Changed symmetric cipher functions to
      identical interface (returning int result values)
-   * Changed ARC4 to use seperate input/output buffer
+   * Changed ARC4 to use separate input/output buffer
    * Added reset function for HMAC context as speed-up
      for specific use-cases
 
@@ -890,7 +890,7 @@
     * Multiple fixes to enhance the compatibility with g++,
       thanks to Xosé Antón Otero Ferreira
     * Fixed a bug in the CBC code, thanks to dowst; also,
-      the bignum code is no longer dependant on long long
+      the bignum code is no longer dependent on long long
     * Updated rsa_pkcs1_sign to handle arbitrary large inputs
     * Updated timing.c for improved compatibility with i386
       and 486 processors, thanks to Arnaud Cornet
diff --git a/doxygen/input/doc_ssltls.h b/doxygen/input/doc_ssltls.h
index 150c106..13b56a2 100644
--- a/doxygen/input/doc_ssltls.h
+++ b/doxygen/input/doc_ssltls.h
@@ -13,7 +13,7 @@
  * - initialise an SSL/TLS context (see \c ssl_init()).
  * - perform an SSL/TLS handshake (see \c ssl_handshake()).
  * - read/write (see \c ssl_read() and \c ssl_write()).
- * - notify a peer that conection is being closed (see \c ssl_close_notify()).
+ * - notify a peer that connection is being closed (see \c ssl_close_notify()).
  *
  * Many aspects of such a channel are set through parameters and callback
  * functions:
diff --git a/include/polarssl/bignum.h b/include/polarssl/bignum.h
index eae15e0..c4680a7 100644
--- a/include/polarssl/bignum.h
+++ b/include/polarssl/bignum.h
@@ -436,7 +436,7 @@
 int mpi_add_abs( mpi *X, const mpi *A, const mpi *B );
 
 /**
- * \brief          Unsigned substraction: X = |A| - |B|
+ * \brief          Unsigned subtraction: X = |A| - |B|
  *
  * \param X        Destination MPI
  * \param A        Left-hand MPI
@@ -460,7 +460,7 @@
 int mpi_add_mpi( mpi *X, const mpi *A, const mpi *B );
 
 /**
- * \brief          Signed substraction: X = A - B
+ * \brief          Signed subtraction: X = A - B
  *
  * \param X        Destination MPI
  * \param A        Left-hand MPI
@@ -484,7 +484,7 @@
 int mpi_add_int( mpi *X, const mpi *A, t_sint b );
 
 /**
- * \brief          Signed substraction: X = A - b
+ * \brief          Signed subtraction: X = A - b
  *
  * \param X        Destination MPI
  * \param A        Left-hand MPI
diff --git a/include/polarssl/ssl.h b/include/polarssl/ssl.h
index 01cc455..e75f9d7 100644
--- a/include/polarssl/ssl.h
+++ b/include/polarssl/ssl.h
@@ -1425,7 +1425,7 @@
  *
  * \param ssl      SSL context
  *
- * \return         0 if succesful, or any ssl_handshake() return value.
+ * \return         0 if successful, or any ssl_handshake() return value.
  */
 int ssl_renegotiate( ssl_context *ssl );
 
diff --git a/library/bignum.c b/library/bignum.c
index f94d08d..e2da5a8 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -788,7 +788,7 @@
 }
 
 /*
- * Helper for mpi substraction
+ * Helper for mpi subtraction
  */
 static void mpi_sub_hlp( size_t n, t_uint *s, t_uint *d )
 {
@@ -809,7 +809,7 @@
 }
 
 /*
- * Unsigned substraction: X = |A| - |B|  (HAC 14.9)
+ * Unsigned subtraction: X = |A| - |B|  (HAC 14.9)
  */
 int mpi_sub_abs( mpi *X, const mpi *A, const mpi *B )
 {
@@ -832,7 +832,7 @@
         MPI_CHK( mpi_copy( X, A ) );
 
     /*
-     * X should always be positive as a result of unsigned substractions.
+     * X should always be positive as a result of unsigned subtractions.
      */
     X->s = 1;
 
@@ -883,7 +883,7 @@
 }
 
 /*
- * Signed substraction: X = A - B
+ * Signed subtraction: X = A - B
  */
 int mpi_sub_mpi( mpi *X, const mpi *A, const mpi *B )
 {
@@ -930,7 +930,7 @@
 }
 
 /*
- * Signed substraction: X = A - b
+ * Signed subtraction: X = A - b
  */
 int mpi_sub_int( mpi *X, const mpi *A, t_sint b )
 {
diff --git a/library/net.c b/library/net.c
index 8eeabb9..2ab12df 100644
--- a/library/net.c
+++ b/library/net.c
@@ -93,7 +93,7 @@
 /*
  * htons() is not always available.
  * By default go for LITTLE_ENDIAN variant. Otherwise hope for _BYTE_ORDER and __BIG_ENDIAN
- * to help determine endianess.
+ * to help determine endianness.
  */
 #if defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN
 #define POLARSSL_HTONS(n) (n)
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 0a22b87..9eba14d 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1184,7 +1184,7 @@
 }
 
 /*
- * Check that the given certificate is valid accoring to the CRL.
+ * Check that the given certificate is valid according to the CRL.
  */
 static int x509_crt_verifycrl( x509_crt *crt, x509_crt *ca,
                                x509_crl *crl_list)
diff --git a/programs/aes/aescrypt2.c b/programs/aes/aescrypt2.c
index 1cedcc7..4c1f8ea 100644
--- a/programs/aes/aescrypt2.c
+++ b/programs/aes/aescrypt2.c
@@ -320,7 +320,7 @@
         }
 
         /*
-         * Substract the IV + HMAC length.
+         * Subtract the IV + HMAC length.
          */
         filesize -= ( 16 + 32 );
 
diff --git a/programs/aes/crypt_and_hash.c b/programs/aes/crypt_and_hash.c
index 5aa0bfe..d2845de 100644
--- a/programs/aes/crypt_and_hash.c
+++ b/programs/aes/crypt_and_hash.c
@@ -390,7 +390,7 @@
         }
 
         /*
-         * Substract the IV + HMAC length.
+         * Subtract the IV + HMAC length.
          */
         filesize -= ( 16 + md_get_size( md_info ) );
 
diff --git a/tests/suites/test_suite_mpi.data b/tests/suites/test_suite_mpi.data
index dfc6b16..924f364 100644
--- a/tests/suites/test_suite_mpi.data
+++ b/tests/suites/test_suite_mpi.data
@@ -277,7 +277,7 @@
 Base test mpi_sub_mpi #3 (Test with negative base)
 mpi_sub_mpi:10:"-5":10:"7":10:"-12"
 
-Base test mpi_sub_mpi #4 (Test with negative substraction)
+Base test mpi_sub_mpi #4 (Test with negative subtraction)
 mpi_sub_mpi:10:"5":10:"-7":10:"12"
 
 Test mpi_sub_mpi #1