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

Unified Diff: net/android/keystore.h

Issue 365503007: Insulate the legacy Android client auth code from OpenSSL ABI changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yfriedman comments Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: net/android/keystore.h
diff --git a/net/android/keystore.h b/net/android/keystore.h
index ac3babe2a2a5b23605872c078864d124911a187b..37fe0374e06ab78bd5541c198633d9a75d6bf1ff 100644
--- a/net/android/keystore.h
+++ b/net/android/keystore.h
@@ -10,19 +10,19 @@
#include <string>
#include <vector>
+#include "base/android/scoped_java_ref.h"
#include "base/basictypes.h"
#include "base/strings/string_piece.h"
#include "net/base/net_export.h"
#include "net/ssl/ssl_client_cert_type.h"
-// Avoid including <openssl/evp.h> here.
-typedef struct evp_pkey_st EVP_PKEY;
-
// Misc functions to access the Android platform KeyStore.
namespace net {
namespace android {
+struct AndroidEVP_PKEY;
+
// Define a list of constants describing private key types. The
// values are shared with Java through org.chromium.net.PrivateKeyType.
// Example: PRIVATE_KEY_TYPE_RSA.
@@ -93,20 +93,28 @@ NET_EXPORT bool RawSignDigestWithPrivateKey(
// on error.
NET_EXPORT PrivateKeyType GetPrivateKeyType(jobject private_key);
-// Returns a handle to the system EVP_PKEY object used to back a given
-// private_key object. This must *only* be used for RSA private keys
-// on Android < 4.2. Technically, this is only guaranteed to work if
-// the system image contains a vanilla implementation of the Java
-// API frameworks based on Harmony + OpenSSL.
+// Returns a handle to the system AndroidEVP_PKEY object used to back a given
+// private_key object. This must *only* be used for RSA private keys on Android
+// < 4.2. Technically, this is only guaranteed to work if the system image
+// contains a vanilla implementation of the Java API frameworks based on Harmony
+// + OpenSSL.
//
// |private_key| is a JNI reference for the private key.
-// Returns an EVP_PKEY* handle, or NULL in case of error.
+// Returns an AndroidEVP_PKEY* handle, or NULL in case of error.
//
// Note: Despite its name and return type, this function doesn't know
// anything about OpenSSL, it just type-casts a system pointer that
// is passed as an int through JNI. As such, it never increments
// the returned key's reference count.
-EVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(jobject private_key);
+AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(jobject private_key);
+
+// Returns a JNI reference to the OpenSSLEngine object which used to back a
agl 2014/07/10 16:33:44 verb needed after "which".
davidben 2014/07/10 21:47:07 Done.
+// given private_key object. This must *only* be used for RSA private keys
+// on Android < 4.2. Technically, this is only guaranteed to work if
+// the system image contains a vanilla implementation of the Java
+// API frameworks based on Harmony + OpenSSL.
+base::android::ScopedJavaLocalRef<jobject> GetOpenSSLEngineForPrivateKey(
+ jobject private_key);
NET_EXPORT void ReleaseKey(jobject private_key);

Powered by Google App Engine
This is Rietveld 408576698