blob: 434dc1808054a96a4abd4764b811591305e03baf [file] [log] [blame]
[email protected]eeff8532014-07-11 22:07:591// 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.
4
bnc3698b0a02016-12-09 23:36:505#ifndef NET_ANDROID_LEGACY_OPENSSL_H_
6#define NET_ANDROID_LEGACY_OPENSSL_H_
[email protected]eeff8532014-07-11 22:07:597
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.
12//
13// See https://android.googlesource.com/platform/external/openssl/+/android-4.1.2_r2.1
14
15namespace net {
16namespace android {
17
18enum {
19 ANDROID_EVP_PKEY_RSA = 6,
20};
21
22enum {
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,
29};
30
31struct AndroidEVP_PKEY_ASN1_METHOD;
32struct AndroidRSA_METHOD;
33struct AndroidSTACK;
34
35struct AndroidCRYPTO_EX_DATA {
36 AndroidSTACK* sk;
37 int dummy;
38};
39
40struct AndroidENGINE {
41 const char* id;
42 // Remaining fields intentionally omitted.
43};
44
45struct AndroidRSA {
46 int pad;
47 long version;
48 const AndroidRSA_METHOD* meth;
49 AndroidENGINE* engine;
50 // Remaining fields intentionally omitted.
51};
52
53struct 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.
76};
77
78struct AndroidEVP_PKEY {
79 int type;
80 int save_type;
davidben8a254d02016-04-06 19:36:1281 // Note: this value is protected by threading functions in the Android system
82 // OpenSSL. It should not be accessed or modified directly.
[email protected]eeff8532014-07-11 22:07:5983 int references;
84 const AndroidEVP_PKEY_ASN1_METHOD* ameth;
85 AndroidENGINE* engine;
86 union {
87 char* ptr;
88 AndroidRSA* rsa;
89 } pkey;
90 int save_parameters;
91 AndroidSTACK* attributes;
92};
93
94} // namespace android
95} // namespace net
96
bnc3698b0a02016-12-09 23:36:5097#endif // NET_ANDROID_LEGACY_OPENSSL_H_