@@ -55,7 +55,7 @@ enum asn1_tags {
5555 * \param[in] curve_bits Curve bits.
5656 * \param[out] sicurve Pointer to curve struct for Cracen.
5757 *
58- * \return PSA_SUCCESS on success or a valid PSA error code.
58+ * \return PSA_SUCCESS on success or a valid PSA status code.
5959 */
6060psa_status_t cracen_ecc_get_ecurve_from_psa (psa_ecc_family_t curve_family , size_t curve_bits ,
6161 const struct sx_pk_ecurve * * sicurve );
@@ -98,7 +98,7 @@ static inline size_t cracen_ecc_wstr_expected_pub_key_bytes(size_t priv_key_size
9898 * \param[in] in_pnt The public key to check.
9999 *
100100 * \return PSA_SUCCESS if the public key passed the check, a valid
101- * PSA error code otherwise.
101+ * PSA status code otherwise.
102102 *
103103 */
104104psa_status_t cracen_ecc_check_public_key (const struct sx_pk_ecurve * curve ,
@@ -115,7 +115,7 @@ psa_status_t cracen_ecc_check_public_key(const struct sx_pk_ecurve *curve,
115115 * \param[out] modulus Modulus (n) operand of n.
116116 * \param[out] exponent Public or private exponent, depending on \ref extract_pubkey.
117117 *
118- * \return sicrypto statuscode .
118+ * \return sxsymcrypt status code .
119119 */
120120int cracen_signature_get_rsa_key (struct si_rsa_key * rsa , bool extract_pubkey , bool is_key_pair ,
121121 const unsigned char * key , size_t keylen , struct sx_buf * modulus ,
@@ -146,7 +146,7 @@ int cracen_signature_asn1_get_operand(unsigned char **p, const unsigned char *en
146146 *
147147 * @note Output number and upper limit must be big endian numbers of size @ref sz.
148148 *
149- * @return psa_status_t
149+ * @return PSA status code.
150150 */
151151psa_status_t rnd_in_range (uint8_t * n , size_t sz , const uint8_t * upperlimit , size_t retrylimit );
152152
@@ -162,17 +162,26 @@ void cracen_xorbytes(char *a, const char *b, size_t sz);
162162/**
163163 * @brief Loads key buffer and attributes.
164164 *
165- * @return psa_status_t
165+ * @return PSA status code.
166166 */
167167psa_status_t cracen_load_keyref (const psa_key_attributes_t * attributes , const uint8_t * key_buffer ,
168168 size_t key_buffer_size , struct sxkeyref * k );
169169
170+ /**
171+ * @brief Do ECB operation.
172+ *
173+ * @return PSA status code.
174+ */
175+ psa_status_t cracen_cipher_crypt_ecb (const struct sxkeyref * key , const uint8_t * input ,
176+ size_t input_length , uint8_t * output , size_t output_size ,
177+ size_t * output_length , enum cipher_operation dir );
178+
170179/**
171180 * @brief Prepare ik key.
172181 *
173182 * @param user_data Owner ID.
174183 *
175- * @return sxsymcrypt error code.
184+ * @return sxsymcrypt status code.
176185 */
177186int cracen_prepare_ik_key (const uint8_t * user_data );
178187
@@ -187,7 +196,7 @@ int cracen_prepare_ik_key(const uint8_t *user_data);
187196 * @param summand Summand.
188197 *
189198 */
190- void be_add ( unsigned char * v , size_t v_size , size_t summand );
199+ void cracen_be_add ( uint8_t * v , size_t v_size , size_t summand );
191200
192201/**
193202 * @brief Big-Endian compare with carry.
@@ -202,51 +211,51 @@ void be_add(unsigned char *v, size_t v_size, size_t summand);
202211 * \retval 1 if a > b.
203212 * \retval -1 if a < b.
204213 */
205- int be_cmp (const unsigned char * a , const unsigned char * b , size_t sz , int carry );
214+ int cracen_be_cmp (const uint8_t * a , const uint8_t * b , size_t sz , int carry );
206215
207216/**
208217 * @brief Hash several elements at different locations in memory
209218 *
210219 * @param inputs[in] Array of pointers to elements that will be hashed.
211- * @param inputs_lengths [in] Array of lengths of elements to be hashed.
220+ * @param input_lengths [in] Array of lengths of elements to be hashed.
212221 * @param input_count[in] Number of elements to be hashed.
213222 * @param hashalg[in] Hash algorithm to be used in sxhashalg format.
214223 * @param digest[out] Buffer of at least sx_hash_get_alg_digestsz(hashalg) bytes.
215224 *
216225 * @return sxsymcrypt status code.
217226 */
218- int hash_all_inputs (const char * inputs [], const size_t inputs_lengths [], size_t input_count ,
219- const struct sxhashalg * hashalg , char * digest );
227+ int cracen_hash_all_inputs (const uint8_t * inputs [], const size_t input_lengths [] ,
228+ size_t input_count , const struct sxhashalg * hashalg , uint8_t * digest );
220229
221230/**
222231 * @brief Hash several elements at different locations in memory with a previously created hash
223232 * context(sxhash)
224233 *
225234 * @param sxhashopctx[in] Pointer to the sxhash context.
226235 * @param inputs[in] Array of pointers to elements that will be hashed.
227- * @param inputs_lengths [in] Array of lengths of elements to be hashed.
236+ * @param input_lengths [in] Array of lengths of elements to be hashed.
228237 * @param input_count[in] Number of elements to be hashed.
229238 * @param hashalg[in] Hash algorithm to be used in sxhashalg format.
230239 * @param digest[out] Buffer of at least sx_hash_get_alg_digestsz(hashalg) bytes.
231240 *
232241 * @return sxsymcrypt status code.
233242 */
234- int hash_all_inputs_with_context (struct sxhash * sxhashopctx , const char * inputs [],
235- const size_t inputs_lengths [], size_t input_count ,
236- const struct sxhashalg * hashalg , char * digest );
243+ int cracen_hash_all_inputs_with_context (struct sxhash * sxhashopctx , const uint8_t * inputs [],
244+ const size_t input_lengths [], size_t input_count ,
245+ const struct sxhashalg * hashalg , uint8_t * digest );
237246
238247/**
239248 * @brief Hash a single element
240249 *
241- * @param inputs [in] Pointer to the element that will be hashed.
250+ * @param input [in] Pointer to the element that will be hashed.
242251 * @param input_length[in] Length of the element to be hashed.
243252 * @param hashalg[in] Hash algorithm to be used in sxhashalg format.
244253 * @param digest[out] Buffer of at least sx_hash_get_alg_digestsz(hashalg) bytes.
245254 *
246255 * @return sxsymcrypt status code.
247256 */
248- int hash_input (const char * input , const size_t input_length , const struct sxhashalg * hashalg ,
249- char * digest );
257+ int cracen_hash_input (const uint8_t * input , const size_t input_length ,
258+ const struct sxhashalg * hashalg , uint8_t * digest );
250259
251260/**
252261 * @brief Hash a single element with a previously created hash context(sxhash)
@@ -259,8 +268,9 @@ int hash_input(const char *input, const size_t input_length, const struct sxhash
259268 *
260269 * @return sxsymcrypt status code.
261270 */
262- int hash_input_with_context (struct sxhash * hashopctx , const char * input , const size_t input_length ,
263- const struct sxhashalg * hashalg , char * digest );
271+ int cracen_hash_input_with_context (struct sxhash * hashopctx , const uint8_t * input ,
272+ const size_t input_length , const struct sxhashalg * hashalg ,
273+ uint8_t * digest );
264274
265275/**
266276 * @brief Generate a random number within the specified range.
@@ -275,6 +285,6 @@ int hash_input_with_context(struct sxhash *hashopctx, const char *input, const s
275285 * @param out[out] Buffer to store the generated random number.
276286 * The size of `out` should be at least `nsz`.
277287 *
278- * @return sxsymcrypt status code:
288+ * @return sxsymcrypt status code.
279289 */
280- int rndinrange_create (const unsigned char * n , size_t nsz , unsigned char * out );
290+ int cracen_get_rnd_in_range (const uint8_t * n , size_t nsz , uint8_t * out );
0 commit comments