Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / android / legacy_openssl.h
blobe87413570ee58d6cf6038c1e18da46def8c374ab
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_ANDROID_LEGACY_OPENSSL_H
6 #define NET_ANDROID_LEGACY_OPENSSL_H
8 // This file contains a replica of the Android system OpenSSL ABI shipped in
9 // Android 4.1.x (API level 16). The ABI may not necessarily be compatible with
10 // the copy of OpenSSL shipped in Chromium. This is used to implement
11 // RSA_private_encrypt in one of the legacy client auth codepaths.
13 // See https://android.googlesource.com/platform/external/openssl/+/android-4.1.2_r2.1
15 namespace net {
16 namespace android {
18 enum {
19 ANDROID_EVP_PKEY_RSA = 6,
22 enum {
23 ANDROID_RSA_PKCS1_PADDING = 1,
24 ANDROID_RSA_SSLV23_PADDING = 2,
25 ANDROID_RSA_NO_PADDING = 3,
26 ANDROID_RSA_PKCS1_OAEP_PADDING = 4,
27 ANDROID_X931_PADDING = 5,
28 ANDROID_PKCS1_PSS_PADDING = 6,
31 struct AndroidEVP_PKEY_ASN1_METHOD;
32 struct AndroidRSA_METHOD;
33 struct AndroidSTACK;
35 struct AndroidCRYPTO_EX_DATA {
36 AndroidSTACK* sk;
37 int dummy;
40 struct AndroidENGINE {
41 const char* id;
42 // Remaining fields intentionally omitted.
45 struct AndroidRSA {
46 int pad;
47 long version;
48 const AndroidRSA_METHOD* meth;
49 AndroidENGINE* engine;
50 // Remaining fields intentionally omitted.
53 struct AndroidRSA_METHOD {
54 const char* name;
55 int (*rsa_pub_enc)(int flen,
56 const unsigned char* from,
57 unsigned char* to,
58 AndroidRSA* rsa,
59 int padding);
60 int (*rsa_pub_dec)(int flen,
61 const unsigned char* from,
62 unsigned char* to,
63 AndroidRSA* rsa,
64 int padding);
65 int (*rsa_priv_enc)(int flen,
66 const unsigned char* from,
67 unsigned char* to,
68 AndroidRSA* rsa,
69 int padding);
70 int (*rsa_priv_dec)(int flen,
71 const unsigned char* from,
72 unsigned char* to,
73 AndroidRSA* rsa,
74 int padding);
75 // Remaining fields intentionally omitted.
78 struct AndroidEVP_PKEY {
79 int type;
80 int save_type;
81 // Note: this value must NOT be modified using Chromium's CRYPTO_add
82 // function. That may not necessarily use the same locking implementation as
83 // system OpenSSL.
84 int references;
85 const AndroidEVP_PKEY_ASN1_METHOD* ameth;
86 AndroidENGINE* engine;
87 union {
88 char* ptr;
89 AndroidRSA* rsa;
90 } pkey;
91 int save_parameters;
92 AndroidSTACK* attributes;
95 } // namespace android
96 } // namespace net
98 #endif // NET_ANDROID_LEGACY_OPENSSL_H