@@ -561,8 +561,7 @@ state_encrypt_final(aegis128x2_state *st_, uint8_t *mac, size_t maclen)
561561}
562562
563563static int
564- state_decrypt_update (aegis128x2_state * st_ , uint8_t * m , size_t mlen_max , size_t * written ,
565- const uint8_t * c , size_t clen )
564+ state_decrypt_update (aegis128x2_state * st_ , uint8_t * m , const uint8_t * c , size_t clen )
566565{
567566 aegis_blocks blocks ;
568567 _aegis128x2_state * const st =
@@ -573,14 +572,8 @@ state_decrypt_update(aegis128x2_state *st_, uint8_t *m, size_t mlen_max, size_t
573572
574573 memcpy (blocks , st -> blocks , sizeof blocks );
575574
576- * written = 0 ;
577575 st -> mlen += clen ;
578576
579- if (m != NULL && mlen_max < clen ) {
580- errno = ERANGE ;
581- return -1 ;
582- }
583-
584577 // Handle leftover keystream from previous call
585578 if (st -> pos != 0 ) {
586579 const size_t available = RATE - st -> pos ;
@@ -597,7 +590,6 @@ state_decrypt_update(aegis128x2_state *st_, uint8_t *m, size_t mlen_max, size_t
597590 }
598591 }
599592 st -> pos += n ;
600- * written += n ;
601593 if (m != NULL ) {
602594 m += n ;
603595 }
@@ -625,7 +617,6 @@ state_decrypt_update(aegis128x2_state *st_, uint8_t *m, size_t mlen_max, size_t
625617 aegis128x2_dec (dst , c + i , blocks );
626618 }
627619 }
628- * written += i ;
629620
630621 left = clen - i ;
631622 if (left != 0 ) {
@@ -644,7 +635,6 @@ state_decrypt_update(aegis128x2_state *st_, uint8_t *m, size_t mlen_max, size_t
644635 }
645636 }
646637 st -> pos = left ;
647- * written += left ;
648638 }
649639
650640 memcpy (st -> blocks , blocks , sizeof blocks );
@@ -668,7 +658,6 @@ state_decrypt_final(aegis128x2_state *st_, uint8_t *m, size_t mlen_max, size_t *
668658 memcpy (blocks , st -> blocks , sizeof blocks );
669659
670660 if (written != NULL ) {
671- * written = 0 ;
672661 }
673662
674663 // Plaintext was already output during _update; absorb cached plaintext into state
0 commit comments