Lines Matching refs:operation

157 static psa_status_t cmac_setup(mbedtls_psa_mac_operation_t *operation,
184 ret = mbedtls_cipher_setup(&operation->ctx.cmac, cipher_info);
189 ret = mbedtls_cipher_cmac_starts(&operation->ctx.cmac,
200 /* Initialize this driver's MAC operation structure. Once this function has been
203 mbedtls_psa_mac_operation_t *operation,
208 operation->alg = alg;
211 if (PSA_ALG_FULL_LENGTH_MAC(operation->alg) == PSA_ALG_CMAC) {
212 mbedtls_cipher_init(&operation->ctx.cmac);
217 if (PSA_ALG_IS_HMAC(operation->alg)) {
218 /* We'll set up the hash operation later in psa_hmac_setup_internal. */
219 operation->ctx.hmac.alg = 0;
224 (void) operation;
229 memset(operation, 0, sizeof(*operation));
234 psa_status_t mbedtls_psa_mac_abort(mbedtls_psa_mac_operation_t *operation)
236 if (operation->alg == 0) {
243 if (PSA_ALG_FULL_LENGTH_MAC(operation->alg) == PSA_ALG_CMAC) {
244 mbedtls_cipher_free(&operation->ctx.cmac);
248 if (PSA_ALG_IS_HMAC(operation->alg)) {
249 psa_hmac_abort_internal(&operation->ctx.hmac);
253 /* Sanity check (shouldn't happen: operation->alg should
258 operation->alg = 0;
267 memset(operation, 0, sizeof(*operation));
271 static psa_status_t psa_mac_setup(mbedtls_psa_mac_operation_t *operation,
280 if (operation->alg != 0) {
284 status = mac_init(operation, alg);
294 status = cmac_setup(operation, attributes, key_buffer);
299 status = psa_hmac_setup_internal(&operation->ctx.hmac,
313 mbedtls_psa_mac_abort(operation);
320 mbedtls_psa_mac_operation_t *operation,
326 return psa_mac_setup(operation, attributes,
331 mbedtls_psa_mac_operation_t *operation,
337 return psa_mac_setup(operation, attributes,
342 mbedtls_psa_mac_operation_t *operation,
346 if (operation->alg == 0) {
351 if (PSA_ALG_FULL_LENGTH_MAC(operation->alg) == PSA_ALG_CMAC) {
353 mbedtls_cipher_cmac_update(&operation->ctx.cmac,
358 if (PSA_ALG_IS_HMAC(operation->alg)) {
359 return psa_hmac_update_internal(&operation->ctx.hmac,
364 /* This shouldn't happen if `operation` was initialized by
373 mbedtls_psa_mac_operation_t *operation,
377 if (PSA_ALG_FULL_LENGTH_MAC(operation->alg) == PSA_ALG_CMAC) {
379 int ret = mbedtls_cipher_cmac_finish(&operation->ctx.cmac, tmp);
388 if (PSA_ALG_IS_HMAC(operation->alg)) {
389 return psa_hmac_finish_internal(&operation->ctx.hmac,
394 /* This shouldn't happen if `operation` was initialized by
396 (void) operation;
404 mbedtls_psa_mac_operation_t *operation,
411 if (operation->alg == 0) {
415 status = psa_mac_finish_internal(operation, mac, mac_size);
424 mbedtls_psa_mac_operation_t *operation,
431 if (operation->alg == 0) {
440 status = psa_mac_finish_internal(operation, actual_mac, mac_length);
467 mbedtls_psa_mac_operation_t operation = MBEDTLS_PSA_MAC_OPERATION_INIT;
469 status = psa_mac_setup(&operation,
477 status = mbedtls_psa_mac_update(&operation, input, input_length);
483 status = psa_mac_finish_internal(&operation, mac, mac_size);
489 mbedtls_psa_mac_abort(&operation);