Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(874)

Side by Side Diff: net/android/java/src/org/chromium/net/DefaultAndroidKeyStore.java

Issue 182933002: Fix build issues in net/ for Android x64 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.net; 5 package org.chromium.net;
6 6
7 import android.util.Log; 7 import android.util.Log;
8 8
9 import java.lang.reflect.Method; 9 import java.lang.reflect.Method;
10 import java.security.NoSuchAlgorithmException; 10 import java.security.NoSuchAlgorithmException;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return PrivateKeyType.RSA; 136 return PrivateKeyType.RSA;
137 if (javaKey instanceof DSAPrivateKey) 137 if (javaKey instanceof DSAPrivateKey)
138 return PrivateKeyType.DSA; 138 return PrivateKeyType.DSA;
139 if (javaKey instanceof ECPrivateKey) 139 if (javaKey instanceof ECPrivateKey)
140 return PrivateKeyType.ECDSA; 140 return PrivateKeyType.ECDSA;
141 else 141 else
142 return PrivateKeyType.INVALID; 142 return PrivateKeyType.INVALID;
143 } 143 }
144 144
145 @Override 145 @Override
146 public int getOpenSSLHandleForPrivateKey(AndroidPrivateKey key) { 146 public long getOpenSSLHandleForPrivateKey(AndroidPrivateKey key) {
147 PrivateKey javaKey = ((DefaultAndroidPrivateKey) key).getJavaKey(); 147 PrivateKey javaKey = ((DefaultAndroidPrivateKey) key).getJavaKey();
148 // Sanity checks 148 // Sanity checks
149 if (javaKey == null) { 149 if (javaKey == null) {
150 Log.e(TAG, "key == null"); 150 Log.e(TAG, "key == null");
151 return 0; 151 return 0;
152 } 152 }
153 if (!(javaKey instanceof RSAPrivateKey)) { 153 if (!(javaKey instanceof RSAPrivateKey)) {
154 Log.e(TAG, "does not implement RSAPrivateKey"); 154 Log.e(TAG, "does not implement RSAPrivateKey");
155 return 0; 155 return 0;
156 } 156 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // which is the address of an EVP_PKEY object. 200 // which is the address of an EVP_PKEY object.
201 Method getPkeyContext; 201 Method getPkeyContext;
202 try { 202 try {
203 getPkeyContext = opensslKey.getClass().getDeclaredMethod("getPke yContext"); 203 getPkeyContext = opensslKey.getClass().getDeclaredMethod("getPke yContext");
204 } catch (Exception e) { 204 } catch (Exception e) {
205 // Bail here too, something really not working as expected. 205 // Bail here too, something really not working as expected.
206 Log.e(TAG, "No getPkeyContext() method on OpenSSLKey member:" + e); 206 Log.e(TAG, "No getPkeyContext() method on OpenSSLKey member:" + e);
207 return 0; 207 return 0;
208 } 208 }
209 getPkeyContext.setAccessible(true); 209 getPkeyContext.setAccessible(true);
210 int evp_pkey = 0; 210 long evp_pkey = 0;
211 try { 211 try {
212 evp_pkey = (Integer) getPkeyContext.invoke(opensslKey); 212 evp_pkey = (Long) getPkeyContext.invoke(opensslKey);
213 } finally { 213 } finally {
214 getPkeyContext.setAccessible(false); 214 getPkeyContext.setAccessible(false);
215 } 215 }
216 if (evp_pkey == 0) { 216 if (evp_pkey == 0) {
217 // The PrivateKey is probably rotten for some reason. 217 // The PrivateKey is probably rotten for some reason.
218 Log.e(TAG, "getPkeyContext() returned null"); 218 Log.e(TAG, "getPkeyContext() returned null");
219 } 219 }
220 return evp_pkey; 220 return evp_pkey;
221 221
222 } catch (Exception e) { 222 } catch (Exception e) {
223 Log.e(TAG, "Exception while trying to retrieve system EVP_PKEY handl e: " + e); 223 Log.e(TAG, "Exception while trying to retrieve system EVP_PKEY handl e: " + e);
224 return 0; 224 return 0;
225 } 225 }
226 } 226 }
227 227
228 @Override 228 @Override
229 public void releaseKey(AndroidPrivateKey key) { 229 public void releaseKey(AndroidPrivateKey key) {
230 // no-op for in-process. GC will handle key collection 230 // no-op for in-process. GC will handle key collection
231 } 231 }
232 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698