@@ -153,9 +153,9 @@ boolean isECFieldF2m() {
153153 * @return the native EC public key context pointer or -1 on error
154154 */
155155 long getNativePtr () {
156- if (nativeECKey == 0x0 ) {
156+ if (this . nativeECKey == 0x0 ) {
157157 synchronized (this ) {
158- if (nativeECKey == 0x0 ) {
158+ if (this . nativeECKey == 0x0 ) {
159159 ECPoint generator = this .params .getGenerator ();
160160 EllipticCurve curve = this .params .getCurve ();
161161 ECField field = curve .getField ();
@@ -165,29 +165,30 @@ long getNativePtr() {
165165 byte [] gy = generator .getAffineY ().toByteArray ();
166166 byte [] n = this .params .getOrder ().toByteArray ();
167167 byte [] h = BigInteger .valueOf (this .params .getCofactor ()).toByteArray ();
168- byte [] p = new byte [ 0 ] ;
168+ long nativePointer ;
169169 int fieldType = 0 ;
170170 if (field instanceof ECFieldFp ) {
171- p = ((ECFieldFp )field ).getP ().toByteArray ();
172- nativeECKey = nativeCrypto .ECEncodeGFp (a , a .length , b , b .length , p , p .length , gx , gx .length , gy , gy .length , n , n .length , h , h .length );
171+ byte [] p = ((ECFieldFp )field ).getP ().toByteArray ();
172+ nativePointer = nativeCrypto .ECEncodeGFp (a , a .length , b , b .length , p , p .length , gx , gx .length , gy , gy .length , n , n .length , h , h .length );
173173 } else if (field instanceof ECFieldF2m ) {
174174 fieldType = 1 ;
175- p = ((ECFieldF2m )field ).getReductionPolynomial ().toByteArray ();
176- nativeECKey = nativeCrypto .ECEncodeGF2m (a , a .length , b , b .length , p , p .length , gx , gx .length , gy , gy .length , n , n .length , h , h .length );
175+ byte [] p = ((ECFieldF2m )field ).getReductionPolynomial ().toByteArray ();
176+ nativePointer = nativeCrypto .ECEncodeGF2m (a , a .length , b , b .length , p , p .length , gx , gx .length , gy , gy .length , n , n .length , h , h .length );
177177 } else {
178- nativeECKey = -1 ;
178+ nativePointer = -1 ;
179179 }
180- if (nativeECKey != -1 ) {
181- nativeCrypto .createECKeyCleaner (this , nativeECKey );
180+ if (nativePointer != -1 ) {
181+ nativeCrypto .createECKeyCleaner (this , nativePointer );
182182 byte [] x = this .w .getAffineX ().toByteArray ();
183183 byte [] y = this .w .getAffineY ().toByteArray ();
184- if (nativeCrypto .ECCreatePublicKey (nativeECKey , x , x .length , y , y .length , fieldType ) == -1 ) {
185- nativeECKey = -1 ;
184+ if (nativeCrypto .ECCreatePublicKey (nativePointer , x , x .length , y , y .length , fieldType ) == -1 ) {
185+ nativePointer = -1 ;
186186 }
187187 }
188+ this .nativeECKey = nativePointer ;
188189 }
189190 }
190191 }
191- return nativeECKey ;
192+ return this . nativeECKey ;
192193 }
193194}
0 commit comments