@@ -47,13 +47,68 @@ typedef struct
4747 u32 lower_length ;
4848} sha_context ;
4949
50+ /*!
51+ * \fn s32 SHA_Init(void)
52+ * \brief Initializes the SHA1 subsystem. This call could be done in the early stages of your main()
53+ *
54+ * \return 0 or higher on success, otherwise the returned error code
55+ */
5056s32 SHA_Init (void );
57+
58+ /*!
59+ * \fn s32 SHA_Close(void)
60+ * \brief Closes the SHA1 subsystem handlers. This call could be done when exiting your application or before reloading IOS
61+ *
62+ * \return 0 or higher on success, otherwise the returned error code
63+ */
5164s32 SHA_Close (void );
65+
66+ /*!
67+ * \fn s32 SHA_Calculate(const void* data, const u32 data_size, void* message_digest)
68+ * \brief Calculates the SHA1 hash of the given data, and puts it in message_digest
69+ *
70+ * \param[in] data pointer to the data to hash. if it is not 64-byte aligned an internal buffer will be used
71+ * \param[in] data_size size of the data to hash
72+ * \param[out] message_digest pointer to where to write the hash to
73+ *
74+ * \return 0 or higher on success, otherwise the returned error code
75+ */
5276s32 SHA_Calculate (const void * data , const u32 data_size , void * message_digest );
5377
54- s32 SHA_InitializeContext (sha_context * context );
55- s32 SHA_Input (sha_context * context , const void * data , const u32 data_size );
56- s32 SHA_Finalize (sha_context * context , const void * data , const u32 data_size , void * message_digest );
78+ /*!
79+ * \fn s32 SHA_InitializeContext(sha_context* context)
80+ * \brief Initializes the given sha context
81+ *
82+ * \param[in] context pointer to the sha_context to initialize
83+ *
84+ * \return 0 or higher on success, otherwise the returned error code
85+ */
86+ s32 SHA_InitializeContext (const sha_context * context );
87+
88+ /*!
89+ * \fn s32 SHA_Input(const sha_context* context, const void* data, const u32 data_size)
90+ * \brief Adds data to the given sha_context and hashes it
91+ *
92+ * \param[in] context pointer to the sha_context to use
93+ * \param[in] data pointer to the data to hash. if it is not 64-byte aligned an internal buffer will be used
94+ * \param[in] data_size size of the data to hash
95+ *
96+ * \return 0 or higher on success, otherwise the returned error code
97+ */
98+ s32 SHA_Input (const sha_context * context , const void * data , const u32 data_size );
99+
100+ /*!
101+ * \fn s32 SHA_Finalize(const sha_context* context, const void* data, const u32 data_size, void* message_digest)
102+ * \brief Calculates the final SHA1 hash of the given context and last data, and puts it in message_digest
103+ *
104+ * \param[in] context pointer to the sha_context to use
105+ * \param[in] data pointer to the data to hash. if it is not 64-byte aligned an internal buffer will be used
106+ * \param[in] data_size size of the data to hash
107+ * \param[out] message_digest pointer to where to write the final SHA1 hash to
108+ *
109+ * \return 0 or higher on success, otherwise the returned error code
110+ */
111+ s32 SHA_Finalize (const sha_context * context , const void * data , const u32 data_size , void * message_digest );
57112
58113#ifdef __cplusplus
59114 }
0 commit comments