Lines Matching refs:ret

120     int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;  in mbedtls_chachapoly_setkey()  local
124 ret = mbedtls_chacha20_setkey( &ctx->chacha20_ctx, key ); in mbedtls_chachapoly_setkey()
126 return( ret ); in mbedtls_chachapoly_setkey()
133 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_starts() local
139 ret = mbedtls_chacha20_starts( &ctx->chacha20_ctx, nonce, 0U ); in mbedtls_chachapoly_starts()
140 if( ret != 0 ) in mbedtls_chachapoly_starts()
149 ret = mbedtls_chacha20_update( &ctx->chacha20_ctx, sizeof( poly1305_key ), in mbedtls_chachapoly_starts()
151 if( ret != 0 ) in mbedtls_chachapoly_starts()
154 ret = mbedtls_poly1305_starts( &ctx->poly1305_ctx, poly1305_key ); in mbedtls_chachapoly_starts()
156 if( ret == 0 ) in mbedtls_chachapoly_starts()
166 return( ret ); in mbedtls_chachapoly_starts()
189 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_update() local
204 ret = chachapoly_pad_aad( ctx ); in mbedtls_chachapoly_update()
205 if( ret != 0 ) in mbedtls_chachapoly_update()
206 return( ret ); in mbedtls_chachapoly_update()
213 ret = mbedtls_chacha20_update( &ctx->chacha20_ctx, len, input, output ); in mbedtls_chachapoly_update()
214 if( ret != 0 ) in mbedtls_chachapoly_update()
215 return( ret ); in mbedtls_chachapoly_update()
217 ret = mbedtls_poly1305_update( &ctx->poly1305_ctx, output, len ); in mbedtls_chachapoly_update()
218 if( ret != 0 ) in mbedtls_chachapoly_update()
219 return( ret ); in mbedtls_chachapoly_update()
223 ret = mbedtls_poly1305_update( &ctx->poly1305_ctx, input, len ); in mbedtls_chachapoly_update()
224 if( ret != 0 ) in mbedtls_chachapoly_update()
225 return( ret ); in mbedtls_chachapoly_update()
227 ret = mbedtls_chacha20_update( &ctx->chacha20_ctx, len, input, output ); in mbedtls_chachapoly_update()
228 if( ret != 0 ) in mbedtls_chachapoly_update()
229 return( ret ); in mbedtls_chachapoly_update()
238 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_finish() local
250 ret = chachapoly_pad_aad( ctx ); in mbedtls_chachapoly_finish()
251 if( ret != 0 ) in mbedtls_chachapoly_finish()
252 return( ret ); in mbedtls_chachapoly_finish()
256 ret = chachapoly_pad_ciphertext( ctx ); in mbedtls_chachapoly_finish()
257 if( ret != 0 ) in mbedtls_chachapoly_finish()
258 return( ret ); in mbedtls_chachapoly_finish()
283 ret = mbedtls_poly1305_update( &ctx->poly1305_ctx, len_block, 16U ); in mbedtls_chachapoly_finish()
284 if( ret != 0 ) in mbedtls_chachapoly_finish()
285 return( ret ); in mbedtls_chachapoly_finish()
287 ret = mbedtls_poly1305_finish( &ctx->poly1305_ctx, mac ); in mbedtls_chachapoly_finish()
289 return( ret ); in mbedtls_chachapoly_finish()
302 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in chachapoly_crypt_and_tag() local
304 ret = mbedtls_chachapoly_starts( ctx, nonce, mode ); in chachapoly_crypt_and_tag()
305 if( ret != 0 ) in chachapoly_crypt_and_tag()
308 ret = mbedtls_chachapoly_update_aad( ctx, aad, aad_len ); in chachapoly_crypt_and_tag()
309 if( ret != 0 ) in chachapoly_crypt_and_tag()
312 ret = mbedtls_chachapoly_update( ctx, length, input, output ); in chachapoly_crypt_and_tag()
313 if( ret != 0 ) in chachapoly_crypt_and_tag()
316 ret = mbedtls_chachapoly_finish( ctx, tag ); in chachapoly_crypt_and_tag()
319 return( ret ); in chachapoly_crypt_and_tag()
352 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_auth_decrypt() local
363 if( ( ret = chachapoly_crypt_and_tag( ctx, in mbedtls_chachapoly_auth_decrypt()
367 return( ret ); in mbedtls_chachapoly_auth_decrypt()
493 int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED; in mbedtls_chachapoly_self_test() local
504 ret = mbedtls_chachapoly_setkey( &ctx, test_key[i] ); in mbedtls_chachapoly_self_test()
505 ASSERT( 0 == ret, ( "setkey() error code: %i\n", ret ) ); in mbedtls_chachapoly_self_test()
507 ret = mbedtls_chachapoly_encrypt_and_tag( &ctx, in mbedtls_chachapoly_self_test()
516 ASSERT( 0 == ret, ( "crypt_and_tag() error code: %i\n", ret ) ); in mbedtls_chachapoly_self_test()