Skip to content

Commit be9d9f0

Browse files
Re-organize some PAKE struct and type definitions further
Define the structure then the associated type. Signed-off-by: Ronald Cron <[email protected]>
1 parent e8be635 commit be9d9f0

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

include/psa/crypto_extra.h

+36-36
Original file line numberDiff line numberDiff line change
@@ -869,42 +869,6 @@ static psa_algorithm_t psa_pake_cs_get_hash(
869869
static void psa_pake_cs_set_hash(psa_pake_cipher_suite_t *cipher_suite,
870870
psa_algorithm_t hash);
871871

872-
/** The type of the state data structure for PAKE operations.
873-
*
874-
* Before calling any function on a PAKE operation object, the application
875-
* must initialize it by any of the following means:
876-
* - Set the structure to all-bits-zero, for example:
877-
* \code
878-
* psa_pake_operation_t operation;
879-
* memset(&operation, 0, sizeof(operation));
880-
* \endcode
881-
* - Initialize the structure to logical zero values, for example:
882-
* \code
883-
* psa_pake_operation_t operation = {0};
884-
* \endcode
885-
* - Initialize the structure to the initializer #PSA_PAKE_OPERATION_INIT,
886-
* for example:
887-
* \code
888-
* psa_pake_operation_t operation = PSA_PAKE_OPERATION_INIT;
889-
* \endcode
890-
* - Assign the result of the function psa_pake_operation_init()
891-
* to the structure, for example:
892-
* \code
893-
* psa_pake_operation_t operation;
894-
* operation = psa_pake_operation_init();
895-
* \endcode
896-
*
897-
* This is an implementation-defined \c struct. Applications should not
898-
* make any assumptions about the content of this structure.
899-
* Implementation details can change in future versions without notice. */
900-
typedef struct psa_pake_operation_s psa_pake_operation_t;
901-
902-
/** The type of input values for PAKE operations. */
903-
typedef struct psa_crypto_driver_pake_inputs_s psa_crypto_driver_pake_inputs_t;
904-
905-
/** The type of computation stage for J-PAKE operations. */
906-
typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t;
907-
908872
struct psa_crypto_driver_pake_inputs_s {
909873
uint8_t *MBEDTLS_PRIVATE(password);
910874
size_t MBEDTLS_PRIVATE(password_len);
@@ -916,6 +880,9 @@ struct psa_crypto_driver_pake_inputs_s {
916880
psa_pake_cipher_suite_t MBEDTLS_PRIVATE(cipher_suite);
917881
};
918882

883+
/** The type of input values for PAKE operations. */
884+
typedef struct psa_crypto_driver_pake_inputs_s psa_crypto_driver_pake_inputs_t;
885+
919886
typedef enum psa_jpake_round {
920887
PSA_JPAKE_FIRST = 0,
921888
PSA_JPAKE_SECOND = 1,
@@ -940,6 +907,9 @@ struct psa_jpake_computation_stage_s {
940907
psa_pake_step_t MBEDTLS_PRIVATE(step);
941908
};
942909

910+
/** The type of computation stage for J-PAKE operations. */
911+
typedef struct psa_jpake_computation_stage_s psa_jpake_computation_stage_t;
912+
943913
#define PSA_JPAKE_EXPECTED_INPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
944914
((round) == PSA_JPAKE_FIRST ? 2 : 1))
945915
#define PSA_JPAKE_EXPECTED_OUTPUTS(round) ((round) == PSA_JPAKE_FINISHED ? 0 : \
@@ -977,6 +947,36 @@ struct psa_pake_operation_s {
977947
#endif
978948
};
979949

950+
/** The type of the state data structure for PAKE operations.
951+
*
952+
* Before calling any function on a PAKE operation object, the application
953+
* must initialize it by any of the following means:
954+
* - Set the structure to all-bits-zero, for example:
955+
* \code
956+
* psa_pake_operation_t operation;
957+
* memset(&operation, 0, sizeof(operation));
958+
* \endcode
959+
* - Initialize the structure to logical zero values, for example:
960+
* \code
961+
* psa_pake_operation_t operation = {0};
962+
* \endcode
963+
* - Initialize the structure to the initializer #PSA_PAKE_OPERATION_INIT,
964+
* for example:
965+
* \code
966+
* psa_pake_operation_t operation = PSA_PAKE_OPERATION_INIT;
967+
* \endcode
968+
* - Assign the result of the function psa_pake_operation_init()
969+
* to the structure, for example:
970+
* \code
971+
* psa_pake_operation_t operation;
972+
* operation = psa_pake_operation_init();
973+
* \endcode
974+
*
975+
* This is an implementation-defined \c struct. Applications should not
976+
* make any assumptions about the content of this structure.
977+
* Implementation details can change in future versions without notice. */
978+
typedef struct psa_pake_operation_s psa_pake_operation_t;
979+
980980
/** Return an initial value for a PAKE operation object.
981981
*/
982982
static psa_pake_operation_t psa_pake_operation_init(void);

0 commit comments

Comments
 (0)