@@ -374,17 +374,17 @@ qemu_irq ot_csnrg_connect_hw_app(OtCSRNGState *s, unsigned app_id,
374374 qemu_irq req_sts , ot_csrng_genbit_filler_fn fn ,
375375 void * opaque )
376376{
377- assert (app_id < OT_CSRNG_HW_APP_MAX );
378- assert (req_sts );
379- assert (fn );
377+ g_assert (app_id < OT_CSRNG_HW_APP_MAX );
378+ g_assert (req_sts );
379+ g_assert (fn );
380380
381381 OtCSRNGInstance * inst = & s -> instances [app_id ];
382382 /* if connection is invoked many times, there is no reason for changes */
383383 if (inst -> hw .filler ) {
384- assert (inst -> hw .filler == fn );
384+ g_assert (inst -> hw .filler == fn );
385385 }
386386 if (inst -> hw .req_sts ) {
387- assert (inst -> hw .req_sts == req_sts );
387+ g_assert (inst -> hw .req_sts == req_sts );
388388 }
389389 inst -> hw .filler = fn ;
390390 inst -> hw .opaque = opaque ;
@@ -399,15 +399,15 @@ qemu_irq ot_csnrg_connect_hw_app(OtCSRNGState *s, unsigned app_id,
399399int ot_csrng_push_command (OtCSRNGState * s , unsigned app_id ,
400400 const uint32_t * command )
401401{
402- assert (app_id < OT_CSRNG_HW_APP_MAX );
402+ g_assert (app_id < OT_CSRNG_HW_APP_MAX );
403403
404404 if (s -> state == CSRNG_ERROR ) {
405405 return -1 ;
406406 }
407407
408408 OtCSRNGInstance * inst = & s -> instances [app_id ];
409- assert (inst -> hw .filler );
410- assert (inst -> hw .req_sts );
409+ g_assert (inst -> hw .filler );
410+ g_assert (inst -> hw .req_sts );
411411
412412 ot_fifo32_reset (& inst -> cmd_fifo );
413413 uint32_t acmd = FIELD_EX32 (command [0 ], OT_CSNRG_CMD , ACMD );
@@ -553,7 +553,7 @@ static OtCSRNDCmdResult ot_csrng_drng_instanciate(
553553 int res ;
554554 res = ecb_start (inst -> parent -> aes_cipher , key , (int )sizeof (key ), 0 ,
555555 & drng -> ecb );
556- assert (res == CRYPT_OK );
556+ g_assert (res == CRYPT_OK );
557557
558558 memcpy (drng -> key , key , OT_CSRNG_AES_KEY_SIZE );
559559 drng -> instantiated = true;
@@ -602,7 +602,7 @@ static int ot_csrng_drng_update(OtCSRNGInstance *inst)
602602
603603 res = ecb_encrypt (drng -> v_counter , ptmp , OT_CSRNG_AES_BLOCK_SIZE ,
604604 & drng -> ecb );
605- assert (res == CRYPT_OK );
605+ g_assert (res == CRYPT_OK );
606606 ptmp += OT_CSRNG_AES_BLOCK_SIZE ;
607607 }
608608
@@ -613,12 +613,12 @@ static int ot_csrng_drng_update(OtCSRNGInstance *inst)
613613 ot_csrng_drng_clear_material (inst );
614614
615615 res = ecb_done (& drng -> ecb );
616- assert (res == CRYPT_OK );
616+ g_assert (res == CRYPT_OK );
617617
618618 ptmp = (uint8_t * )tmp ;
619619 res = ecb_start (inst -> parent -> aes_cipher , ptmp , (int )OT_CSRNG_AES_KEY_SIZE ,
620620 0 , & drng -> ecb );
621- assert (res == CRYPT_OK );
621+ g_assert (res == CRYPT_OK );
622622
623623 memcpy (drng -> key , ptmp , OT_CSRNG_AES_KEY_SIZE );
624624 memcpy (drng -> v_counter , & ptmp [OT_CSRNG_AES_KEY_SIZE ],
@@ -636,7 +636,7 @@ static OtCSRNDCmdResult ot_csrng_drng_reseed(
636636 OtCSRNGInstance * inst , OtEntropySrcState * entropy_src , bool flag0 )
637637{
638638 OtCSRNGDrng * drng = & inst -> drng ;
639- assert (drng -> instantiated );
639+ g_assert (drng -> instantiated );
640640
641641 if (!flag0 ) {
642642 if (!inst -> parent -> es_available ) {
@@ -693,7 +693,7 @@ static void ot_csrng_drng_generate(OtCSRNGInstance *inst, uint32_t *out,
693693
694694 res = ecb_encrypt (drng -> v_counter , (uint8_t * )out , OT_CSRNG_AES_BLOCK_SIZE ,
695695 & drng -> ecb );
696- assert (res == CRYPT_OK );
696+ g_assert (res == CRYPT_OK );
697697
698698 xtrace_ot_csrng_show_buffer (ot_csrng_get_slot (inst ), "out" , out ,
699699 OT_CSRNG_AES_BLOCK_SIZE );
@@ -713,7 +713,7 @@ static void ot_csrng_drng_generate(OtCSRNGInstance *inst, uint32_t *out,
713713static unsigned ot_csrng_get_slot (OtCSRNGInstance * inst )
714714{
715715 unsigned slot = (unsigned )(uintptr_t )(inst - & inst -> parent -> instances [0 ]);
716- assert (slot <= SW_INSTANCE_ID );
716+ g_assert (slot <= SW_INSTANCE_ID );
717717 return slot ;
718718}
719719
@@ -1001,7 +1001,7 @@ ot_csrng_handle_instantiate(OtCSRNGState *s, unsigned slot)
10011001 const uint32_t * buffer =
10021002 ot_fifo32_peek_buf (& inst -> cmd_fifo , ot_fifo32_num_used (& inst -> cmd_fifo ),
10031003 & num );
1004- assert (num - 1u == clen );
1004+ g_assert (num - 1u == clen );
10051005 buffer += 1u ;
10061006
10071007 if (clen ) {
@@ -1055,7 +1055,7 @@ static int ot_csrng_handle_generate(OtCSRNGState *s, unsigned slot)
10551055 const uint32_t * buffer =
10561056 ot_fifo32_peek_buf (& inst -> cmd_fifo ,
10571057 ot_fifo32_num_used (& inst -> cmd_fifo ), & num );
1058- assert (num - 1u == clen );
1058+ g_assert (num - 1u == clen );
10591059 buffer += 1u ;
10601060 xtrace_ot_csrng_show_buffer (ot_csrng_get_slot (inst ), "mat" , buffer ,
10611061 clen * sizeof (uint32_t ));
@@ -1065,7 +1065,7 @@ static int ot_csrng_handle_generate(OtCSRNGState *s, unsigned slot)
10651065 trace_ot_csrng_generate (ot_csrng_get_slot (inst ), packet_count );
10661066
10671067 OtCSRNGDrng * drng = & inst -> drng ;
1068- assert (drng -> instantiated );
1068+ g_assert (drng -> instantiated );
10691069
10701070 if (ot_csrng_drng_remaining_count (inst )) {
10711071 xtrace_ot_csrng_info ("remaining packets to generate" ,
@@ -1100,7 +1100,7 @@ static OtCSRNDCmdResult ot_csrng_handle_reseed(OtCSRNGState *s, unsigned slot)
11001100 const uint32_t * buffer =
11011101 ot_fifo32_peek_buf (& inst -> cmd_fifo ,
11021102 ot_fifo32_num_used (& inst -> cmd_fifo ), & num );
1103- assert (num - 1u == clen );
1103+ g_assert (num - 1u == clen );
11041104 buffer += 1u ;
11051105
11061106 xtrace_ot_csrng_show_buffer (ot_csrng_get_slot (inst ), "mat" , buffer ,
@@ -1134,7 +1134,7 @@ static OtCSRNDCmdResult ot_csrng_handle_update(OtCSRNGState *s, unsigned slot)
11341134 const uint32_t * buffer =
11351135 ot_fifo32_peek_buf (& inst -> cmd_fifo ,
11361136 ot_fifo32_num_used (& inst -> cmd_fifo ), & num );
1137- assert (num - 1u == clen );
1137+ g_assert (num - 1u == clen );
11381138 buffer += 1u ;
11391139
11401140 xtrace_ot_csrng_show_buffer (ot_csrng_get_slot (inst ), "mat" , buffer ,
@@ -1154,7 +1154,7 @@ static void ot_csrng_hwapp_ready_irq(void *opaque, int n, int level)
11541154 OtCSRNGState * s = opaque ;
11551155
11561156 unsigned slot = (unsigned )n ;
1157- assert (slot < OT_CSRNG_HW_APP_MAX );
1157+ g_assert (slot < OT_CSRNG_HW_APP_MAX );
11581158 bool ready = (bool )level ;
11591159
11601160 OtCSRNGInstance * inst = & s -> instances [slot ];
@@ -1267,7 +1267,7 @@ static int ot_csrng_handle_command(OtCSRNGState *s, unsigned slot)
12671267 case OT_CSRNG_CMD_RESEED :
12681268 break ;
12691269 case OT_CSRNG_CMD_GENERATE :
1270- assert (slot == SW_INSTANCE_ID || inst -> hw .filler );
1270+ g_assert (slot == SW_INSTANCE_ID || inst -> hw .filler );
12711271 break ;
12721272 case OT_CSRNG_CMD_UPDATE :
12731273 case OT_CSRNG_CMD_UNINSTANTIATE :
@@ -1743,8 +1743,8 @@ static void ot_csrng_reset(DeviceState *dev)
17431743{
17441744 OtCSRNGState * s = OT_CSRNG (dev );
17451745
1746- assert (s -> entropy_src );
1747- assert (s -> otp_ctrl );
1746+ g_assert (s -> entropy_src );
1747+ g_assert (s -> otp_ctrl );
17481748
17491749 timer_del (s -> cmd_scheduler );
17501750
@@ -1764,7 +1764,7 @@ static void ot_csrng_reset(DeviceState *dev)
17641764
17651765 for (unsigned ix = 0 ; ix < OT_CSRNG_HW_APP_MAX + 1u ; ix ++ ) {
17661766 OtCSRNGInstance * inst = & s -> instances [ix ];
1767- assert (inst -> parent );
1767+ g_assert (inst -> parent );
17681768 ot_fifo32_reset (& inst -> cmd_fifo );
17691769 if (ix == SW_INSTANCE_ID ) {
17701770 ot_fifo32_reset (& inst -> sw .bits_fifo );
0 commit comments