@@ -444,10 +444,7 @@ static void free_crypt_cipher_context(CRYPT_CTX *ctx);
444
444
if (blk > 0 && len < blk ) return 0 ;
445
445
446
446
// make space at tail if needed...
447
- ofs = SERIES_TAIL (bin );
448
- Expand_Series (bin , AT_TAIL , len );
449
- // reset the tail (above expand modifies it!)
450
- SERIES_TAIL (bin ) = ofs ;
447
+ Extend_Series (bin , len );
451
448
452
449
switch (ctx -> cipher_type ) {
453
450
@@ -858,9 +855,7 @@ static void free_crypt_cipher_context(CRYPT_CTX *ctx);
858
855
//puts("update");
859
856
#ifdef MBEDTLS_CHACHAPOLY_C
860
857
if (ctx -> cipher_type == SYM_CHACHA20_POLY1305 ) {
861
- olen = SERIES_TAIL (bin );
862
- Expand_Series (bin , AT_TAIL , 16 );
863
- SERIES_TAIL (bin ) = olen ; // reset the tail (above expand modifies it!)
858
+ Extend_Series (bin , 16 );
864
859
err = mbedtls_chachapoly_finish ((mbedtls_chachapoly_context * )ctx -> cipher_ctx , BIN_TAIL (bin ));
865
860
SERIES_TAIL (bin ) += 16 ;
866
861
ctx -> state = CRYPT_PORT_NEEDS_AAD ;
@@ -870,10 +865,7 @@ static void free_crypt_cipher_context(CRYPT_CTX *ctx);
870
865
if (ctx -> unprocessed_len > 0 ) {
871
866
ofs = 0 ;
872
867
blk = ctx -> cipher_block_size ;
873
- olen = SERIES_TAIL (bin );
874
- Expand_Series (bin , AT_TAIL , blk );
875
- // reset the tail (above expand modifies it!)
876
- SERIES_TAIL (bin ) = olen ;
868
+ Extend_Series (bin , blk );
877
869
878
870
if (ctx -> unprocessed_len > blk ) abort ();
879
871
len = blk - ctx -> unprocessed_len ;
0 commit comments