@@ -834,7 +834,7 @@ public IRubyObject set_key(final ThreadContext context, final IRubyObject key) {
834834 debugStackTrace (runtime , e );
835835 throw newCipherError (runtime , e );
836836 }
837- if ( keyBytes .length () < keyLength ) {
837+ if ( keyBytes .getRealSize () < keyLength ) {
838838 throw newCipherError (context .runtime , "key length too short" );
839839 }
840840
@@ -856,7 +856,7 @@ public IRubyObject set_iv(final ThreadContext context, final IRubyObject iv) {
856856 debugStackTrace (runtime , e );
857857 throw newCipherError (runtime , e );
858858 }
859- if ( ivBytes .length () < ivLength ) {
859+ if ( ivBytes .getRealSize () < ivLength ) {
860860 throw newCipherError (context .runtime , "iv length too short" );
861861 }
862862 // EVP_CipherInit_ex uses leading IV length of given sequence.
@@ -1102,7 +1102,7 @@ public IRubyObject update(final ThreadContext context, final IRubyObject arg) {
11021102 checkAuthTag (runtime );
11031103
11041104 final ByteList data = arg .asString ().getByteList ();
1105- final int length = data .length ();
1105+ final int length = data .getRealSize ();
11061106 if ( length == 0 ) {
11071107 throw runtime .newArgumentError ("data must not be empty" );
11081108 }
@@ -1221,7 +1221,7 @@ private ByteList do_final_with_auth(final Ruby runtime) throws GeneralSecurityEx
12211221 final byte [] out ;
12221222 if ( auth_tag != null ) {
12231223 final byte [] tag = auth_tag .getUnsafeBytes ();
1224- out = cipher .doFinal (tag , auth_tag .begin (), auth_tag .length ());
1224+ out = cipher .doFinal (tag , auth_tag .getBegin (), auth_tag .getRealSize ());
12251225 }
12261226 else {
12271227 out = cipher .doFinal ();
@@ -1303,7 +1303,7 @@ private boolean updateAuthData(final Ruby runtime) {
13031303 if ( auth_data == null ) return false ; // only to be set if auth-mode
13041304 //try {
13051305 final byte [] data = auth_data .getUnsafeBytes ();
1306- cipher .updateAAD (data , auth_data .begin (), auth_data .length ());
1306+ cipher .updateAAD (data , auth_data .getBegin (), auth_data .getRealSize ());
13071307 //}
13081308 //catch (RuntimeException e) {
13091309 // debugStackTrace( runtime, e );
0 commit comments