@@ -884,21 +884,19 @@ void Alert::Process(input_buffer& input, SSL& ssl)
884884 else
885885 hmac (ssl, verify, data, aSz, alert, true );
886886
887- // read mac and fill
887+ // read mac and skip fill
888888 int digestSz = ssl.getCrypto ().get_digest ().get_digestSize ();
889889 opaque mac[SHA_LEN];
890890 input.read (mac, digestSz);
891891
892892 if (ssl.getSecurity ().get_parms ().cipher_type_ == block) {
893893 int ivExtra = 0 ;
894- opaque fill;
895894
896895 if (ssl.isTLSv1_1 ())
897896 ivExtra = ssl.getCrypto ().get_cipher ().get_blockSize ();
898897 int padSz = ssl.getSecurity ().get_parms ().encrypt_size_ - ivExtra -
899898 aSz - digestSz;
900- for (int i = 0 ; i < padSz; i++)
901- fill = input[AUTO];
899+ input.set_current (input.get_current () + padSz);
902900 }
903901
904902 // verify
@@ -981,17 +979,17 @@ output_buffer& operator<<(output_buffer& output, const Data& data)
981979void Data::Process (input_buffer& input, SSL& ssl)
982980{
983981 int msgSz = ssl.getSecurity ().get_parms ().encrypt_size_ ;
984- int pad = 0 , padByte = 0 ;
982+ int pad = 0 , padSz = 0 ;
985983 int ivExtra = 0 ;
986984
987985 if (ssl.getSecurity ().get_parms ().cipher_type_ == block) {
988986 if (ssl.isTLSv1_1 ()) // IV
989987 ivExtra = ssl.getCrypto ().get_cipher ().get_blockSize ();
990988 pad = *(input.get_buffer () + input.get_current () + msgSz -ivExtra - 1 );
991- padByte = 1 ;
989+ padSz = 1 ;
992990 }
993991 int digestSz = ssl.getCrypto ().get_digest ().get_digestSize ();
994- int dataSz = msgSz - ivExtra - digestSz - pad - padByte;
992+ int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
995993 opaque verify[SHA_LEN];
996994
997995 const byte* rawData = input.get_buffer () + input.get_current ();
@@ -1020,14 +1018,10 @@ void Data::Process(input_buffer& input, SSL& ssl)
10201018 hmac (ssl, verify, rawData, dataSz, application_data, true );
10211019 }
10221020
1023- // read mac and fill
1021+ // read mac and skip fill
10241022 opaque mac[SHA_LEN];
1025- opaque fill;
10261023 input.read (mac, digestSz);
1027- for (int i = 0 ; i < pad; i++)
1028- fill = input[AUTO];
1029- if (padByte)
1030- fill = input[AUTO];
1024+ input.set_current (input.get_current () + pad + padSz);
10311025
10321026 // verify
10331027 if (dataSz) {
@@ -2073,11 +2067,9 @@ void Finished::Process(input_buffer& input, SSL& ssl)
20732067 if (ssl.isTLSv1_1 ())
20742068 ivExtra = ssl.getCrypto ().get_cipher ().get_blockSize ();
20752069
2076- opaque fill;
20772070 int padSz = ssl.getSecurity ().get_parms ().encrypt_size_ - ivExtra -
20782071 HANDSHAKE_HEADER - finishedSz - digestSz;
2079- for (int i = 0 ; i < padSz; i++)
2080- fill = input[AUTO];
2072+ input.set_current (input.get_current () + padSz);
20812073
20822074 // verify mac
20832075 if (memcmp (mac, verifyMAC, digestSz)) {
0 commit comments