Lines Matching refs:ret

101     int ret, i, j;  in gcm_gen_table()  local
106 ret = mbedtls_block_cipher_encrypt(&ctx->block_cipher_ctx, h, h); in gcm_gen_table()
109 ret = mbedtls_cipher_update(&ctx->cipher_ctx, h, 16, h, &olen); in gcm_gen_table()
111 if (ret != 0) { in gcm_gen_table()
112 return ret; in gcm_gen_table()
167 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_gcm_setkey() local
176 if ((ret = mbedtls_block_cipher_setup(&ctx->block_cipher_ctx, cipher)) != 0) { in mbedtls_gcm_setkey()
177 return ret; in mbedtls_gcm_setkey()
180 if ((ret = mbedtls_block_cipher_setkey(&ctx->block_cipher_ctx, key, keybits)) != 0) { in mbedtls_gcm_setkey()
181 return ret; in mbedtls_gcm_setkey()
198 if ((ret = mbedtls_cipher_setup(&ctx->cipher_ctx, cipher_info)) != 0) { in mbedtls_gcm_setkey()
199 return ret; in mbedtls_gcm_setkey()
202 if ((ret = mbedtls_cipher_setkey(&ctx->cipher_ctx, key, keybits, in mbedtls_gcm_setkey()
204 return ret; in mbedtls_gcm_setkey()
208 if ((ret = gcm_gen_table(ctx)) != 0) { in mbedtls_gcm_setkey()
209 return ret; in mbedtls_gcm_setkey()
381 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_gcm_starts() local
439 ret = mbedtls_block_cipher_encrypt(&ctx->block_cipher_ctx, ctx->y, ctx->base_ectr); in mbedtls_gcm_starts()
441 ret = mbedtls_cipher_update(&ctx->cipher_ctx, ctx->y, 16, ctx->base_ectr, &olen); in mbedtls_gcm_starts()
443 if (ret != 0) { in mbedtls_gcm_starts()
444 return ret; in mbedtls_gcm_starts()
540 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in gcm_mask() local
543 ret = mbedtls_block_cipher_encrypt(&ctx->block_cipher_ctx, ctx->y, ectr); in gcm_mask()
546 ret = mbedtls_cipher_update(&ctx->cipher_ctx, ctx->y, 16, ectr, &olen); in gcm_mask()
548 if (ret != 0) { in gcm_mask()
550 return ret; in gcm_mask()
569 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_gcm_update() local
610 if ((ret = gcm_mask(ctx, ectr, offset, use_len, p, out_p)) != 0) { in mbedtls_gcm_update()
611 return ret; in mbedtls_gcm_update()
628 if ((ret = gcm_mask(ctx, ectr, 0, 16, p, out_p)) != 0) { in mbedtls_gcm_update()
629 return ret; in mbedtls_gcm_update()
641 if ((ret = gcm_mask(ctx, ectr, 0, input_length, p, out_p)) != 0) { in mbedtls_gcm_update()
642 return ret; in mbedtls_gcm_update()
715 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_gcm_crypt_and_tag() local
718 if ((ret = mbedtls_gcm_starts(ctx, mode, iv, iv_len)) != 0) { in mbedtls_gcm_crypt_and_tag()
719 return ret; in mbedtls_gcm_crypt_and_tag()
722 if ((ret = mbedtls_gcm_update_ad(ctx, add, add_len)) != 0) { in mbedtls_gcm_crypt_and_tag()
723 return ret; in mbedtls_gcm_crypt_and_tag()
726 if ((ret = mbedtls_gcm_update(ctx, input, length, in mbedtls_gcm_crypt_and_tag()
728 return ret; in mbedtls_gcm_crypt_and_tag()
731 if ((ret = mbedtls_gcm_finish(ctx, NULL, 0, &olen, tag, tag_len)) != 0) { in mbedtls_gcm_crypt_and_tag()
732 return ret; in mbedtls_gcm_crypt_and_tag()
749 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_gcm_auth_decrypt() local
753 if ((ret = mbedtls_gcm_crypt_and_tag(ctx, MBEDTLS_GCM_DECRYPT, length, in mbedtls_gcm_auth_decrypt()
756 return ret; in mbedtls_gcm_auth_decrypt()
1022 int i, j, ret; in mbedtls_gcm_self_test() local
1060 ret = mbedtls_gcm_setkey(&ctx, cipher, in mbedtls_gcm_self_test()
1068 if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED && key_len == 192) { in mbedtls_gcm_self_test()
1071 } else if (ret != 0) { in mbedtls_gcm_self_test()
1075 ret = mbedtls_gcm_crypt_and_tag(&ctx, MBEDTLS_GCM_ENCRYPT, in mbedtls_gcm_self_test()
1085 if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED && in mbedtls_gcm_self_test()
1091 if (ret != 0) { in mbedtls_gcm_self_test()
1098 ret = 1; in mbedtls_gcm_self_test()
1115 ret = mbedtls_gcm_setkey(&ctx, cipher, in mbedtls_gcm_self_test()
1118 if (ret != 0) { in mbedtls_gcm_self_test()
1122 ret = mbedtls_gcm_crypt_and_tag(&ctx, MBEDTLS_GCM_DECRYPT, in mbedtls_gcm_self_test()
1130 if (ret != 0) { in mbedtls_gcm_self_test()
1137 ret = 1; in mbedtls_gcm_self_test()
1154 ret = mbedtls_gcm_setkey(&ctx, cipher, in mbedtls_gcm_self_test()
1157 if (ret != 0) { in mbedtls_gcm_self_test()
1161 ret = mbedtls_gcm_starts(&ctx, MBEDTLS_GCM_ENCRYPT, in mbedtls_gcm_self_test()
1164 if (ret != 0) { in mbedtls_gcm_self_test()
1168 ret = mbedtls_gcm_update_ad(&ctx, in mbedtls_gcm_self_test()
1171 if (ret != 0) { in mbedtls_gcm_self_test()
1177 ret = mbedtls_gcm_update(&ctx, in mbedtls_gcm_self_test()
1181 if (ret != 0) { in mbedtls_gcm_self_test()
1188 ret = mbedtls_gcm_update(&ctx, in mbedtls_gcm_self_test()
1192 if (ret != 0) { in mbedtls_gcm_self_test()
1199 ret = mbedtls_gcm_update(&ctx, in mbedtls_gcm_self_test()
1203 if (ret != 0) { in mbedtls_gcm_self_test()
1211 ret = mbedtls_gcm_finish(&ctx, NULL, 0, &olen, tag_buf, 16); in mbedtls_gcm_self_test()
1212 if (ret != 0) { in mbedtls_gcm_self_test()
1219 ret = 1; in mbedtls_gcm_self_test()
1236 ret = mbedtls_gcm_setkey(&ctx, cipher, in mbedtls_gcm_self_test()
1239 if (ret != 0) { in mbedtls_gcm_self_test()
1243 ret = mbedtls_gcm_starts(&ctx, MBEDTLS_GCM_DECRYPT, in mbedtls_gcm_self_test()
1246 if (ret != 0) { in mbedtls_gcm_self_test()
1249 ret = mbedtls_gcm_update_ad(&ctx, in mbedtls_gcm_self_test()
1252 if (ret != 0) { in mbedtls_gcm_self_test()
1258 ret = mbedtls_gcm_update(&ctx, in mbedtls_gcm_self_test()
1261 if (ret != 0) { in mbedtls_gcm_self_test()
1268 ret = mbedtls_gcm_update(&ctx, in mbedtls_gcm_self_test()
1272 if (ret != 0) { in mbedtls_gcm_self_test()
1279 ret = mbedtls_gcm_update(&ctx, in mbedtls_gcm_self_test()
1283 if (ret != 0) { in mbedtls_gcm_self_test()
1291 ret = mbedtls_gcm_finish(&ctx, NULL, 0, &olen, tag_buf, 16); in mbedtls_gcm_self_test()
1292 if (ret != 0) { in mbedtls_gcm_self_test()
1299 ret = 1; in mbedtls_gcm_self_test()
1315 ret = 0; in mbedtls_gcm_self_test()
1318 if (ret != 0) { in mbedtls_gcm_self_test()
1325 return ret; in mbedtls_gcm_self_test()