Merge pull request #126 from ARMmbed/multi-op-abort-on-error

Multipart operations don't always call abort on error - FIX
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index 128c2c0..6d31322 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -67,7 +67,7 @@
  * PSA_SUCCESS. We must not define PSA_SUCCESS ourselves in that case;
  * the other error code names don't clash. Also define psa_status_t as
  * an alias for the type used by PSA IPC. This is a temporary hack
- * until we unify error reporting in PSA IPC and PSA crypo.
+ * until we unify error reporting in PSA IPC and PSA crypto.
  *
  * Note that psa_defs.h must be included before this header!
  */
@@ -1911,9 +1911,9 @@
  * -# Call psa_cipher_encrypt_setup() to specify the algorithm and key.
  *    The key remains associated with the operation even if the content
  *    of the key slot changes.
- * -# Call either psa_encrypt_generate_iv() or psa_cipher_set_iv() to
+ * -# Call either psa_cipher_generate_iv() or psa_cipher_set_iv() to
  *    generate or set the IV (initialization vector). You should use
- *    psa_encrypt_generate_iv() unless the protocol you are implementing
+ *    psa_cipher_generate_iv() unless the protocol you are implementing
  *    requires a specific IV value.
  * -# Call psa_cipher_update() zero, one or more times, passing a fragment
  *    of the message each time.
@@ -1925,7 +1925,7 @@
  * After a successful call to psa_cipher_encrypt_setup(), the application must
  * eventually terminate the operation. The following events terminate an
  * operation:
- * - A failed call to psa_encrypt_generate_iv(), psa_cipher_set_iv()
+ * - A failed call to psa_cipher_generate_iv(), psa_cipher_set_iv()
  *   or psa_cipher_update().
  * - A call to psa_cipher_finish() or psa_cipher_abort().
  *
diff --git a/scripts/generate_psa_constants.py b/scripts/generate_psa_constants.py
index e4cb45b..5a5d2e5 100755
--- a/scripts/generate_psa_constants.py
+++ b/scripts/generate_psa_constants.py
@@ -71,8 +71,8 @@
     psa_algorithm_t padding_mode = -1;
     psa_algorithm_t alg_without_padding = alg;
     if (PSA_ALG_IS_CIPHER(alg) && PSA_ALG_IS_BLOCK_CIPHER(alg)) {
-            padding_mode = alg & PSA_ALG_BLOCK_CIPHER_PADDING_MASK;
-            alg_without_padding = alg & ~PSA_ALG_BLOCK_CIPHER_PADDING_MASK;
+        padding_mode = alg & PSA_ALG_BLOCK_CIPHER_PADDING_MASK;
+        alg_without_padding = alg & ~PSA_ALG_BLOCK_CIPHER_PADDING_MASK;
     }
     switch (alg_without_padding) {
     %(algorithm_cases)s
@@ -120,16 +120,16 @@
 '''
 
 key_type_from_curve_template = '''if (%(tester)s(type)) {
-        append_with_curve(&buffer, buffer_size, &required_size,
-                          "%(builder)s", %(builder_length)s,
-                          PSA_KEY_TYPE_GET_CURVE(type));
-    } else '''
+            append_with_curve(&buffer, buffer_size, &required_size,
+                              "%(builder)s", %(builder_length)s,
+                              PSA_KEY_TYPE_GET_CURVE(type));
+        } else '''
 
 algorithm_from_hash_template = '''if (%(tester)s(alg_without_padding)) {
-        append_with_hash(&buffer, buffer_size, &required_size,
-                         "%(builder)s", %(builder_length)s,
-                         PSA_ALG_GET_HASH(alg_without_padding));
-    } else '''
+            append_with_hash(&buffer, buffer_size, &required_size,
+                             "%(builder)s", %(builder_length)s,
+                             PSA_ALG_GET_HASH(alg_without_padding));
+        } else '''
 
 bit_test_template = '''\
     if (%(var)s & %(flag)s) {
@@ -244,7 +244,7 @@
     def make_key_type_code(self):
         d = self.key_types_from_curve
         make = self.make_key_type_from_curve_code
-        return '\n        '.join([make(k, d[k]) for k in sorted(d.keys())])
+        return ''.join([make(k, d[k]) for k in sorted(d.keys())])
 
     def make_hash_algorithm_cases(self):
         return '\n    '.join(map(self.make_return_case,
@@ -266,7 +266,7 @@
     def make_algorithm_code(self):
         d = self.algorithms_from_hash
         make = self.make_algorithm_from_hash_code
-        return '\n        '.join([make(k, d[k]) for k in sorted(d.keys())])
+        return ''.join([make(k, d[k]) for k in sorted(d.keys())])
 
     def make_key_usage_code(self):
         return '\n'.join([self.make_bit_test('usage', bit)