PSA PAKE: add input size macros

The caller is likely to receive the inputs on the wire, and having a
known size for which they can confidently reject longer inputs would be
helpful in cases where the application can't just use the input in
place.

Signed-off-by: Janos Follath <janos.follath@arm.com>
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index bbdd06d..e84c757 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -4626,6 +4626,8 @@
  * \retval #PSA_ERROR_HARDWARE_FAILURE
  * \retval #PSA_ERROR_CORRUPTION_DETECTED
  * \retval #PSA_ERROR_STORAGE_FAILURE
+ * \retval #PSA_ERROR_INVALID_ARGUMENT
+ *         The input is not valid for the algorithm, ciphersuite or \p step.
  * \retval #PSA_ERROR_BAD_STATE
  *         The library has not been previously initialized by psa_crypto_init().
  *         It is implementation-dependent whether a failure to initialize
diff --git a/include/psa/crypto_sizes.h b/include/psa/crypto_sizes.h
index a1b8944..62254fa 100644
--- a/include/psa/crypto_sizes.h
+++ b/include/psa/crypto_sizes.h
@@ -1134,10 +1134,9 @@
 
 /** A sufficient output buffer size for psa_pake_output().
  *
- * If the size of the ciphertext buffer is at least this large, it is
- * guaranteed that psa_pake_output() will not fail due to an
- * insufficient ciphertext buffer size. The actual size of the output might be
- * smaller in any given call.
+ * If the size of the output buffer is at least this large, it is guaranteed
+ * that psa_pake_output() will not fail due to an insufficient output buffer
+ * size. The actual size of the output might be smaller in any given call.
  *
  * See also #PSA_PAKE_OUTPUT_MAX_SIZE
  *
@@ -1154,6 +1153,26 @@
  */
 #define PSA_PAKE_OUTPUT_SIZE(alg, primitive, output_step) 0
 
+/** A sufficient input buffer size for psa_pake_input().
+ *
+ * If the size of the input is larger than this, it is guaranteed
+ * that psa_pake_input() will fail with #PSA_ERROR_INVALID_ARGUMENT.
+ *
+ * See also #PSA_PAKE_INPUT_MAX_SIZE
+ *
+ * \param alg           A PAKE algorithm (PSA_ALG_XXX value such that
+ *                      #PSA_ALG_IS_PAKE(\p alg) is true).
+ * \param primitive     A primitive of type ::psa_pake_primitive_t that is
+ *                      compatible with algorithm \p alg.
+ * \param output_step   A value of type ::psa_pake_step_t that is valid for the
+ *                      algorithm \p alg.
+ * \return              A sufficient output buffer size for the specified
+ *                      output, cipher suite and algorithm. If the cipher suite,
+ *                      the output type or PAKE algorithm is not recognized, or
+ *                      the parameters are incompatible, return 0.
+ */
+#define PSA_PAKE_INPUT_SIZE(alg, primitive, input_step) 0
+
 /** Output buffer size for psa_pake_output() for any of the supported cipher
  * suites and PAKE algorithms.
  *
@@ -1163,4 +1182,13 @@
  */
 #define PSA_PAKE_OUTPUT_MAX_SIZE 0
 
+/** Input buffer size for psa_pake_input() for any of the supported cipher
+ * suites and PAKE algorithms.
+ *
+ * This macro must expand to a compile-time constant integer.
+ *
+ * See also #PSA_PAKE_INPUT_SIZE(\p alg, \p cipher_suite, \p output).
+ */
+#define PSA_PAKE_INPUT_MAX_SIZE 0
+
 #endif /* PSA_CRYPTO_SIZES_H */