Lines Matching refs:ret
97 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_setkey() local
99 ret = mbedtls_chacha20_setkey(&ctx->chacha20_ctx, key); in mbedtls_chachapoly_setkey()
101 return ret; in mbedtls_chachapoly_setkey()
108 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_starts() local
112 ret = mbedtls_chacha20_starts(&ctx->chacha20_ctx, nonce, 0U); in mbedtls_chachapoly_starts()
113 if (ret != 0) { in mbedtls_chachapoly_starts()
123 ret = mbedtls_chacha20_update(&ctx->chacha20_ctx, sizeof(poly1305_key), in mbedtls_chachapoly_starts()
125 if (ret != 0) { in mbedtls_chachapoly_starts()
129 ret = mbedtls_poly1305_starts(&ctx->poly1305_ctx, poly1305_key); in mbedtls_chachapoly_starts()
131 if (ret == 0) { in mbedtls_chachapoly_starts()
140 return ret; in mbedtls_chachapoly_starts()
161 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_update() local
171 ret = chachapoly_pad_aad(ctx); in mbedtls_chachapoly_update()
172 if (ret != 0) { in mbedtls_chachapoly_update()
173 return ret; in mbedtls_chachapoly_update()
180 ret = mbedtls_chacha20_update(&ctx->chacha20_ctx, len, input, output); in mbedtls_chachapoly_update()
181 if (ret != 0) { in mbedtls_chachapoly_update()
182 return ret; in mbedtls_chachapoly_update()
185 ret = mbedtls_poly1305_update(&ctx->poly1305_ctx, output, len); in mbedtls_chachapoly_update()
186 if (ret != 0) { in mbedtls_chachapoly_update()
187 return ret; in mbedtls_chachapoly_update()
190 ret = mbedtls_poly1305_update(&ctx->poly1305_ctx, input, len); in mbedtls_chachapoly_update()
191 if (ret != 0) { in mbedtls_chachapoly_update()
192 return ret; in mbedtls_chachapoly_update()
195 ret = mbedtls_chacha20_update(&ctx->chacha20_ctx, len, input, output); in mbedtls_chachapoly_update()
196 if (ret != 0) { in mbedtls_chachapoly_update()
197 return ret; in mbedtls_chachapoly_update()
207 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_finish() local
215 ret = chachapoly_pad_aad(ctx); in mbedtls_chachapoly_finish()
216 if (ret != 0) { in mbedtls_chachapoly_finish()
217 return ret; in mbedtls_chachapoly_finish()
220 ret = chachapoly_pad_ciphertext(ctx); in mbedtls_chachapoly_finish()
221 if (ret != 0) { in mbedtls_chachapoly_finish()
222 return ret; in mbedtls_chachapoly_finish()
234 ret = mbedtls_poly1305_update(&ctx->poly1305_ctx, len_block, 16U); in mbedtls_chachapoly_finish()
235 if (ret != 0) { in mbedtls_chachapoly_finish()
236 return ret; in mbedtls_chachapoly_finish()
239 ret = mbedtls_poly1305_finish(&ctx->poly1305_ctx, mac); in mbedtls_chachapoly_finish()
241 return ret; in mbedtls_chachapoly_finish()
254 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in chachapoly_crypt_and_tag() local
256 ret = mbedtls_chachapoly_starts(ctx, nonce, mode); in chachapoly_crypt_and_tag()
257 if (ret != 0) { in chachapoly_crypt_and_tag()
261 ret = mbedtls_chachapoly_update_aad(ctx, aad, aad_len); in chachapoly_crypt_and_tag()
262 if (ret != 0) { in chachapoly_crypt_and_tag()
266 ret = mbedtls_chachapoly_update(ctx, length, input, output); in chachapoly_crypt_and_tag()
267 if (ret != 0) { in chachapoly_crypt_and_tag()
271 ret = mbedtls_chachapoly_finish(ctx, tag); in chachapoly_crypt_and_tag()
274 return ret; in chachapoly_crypt_and_tag()
300 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_auth_decrypt() local
304 if ((ret = chachapoly_crypt_and_tag(ctx, in mbedtls_chachapoly_auth_decrypt()
307 return ret; in mbedtls_chachapoly_auth_decrypt()
431 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_self_test() local
442 ret = mbedtls_chachapoly_setkey(&ctx, test_key[i]); in mbedtls_chachapoly_self_test()
443 ASSERT(0 == ret, ("setkey() error code: %i\n", ret)); in mbedtls_chachapoly_self_test()
445 ret = mbedtls_chachapoly_encrypt_and_tag(&ctx, in mbedtls_chachapoly_self_test()
454 ASSERT(0 == ret, ("crypt_and_tag() error code: %i\n", ret)); in mbedtls_chachapoly_self_test()