diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 14:48:57 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-06-21 14:48:57 +0000 |
commit | 5d0d61d04be09c2d07494aa4e6a05ce7fd9ef436 (patch) | |
tree | f7819440046e4556adeb2aa7070035cb19c2b962 | |
parent | 0b785820a0a0e12c006d9edd829080f5dff33f6f (diff) | |
parent | 42c9a8b6aaece2868a7f23c36278f7a51f856778 (diff) | |
download | generic-android12-mainline-extservices-release.tar.gz |
Snap for 7478067 from 42c9a8b6aaece2868a7f23c36278f7a51f856778 to mainline-extservices-releaseandroid-mainline-12.0.0_r9android-mainline-12.0.0_r87android-mainline-12.0.0_r72android-mainline-12.0.0_r44android-mainline-12.0.0_r27android-mainline-12.0.0_r117android-mainline-12.0.0_r102android12-mainline-extservices-release
Change-Id: Iafa06927a72554f94ee49fdf6f2def983fe97ae2
32 files changed, 602 insertions, 244 deletions
@@ -14,6 +14,36 @@ // limitations under the License. // +package { + default_applicable_licenses: ["external_nos_host_generic_license"], +} + +// Added automatically by a large-scale-change that took the approach of +// 'apply every license found to every target'. While this makes sure we respect +// every license restriction, it may not be entirely correct. +// +// e.g. GPL in an MIT project might only apply to the contrib/ directory. +// +// Please consider splitting the single license below into multiple licenses, +// taking care not to lose any license_kind information, and overriding the +// default license using the 'licenses: [...]' property on targets as needed. +// +// For unused files, consider creating a 'fileGroup' with "//visibility:private" +// to attach the license to, and including a comment whether the files may be +// used in the current project. +// See: http://go/android-license-faq +license { + name: "external_nos_host_generic_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + "SPDX-license-identifier-BSD", + ], + license_text: [ + "LICENSE", + ], +} + cc_library_headers { name: "nos_headers", defaults: ["nos_cc_host_supported_defaults"], @@ -83,6 +113,32 @@ cc_library_static { ], } +// A special target to be statically linkeed into fastboot hal. +cc_library_static { + name: "libnos_for_fastboot", + recovery: true, + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wno-zero-length-array", + ], + export_include_dirs: [ + "nugget/include", + "libnos/include", + "libnos_datagram/include", + "libnos_transport/include", + ], + srcs: [ + "libnos/debug.cpp", + "libnos_transport/transport.c", + "libnos_transport/crc16.c", + ], + static_libs: [ + "libbase", + ], +} + // A special target to be statically linkeed into recovery which is a system // (not vendor) component. cc_library_static { @@ -101,6 +157,24 @@ cc_library_static { ], } +// A special target to be statically linkeed into fastboot hal. +cc_library_static { + name: "libnos_citadel_for_fastboot", + recovery: true, + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + srcs: [ + ":libnos_client", + "libnos_datagram/citadel.c", + ], + static_libs: [ + "libnos_for_fastboot", + ], +} + // Language and vendor related defaults cc_defaults { name: "nos_cc_defaults", @@ -110,6 +184,7 @@ cc_defaults { "-Wall", "-Wextra", "-Werror", + "-Wno-gnu-zero-variadic-macro-arguments", "-Wno-zero-length-array", ], conlyflags: [ @@ -1,177 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/libnos/Android.bp b/libnos/Android.bp index 49c5385..f68df27 100644 --- a/libnos/Android.bp +++ b/libnos/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + cc_library { name: "libnos", srcs: [ diff --git a/libnos/BUILD b/libnos/BUILD index c2c53c4..a03ec8f 100644 --- a/libnos/BUILD +++ b/libnos/BUILD @@ -20,3 +20,22 @@ cc_library( "//host/generic/libnos_transport", ], ) + +cc_library( + name = "libnos_debuggable", + srcs = [ + "NuggetClientDebuggable.cpp", + ], + hdrs = [ + "include/nos/NuggetClient.h", + "include/nos/NuggetClientDebuggable.h", + ], + includes = [ + "include", + ], + visibility = ["//visibility:public"], + deps = [ + "//host/generic:nos_headers", + "//host/generic/libnos", + ], +) diff --git a/libnos/NuggetClient.cpp b/libnos/NuggetClient.cpp index 3f4682d..c361463 100644 --- a/libnos/NuggetClient.cpp +++ b/libnos/NuggetClient.cpp @@ -15,26 +15,21 @@ */ #include <nos/NuggetClient.h> - #include <limits> - #include <nos/transport.h> - #include <application.h> namespace nos { -NuggetClient::NuggetClient() - : NuggetClient("") { +NuggetClient::NuggetClient(const std::string& name) + : device_name_(name), open_(false) { } -NuggetClient::NuggetClient(const std::string& device_name) - : device_name_(device_name), open_(false) { +NuggetClient::NuggetClient(const char* name, uint32_t config) + : device_name_(name ? name : ""), open_(false) { + device_ = { .config = config }; } -NuggetClient::NuggetClient(const char* device_name) - : device_name_(device_name ? device_name : ""), open_(false) {} - NuggetClient::~NuggetClient() { Close(); } @@ -89,6 +84,14 @@ uint32_t NuggetClient::CallApp(uint32_t appId, uint16_t arg, return status_code; } +uint32_t NuggetClient::Reset() const { + + if (!open_) + return APP_ERROR_NOT_READY; + + return device_.ops.reset(device_.ctx); +} + nos_device* NuggetClient::Device() { return open_ ? &device_ : nullptr; } diff --git a/libnos/NuggetClientDebuggable.cpp b/libnos/NuggetClientDebuggable.cpp new file mode 100644 index 0000000..e4a087d --- /dev/null +++ b/libnos/NuggetClientDebuggable.cpp @@ -0,0 +1,69 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <nos/NuggetClientDebuggable.h> +#include <limits> +#include <nos/transport.h> +#include <application.h> + +namespace nos { + +NuggetClientDebuggable::NuggetClientDebuggable( + const char* name, uint32_t config, + request_cb_t req_fn, response_cb_t resp_fn) + : NuggetClient(name, config), + request_cb_(req_fn), response_cb_(resp_fn) {} + +uint32_t NuggetClientDebuggable::CallApp(uint32_t appId, uint16_t arg, + const std::vector<uint8_t>& request, + std::vector<uint8_t>* response) { + if (!open_) { + return APP_ERROR_IO; + } + + if (request.size() > std::numeric_limits<uint32_t>::max()) { + return APP_ERROR_TOO_MUCH; + } + + const uint32_t requestSize = request.size(); + uint32_t replySize = 0; + uint8_t* replyData = nullptr; + + if (response != nullptr) { + response->resize(response->capacity()); + replySize = response->size(); + replyData = response->data(); + } + + if (request_cb_) { + (request_cb_)(request); + } + + uint32_t status_code = nos_call_application(&device_, appId, arg, + request.data(), requestSize, + replyData, &replySize); + + if (response != nullptr) { + response->resize(replySize); + if (response_cb_) { + (response_cb_)(status_code, *response); + } + } + + return status_code; +} + +} // namespace nos diff --git a/libnos/generator/Android.bp b/libnos/generator/Android.bp index 4ff1606..a7cc964 100644 --- a/libnos/generator/Android.bp +++ b/libnos/generator/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + cc_binary_host { name: "protoc-gen-nos-client-cpp", srcs: ["main.cpp"], diff --git a/libnos/generator/test/Android.bp b/libnos/generator/test/Android.bp index d854692..30287aa 100644 --- a/libnos/generator/test/Android.bp +++ b/libnos/generator/test/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + genrule { name: "nos_generator_test_service_genc++", out: ["Hello.client.cpp"], diff --git a/libnos/include/nos/NuggetClient.h b/libnos/include/nos/NuggetClient.h index f79b168..9484bd8 100644 --- a/libnos/include/nos/NuggetClient.h +++ b/libnos/include/nos/NuggetClient.h @@ -32,17 +32,13 @@ namespace nos { class NuggetClient : public NuggetClientInterface { public: /** - * Create a client for the default Nugget device. - */ - NuggetClient(); - - /** - * Create a client for the named Nugget device. + * Create a client for the named Nugget device * - * Passing an empty device name causes the default device to be selected. + * An empty device name causes the default device to be selected. + * An empty config uses default configurations. */ - NuggetClient(const std::string& device_name); - NuggetClient(const char* device_name); + NuggetClient(const std::string& name); + NuggetClient(const char* name = 0, uint32_t config = 0); ~NuggetClient() override; @@ -77,6 +73,11 @@ public: std::vector<uint8_t>* response) override; /** + * Reset the device. Use with caution; context may be lost. + */ + uint32_t Reset() const override; + + /** * Access the underlying device. * * NULL is returned if the connection to the device is not open. @@ -91,7 +92,7 @@ public: */ const std::string& DeviceName() const; -private: +protected: std::string device_name_; nos_device device_; bool open_; diff --git a/libnos/include/nos/NuggetClientDebuggable.h b/libnos/include/nos/NuggetClientDebuggable.h new file mode 100644 index 0000000..ff1f080 --- /dev/null +++ b/libnos/include/nos/NuggetClientDebuggable.h @@ -0,0 +1,55 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NOS_NUGGET_CLIENT_DEBUGGABLE_H +#define NOS_NUGGET_CLIENT_DEBUGGABLE_H + +#include <cstdint> +#include <string> +#include <vector> + +#include <nos/device.h> +#include <nos/NuggetClient.h> + +namespace nos { + +/** + * This adds some debug functions around NuggetClient::CallApp() + */ +class NuggetClientDebuggable : public NuggetClient { +public: + + using request_cb_t = std::function<void(const std::vector<uint8_t>&)>; + using response_cb_t = std::function<void(uint32_t, const std::vector<uint8_t>&)>; + + /* Need to pass the base constructor params up */ + NuggetClientDebuggable(const char* name = 0, uint32_t config = 0, + request_cb_t req_cb_ = 0, response_cb_t resp_cb_ = 0); + + /* We'll override this */ + uint32_t CallApp(uint32_t appId, uint16_t arg, + const std::vector<uint8_t>& request, + std::vector<uint8_t>* response) override; + + +private: + request_cb_t request_cb_; + response_cb_t response_cb_; +}; + +} // namespace nos + +#endif // NOS_NUGGET_CLIENT_DEBUGGABLE_H diff --git a/libnos/include/nos/NuggetClientInterface.h b/libnos/include/nos/NuggetClientInterface.h index f7db0d1..8d78185 100644 --- a/libnos/include/nos/NuggetClientInterface.h +++ b/libnos/include/nos/NuggetClientInterface.h @@ -47,7 +47,7 @@ public: virtual bool IsOpen() const = 0; /** - * Call into and app running on Nugget. + * Call into an app running on Nugget. * * @param app_id The ID of the app to call. * @param arg Argument to pass to the app. @@ -58,6 +58,10 @@ public: virtual uint32_t CallApp(uint32_t appId, uint16_t arg, const std::vector<uint8_t>& request, std::vector<uint8_t>* response) = 0; + /** + * Reset the device. Use with caution; context may be lost. + */ + virtual uint32_t Reset() const = 0; }; } // namespace nos diff --git a/libnos/test/Android.bp b/libnos/test/Android.bp index 0a06894..526b9eb 100644 --- a/libnos/test/Android.bp +++ b/libnos/test/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + cc_test_library { name: "libnos_mock", defaults: ["nos_cc_host_supported_defaults"], diff --git a/libnos/test/include/nos/MockNuggetClient.h b/libnos/test/include/nos/MockNuggetClient.h index 2c30832..48814c9 100644 --- a/libnos/test/include/nos/MockNuggetClient.h +++ b/libnos/test/include/nos/MockNuggetClient.h @@ -33,6 +33,7 @@ struct MockNuggetClient : public NuggetClientInterface { MOCK_METHOD4(CallApp, uint32_t(uint32_t, uint16_t, const std::vector<uint8_t>&, std::vector<uint8_t>*)); + MOCK_CONST_METHOD0(Reset, uint32_t()); }; } // namespace nos diff --git a/libnos_datagram/Android.bp b/libnos_datagram/Android.bp index 2a2b659..0176e00 100644 --- a/libnos_datagram/Android.bp +++ b/libnos_datagram/Android.bp @@ -14,6 +14,25 @@ // limitations under the License. // +package { + default_applicable_licenses: [ + "external_nos_host_generic_libnos_datagram_license", + ], +} + +// Added automatically by a large-scale-change +// See: http://go/android-license-faq +license { + name: "external_nos_host_generic_libnos_datagram_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + ], + license_text: [ + "NOTICE", + ], +} + cc_library { name: "libnos_datagram", defaults: ["nos_cc_host_supported_defaults"], diff --git a/libnos_datagram/include/nos/device.h b/libnos_datagram/include/nos/device.h index 5472156..2ba57e0 100644 --- a/libnos_datagram/include/nos/device.h +++ b/libnos_datagram/include/nos/device.h @@ -69,23 +69,12 @@ struct nos_device_ops { * The device must not be used after closing. */ void (*close)(void *ctx); - -#ifndef ANDROID - /** - * Get or Set a configuration value. These are opaque, implementation-specific - * values useful only for bringup and development. The defaults should be - * optimal for production use. - * - * Return 0 on success and a negative value on failure. - */ - int (*get_config)(void *ctx, uint32_t config_id, void *value); - int (*set_config)(void *ctx, uint32_t config_id, void *value); -#endif }; struct nos_device { void *ctx; struct nos_device_ops ops; + uint32_t config; }; /* diff --git a/libnos_transport/Android.bp b/libnos_transport/Android.bp index f9af019..1dd8992 100644 --- a/libnos_transport/Android.bp +++ b/libnos_transport/Android.bp @@ -14,6 +14,25 @@ // limitations under the License. // +package { + default_applicable_licenses: [ + "external_nos_host_generic_libnos_transport_license", + ], +} + +// Added automatically by a large-scale-change +// See: http://go/android-license-faq +license { + name: "external_nos_host_generic_libnos_transport_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-Apache-2.0", + ], + license_text: [ + "NOTICE", + ], +} + cc_library { name: "libnos_transport", srcs: [ diff --git a/libnos_transport/transport.c b/libnos_transport/transport.c index f7675da..85ba312 100644 --- a/libnos_transport/transport.c +++ b/libnos_transport/transport.c @@ -70,7 +70,7 @@ extern int usleep (uint32_t usec); * expect a reboot to take around 100ms but we'll keep trying for 300ms to leave * plenty of margin. */ -#define RETRY_COUNT 60 +#define RETRY_COUNT 240 #define RETRY_WAIT_TIME_US 5000 /* In case of CRC error, try to retransmit */ @@ -471,7 +471,7 @@ uint32_t nos_call_application(const struct nos_device *dev, return APP_ERROR_IO; } - NLOGD("Calling app %d with params 0x%04x", app_id, params); + NLOGD("Calling App %d with params 0x%04x", app_id, params); struct transport_status status; uint32_t status_code; @@ -501,7 +501,7 @@ uint32_t nos_call_application(const struct nos_device *dev, NLOGW("App %d request checksum error", app_id); } if (status_code == APP_ERROR_CHECKSUM) { - NLOGE("App %d equest checksum failed too many times", app_id); + NLOGE("App %d request checksum failed too many times", app_id); status_code = APP_ERROR_IO; } diff --git a/nugget/include/app_nugget.h b/nugget/include/app_nugget.h index 14191df..1ef9f31 100644 --- a/nugget/include/app_nugget.h +++ b/nugget/include/app_nugget.h @@ -264,6 +264,24 @@ enum nugget_ap_uart_passthru_cfg { #define NUGGET_PARAM_RDD_CFG 0x000e /* + * Enable/Disable the RDD SuzyQable Detection + * + * This always returns the current state of the RDD SuzyQable detection + * feature. + * + * The AP can request that the RDD SuzyQable detection to be disabled (0) or + * enabled (1). + * + * @param args 0 OR 1 + * @param arg_len 0 OR 1 byte + * @param reply current state (0 or 1) + * @param reply_len 1 byte + * + * @errors APP_ERROR_BOGUS_ARGS + */ + +#define NUGGET_PARAM_BOARD_ID 0x000f +/* * Set / Get Board ID * * This sets or gets the Board ID of the device. @@ -280,34 +298,120 @@ struct nugget_app_board_id { uint32_t flag; uint32_t inv; /* must equal ~type when setting */ } __packed; -#define NUGGET_PARAM_BOARD_ID 0x000f +#define NUGGET_PARAM_GET_EVENT_RECORD 0x0010 /* - * Enable/Disable the RDD SuzyQable Deteaction + * This retrieves one pending event_record (defined in citadel_events.h). + * If none are pending, it returns nothing. * - * This always returns the current state of the RDD SuezyQable detection - * feature. + * @param args <none> + * @param arg_len 0 + * @param reply struct event_record + * @param reply_len sizeof struct event_record OR 0 + */ + +#define NUGGET_PARAM_AP_IS_REBOOTING 0x0011 +/* + * This can be used to replace the GPIO signal for some boards, if the + * communication path is trusted. If not, it has no effect. * - * The AP can request that the RDD SuezyQable detection to be disabled (0) or - * enabled (1). + * @param args <none> + * @param arg_len 0 + * @param reply <none> + * @param reply_len 0 + */ + +#define FILE_ID_NUGGET_PERSIST 0 +#define NUGGET_PERSIST_VERSION_1 1 +struct nugget_persist_t { + uint8_t version; + uint8_t user_consent; + uint8_t reserved[2]; +}; + +enum nugget_sjtag_user_consent_cfg { + NUGGET_SJTAG_USER_CONSENT_DISALLOW, /* DISALLOW */ + NUGGET_SJTAG_USER_CONSENT_ALLOW, /* ALLOW */ + + NUGGET_SJTAG_USER_CONSENT_NUM_CFGS, +}; + +#define NUGGET_PARAM_SJTAG_USER_CONSENT 0x0012 +/* + * Set/Get the SJTAG USER CONSENT function * - * @param args 0 OR 1 - * @param arg_len 0 OR 1 byte - * @param reply 0 OR 1 current state + * This always returns the current state of the SJTAG USER CONSENT feature. + * + * @param args <none> OR enum nugget_sjtag_user_consent_cfg + * @param arg_len 0 OR 1 byte + * @param reply enum nugget_sjtag_user_consent_cfg * @param reply_len 1 byte * * @errors APP_ERROR_BOGUS_ARGS */ -#define NUGGET_PARAM_GET_EVENT_RECORD 0x0010 +enum nugget_sjtag_avb_boot_lock_result { + AVB_BOOT_LOCK_DISABLED, + AVB_BOOT_LOCK_ENABLED, + AVB_BOOT_LOCK_ERROR, +}; + +#define NUGGET_PARAM_SJTAG_ALLOW 0x0013 /* - * This retrieves one pending event_record (defined in citadel_events.h). - * If none are pending, it returns nothing. + * Get the SJTAG ALLOW + * + * This always returns the current state of the SJTAG ALLOW feature. + * + * @param args <none> + * @param arg_len 0 + * @param reply 0(DISALLOW) OR 1(ALLOW) + * @param reply_len 1 byte + * + * @errors APP_ERROR_BOGUS_ARGS + */ + +/* + * Persistent storage of arbitrary data, up to + * (FS_MAX_FILE_SIZE - sizeof(struct nugget_app_data)) bytes. + */ +struct nugget_app_storage { + uint32_t flags; /* TBD, use zero for now */ +#ifndef __cplusplus + uint8_t data[]; /* Zero or more bytes */ +#endif +} __packed; + +#define NUGGET_PARAM_STORAGE_WRITE 0x0014 +/* + * Write arbitrary data. + * + * The current storage is erased, then new data (if any) is saved. + * + * .flags meaning is not yet defined; for now it must be 0x00000000 + * Possible usage could restrict reading to the bootloader, + * erase data after N reads or reboots, etc. + * + * @param args struct nugget_app_storage + zero or more bytes + * @param arg_len To write: > sizeof(struct nugget_app_storage) + * To erase: <= sizeof(struct nugget_app_storage) + * @param reply <none> + * @param reply_len 0 + * + * @errors APP_ERROR_BOGUS_ARGS + */ +#define NUGGET_PARAM_STORAGE_READ 0x0015 +/* + * Read arbitrary data. + * + * On success, struct nugget_app_storage is returned, followed by zero + * or more bytes of .data * * @param args <none> * @param arg_len 0 - * @param reply struct event_record - * @param reply_len sizeof struct event_record OR 0 + * @param reply struct nugget_app_storage + zero or more bytes + * @param reply_len <varies> + * + * @errors APP_ERROR_BOGUS_ARGS */ /****************************************************************************/ @@ -352,10 +456,11 @@ enum nugget_app_selftest_cmd { /* * This struct is specific to Citadel and Nugget OS, but it's enough for the - * AP-side implementation to translate into the info required for the HAL - * structs. + * AP-side implementation to translate into the info required for the power + * stats service. */ -struct nugget_app_low_power_stats { +#define NUGGET_APP_LOW_POWER_STATS_MAGIC 0xC0DEACE1 +struct nugget_app_low_power_stats { /* version 1 */ /* All times in usecs */ uint64_t hard_reset_count; /* Cleared by power loss */ uint64_t time_since_hard_reset; @@ -368,6 +473,18 @@ struct nugget_app_low_power_stats { uint64_t time_spent_in_deep_sleep; uint64_t time_at_ap_reset; uint64_t time_at_ap_bootloader_done; + /* + * New fields for v1, used by factory tests. The caller can tell whether the + * firmare supports these fields by checking the v1_magic value. + */ + uint32_t v1_magic; /* NUGGET_APP_LOW_POWER_STATS_MAGIC */ + uint32_t temp; + struct { + unsigned int phone_on_l : 1; + unsigned int vol_up_l : 1; + unsigned int vol_dn_l : 1; + unsigned int _padding : 29; /* pad to 32 bits */ + } signals; } __packed; #define NUGGET_PARAM_GET_LOW_POWER_STATS 0x200 @@ -500,6 +617,21 @@ enum nugget_app_sleep_mode { * @param reply_len 0 */ +#define NUGGET_PARAM_TRIGGER_PIN 0xF005 +/** + * Get/Set trigger pin level + * + * This command asks GSC to set the level (0|1) of an otherwise unused GPIO, + * to signal external test equipment. + * + * @param args 0 OR 1 + * @param arg_len 0 OR 1 byte + * @param reply current state (0 or 1) + * @param reply_len 1 byte + * + * @errors APP_ERROR_BOGUS_ARGS + */ + #ifdef __cplusplus } #endif diff --git a/nugget/include/application.h b/nugget/include/application.h index ef70754..1d485c6 100644 --- a/nugget/include/application.h +++ b/nugget/include/application.h @@ -73,6 +73,7 @@ typedef const void * const __private; #define APP_ID_WEAVER 0x03 #define APP_ID_PROTOBUF 0x04 #define APP_ID_IDENTITY 0x05 +#define APP_ID_GSC_FACEAUTH 0x06 /* Fake apps used only for testing */ #define APP_ID_AVB_TEST 0x11 @@ -314,6 +315,7 @@ enum app_status { APP_ERROR_CHECKSUM, /* checksum failed, only used within protocol */ APP_ERROR_BUSY, /* the app is already working on a commnad */ APP_ERROR_TIMEOUT, /* the app took too long to respond */ + APP_ERROR_NOT_READY, /* some required condition is not satisfied */ /* more? */ /* diff --git a/nugget/include/citadel_events.h b/nugget/include/citadel_events.h index 02653b0..3e3a33e 100644 --- a/nugget/include/citadel_events.h +++ b/nugget/include/citadel_events.h @@ -66,6 +66,15 @@ enum event_id { EVENT_ALERT_V2 = 4, // Globalsec Alertv2 fired }; +/* + * Upgrade state definition. + */ +enum upgrade_state_def { + UPGRADE_SUCCESS = 0, + UPGRADE_PW_MISMATCH = 1, + UPGRADE_EN_FW_FAIL =2, +}; + /* Please do not change the size of this struct */ #define EVENT_RECORD_SIZE 64 struct event_record { @@ -85,6 +94,9 @@ struct event_record { uint32_t which1; } rebooted; struct { + uint32_t upgrade_state; + } upgraded; + struct { uint32_t alert_grp[4]; uint16_t camo_breaches[2]; uint16_t temp_min; diff --git a/nugget/include/flash_layout.h b/nugget/include/flash_layout.h index 13c00ef..e8edc9a 100644 --- a/nugget/include/flash_layout.h +++ b/nugget/include/flash_layout.h @@ -10,7 +10,7 @@ * The flash memory is implemented in two halves. The SoC bootrom will look for * a first-stage bootloader (aka "RO firmware") at the beginning of each of the * two halves and prefer the newer one if both are valid. The chosen bootloader - * also looks in each half of the flash for a valid application image (("RW + * also looks in each half of the flash for a valid application image ("RW * firmware"), so we have two possible RW images as well. The RO and RW images * are not tightly coupled, so either RO image can choose to boot either RW * image. RO images are provided by the SoC team, and can be updated separately @@ -35,4 +35,10 @@ #define DAUNTLESS_RW_A_MEM_OFF DAUNTLESS_RO_SIZE #define DAUNTLESS_RW_B_MEM_OFF (DAUNTLESS_FLASH_HALF + DAUNTLESS_RW_A_MEM_OFF) +/* + * Citadel reserves 0x4000 bytes (16K) for its RO firmware. Dauntless can vary, + * but the RW firmware will follow RO and be aligned on a 16K boundary. + */ +#define FLASH_RW_ALIGNMENT 0x4000 + #endif /* __CROS_EC_FLASH_LAYOUT_H */ diff --git a/nugget/proto/Android.bp b/nugget/proto/Android.bp index e507ad6..b9f1220 100644 --- a/nugget/proto/Android.bp +++ b/nugget/proto/Android.bp @@ -14,6 +14,16 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + // SPDX-license-identifier-BSD + default_applicable_licenses: ["external_nos_host_generic_license"], +} + cc_library { name: "libnosprotos", srcs: ["**/*.proto"], diff --git a/nugget/proto/nugget/app/avb/Android.bp b/nugget/proto/nugget/app/avb/Android.bp index 892a12a..136b9d5 100644 --- a/nugget/proto/nugget/app/avb/Android.bp +++ b/nugget/proto/nugget/app/avb/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + genrule { name: "nos_app_avb_service_genc++", out: ["Avb.client.cpp"], diff --git a/nugget/proto/nugget/app/identity/Android.bp b/nugget/proto/nugget/app/identity/Android.bp index d05f639..b65297a 100644 --- a/nugget/proto/nugget/app/identity/Android.bp +++ b/nugget/proto/nugget/app/identity/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + genrule { name: "nos_app_identity_service_genc++", out: ["Identity.client.cpp"], diff --git a/nugget/proto/nugget/app/identity/identity.options b/nugget/proto/nugget/app/identity/identity.options new file mode 100644 index 0000000..0939e93 --- /dev/null +++ b/nugget/proto/nugget/app/identity/identity.options @@ -0,0 +1,2 @@ +nugget.app.identity.ICsetAuthTokenRequest.mac max_size:32 +nugget.app.identity.ICsetAuthTokenRequest.verificationTokenMac max_size:32 diff --git a/nugget/proto/nugget/app/identity/identity.proto b/nugget/proto/nugget/app/identity/identity.proto index 96548c0..10500cb 100644 --- a/nugget/proto/nugget/app/identity/identity.proto +++ b/nugget/proto/nugget/app/identity/identity.proto @@ -34,6 +34,7 @@ service Identity { // RPCs for the Identity HAL rpc WICinitialize (WICinitializeRequest) returns (WICinitializeResponse); + rpc WICinitializeForUpdate (WICinitializeForUpdateRequest) returns (WICinitializeForUpdateResponse); rpc WICcreateCredentialKey (WICcreateCredentialKeyRequest) returns (WICcreateCredentialKeyResponse); rpc WICstartPersonalization (WICstartPersonalizationRequest) returns (WICstartPersonalizationResponse); rpc WICaddAccessControlProfile (WICaddAccessControlProfileRequest) returns (WICaddAccessControlProfileResponse); @@ -54,6 +55,7 @@ service Identity { rpc ICretrieveEntryValue (ICretrieveEntryValueRequest) returns (ICretrieveEntryValueResponse); rpc ICfinishRetrieval (ICfinishRetrievalRequest) returns (ICfinishRetrievalResponse); rpc ICdeleteCredential (ICdeleteCredentialRequest) returns (ICdeleteCredentialResponse); + rpc ICproveOwnership (ICproveOwnershipRequest) returns (ICproveOwnershipResponse); } // WICinitialize @@ -64,6 +66,17 @@ message WICinitializeResponse{ Result result = 1; } +// WICinitializeForUpdate +message WICinitializeForUpdateRequest{ + bool testCredential = 1; + bytes docType = 2; + bytes encryptedCredentialKeys = 3; +} + +message WICinitializeForUpdateResponse{ + Result result = 1; +} + // WICcreateCredentialKey message WICcreateCredentialKeyRequest{ } @@ -295,11 +308,25 @@ message ICfinishRetrievalResponse{ // ICdeleteCredential message ICdeleteCredentialRequest{ bytes docType = 1; - bool testCredential = 2; - uint32 proofOfDeletionCborSize =3; + bytes challenge = 2; + bool includeChallenge = 3; + uint32 proofOfDeletionCborSize = 4; } message ICdeleteCredentialResponse{ Result result = 1; bytes signatureOfToBeSigned = 2; +} + +// ICproveOwnership +message ICproveOwnershipRequest{ + bytes docType = 1; + bool testCredential = 2; + bytes challenge = 3; + uint32 proofOfOwnershipCborSize = 4; +} + +message ICproveOwnershipResponse{ + Result result = 1; + bytes signatureOfToBeSigned = 2; }
\ No newline at end of file diff --git a/nugget/proto/nugget/app/keymaster/Android.bp b/nugget/proto/nugget/app/keymaster/Android.bp index 241b05e..32e3479 100644 --- a/nugget/proto/nugget/app/keymaster/Android.bp +++ b/nugget/proto/nugget/app/keymaster/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + genrule { name: "nos_app_keymaster_service_genc++", out: ["Keymaster.client.cpp"], diff --git a/nugget/proto/nugget/app/keymaster/keymaster.options b/nugget/proto/nugget/app/keymaster/keymaster.options index c9105bd..4d99765 100644 --- a/nugget/proto/nugget/app/keymaster/keymaster.options +++ b/nugget/proto/nugget/app/keymaster/keymaster.options @@ -4,7 +4,7 @@ nugget.app.keymaster.ImportWrappedKeyRequest.masking_key max_size:32 nugget.app.keymaster.SetRootOfTrustRequest.digest max_size:32 nugget.app.keymaster.SetBootStateRequest.public_key max_size:32 nugget.app.keymaster.SetBootStateRequest.boot_hash max_size:32 -nugget.app.keymaster.ComputeSharedHmacRequest.hmac_sharing_params max_count:3 +nugget.app.keymaster.ComputeSharedHmacRequest.hmac_sharing_params max_count:10 nugget.app.keymaster.ComputeSharedHmacResponse.sharing_check max_size:32 nugget.app.keymaster.DTupHandshakeRequest.nonce_client max_size:32 nugget.app.keymaster.DTupHandshakeResponse.nonce_citadel max_size:32 @@ -13,8 +13,9 @@ nugget.app.keymaster.DTupFetchInputEventResponse.signature max_size:32 nugget.app.keymaster.GetBootInfoResponse.boot_key max_size:32 nugget.app.keymaster.GetBootInfoResponse.boot_hash max_size:32 nugget.app.keymaster.ProvisionPresharedSecretRequest.preshared_secret max_size:32 -nugget.app.keymaster.StartAttestKeyRequest.not_before max_size:13 -nugget.app.keymaster.StartAttestKeyRequest.not_after max_size:13 +nugget.app.keymaster.StartAttestKeyRequest.not_before max_size:15 +nugget.app.keymaster.StartAttestKeyRequest.not_after max_size:15 +nugget.app.keymaster.StartAttestKeyRequest.caller_issuer_subj_name max_size:64 nugget.app.keymaster.ProvisionPresharedSecretResponse.digest max_size:32 nugget.app.keymaster.ProvisionCertificatesRequest.cert_block max_size: 1024 -nugget.app.keymaster.ProvisionCertificatesRequest.digest max_size: 32
\ No newline at end of file +nugget.app.keymaster.ProvisionCertificatesRequest.digest max_size: 32 diff --git a/nugget/proto/nugget/app/keymaster/keymaster.proto b/nugget/proto/nugget/app/keymaster/keymaster.proto index e508c8e..e6fec75 100644 --- a/nugget/proto/nugget/app/keymaster/keymaster.proto +++ b/nugget/proto/nugget/app/keymaster/keymaster.proto @@ -210,8 +210,10 @@ message StartAttestKeyRequest { KeyParameters params = 2; uint32 attestation_app_id_len = 3; AttestationSelector selector = 4; - bytes not_before = 5; // strftime('%y%m%d%H%M%SZ') [13 octects] - bytes not_after = 6; // strftime('%y%m%d%H%M%SZ') [13 octects] + bytes not_before = 5; // strftime('%Y%m%d%H%M%SZ') [15 octects] + bytes not_after = 6; // strftime('%Y%m%d%H%M%SZ') [15 octects] + bytes caller_issuer_subj_name = 7; + KeyParameters caller_key_params = 8; } message StartAttestKeyResponse { ErrorCode error_code = 1; @@ -233,6 +235,8 @@ message ContinueAttestKeyResponse { // FinishAttestKeyRequest message FinishAttestKeyRequest { OperationHandle handle = 1; + KeyBlob caller_blob = 2; + KeyParameters caller_key_params = 3; } message FinishAttestKeyResponse { ErrorCode error_code = 1; @@ -538,9 +542,10 @@ message IdentityStartAttestKeyRequest { KeyParameters params = 2; uint32 attestation_app_id_len = 3; AttestationSelector selector = 4; - bytes not_before = 5; // strftime('%y%m%d%H%M%SZ') [13 octects] - bytes not_after = 6; // strftime('%y%m%d%H%M%SZ') [13 octects] + bytes not_before = 5; // strftime('%y%m%d%H%M%SZ') [15 octects] + bytes not_after = 6; // strftime('%y%m%d%H%M%SZ') [15 octects] uint64 creation_time_ms = 7; // Rough current time (ms since epoch). + bool use_km_attest_key = 8; } message IdentityStartAttestKeyResponse { ErrorCode error_code = 1; diff --git a/nugget/proto/nugget/app/keymaster/keymaster_defs.proto b/nugget/proto/nugget/app/keymaster/keymaster_defs.proto index 76f1a2f..da597b1 100644 --- a/nugget/proto/nugget/app/keymaster/keymaster_defs.proto +++ b/nugget/proto/nugget/app/keymaster/keymaster_defs.proto @@ -31,7 +31,7 @@ enum TagType { ULONG = 0x50000; /* 5 << 16 */ DATE = 0x60000; /* 6 << 16 */ BOOL = 0x70000; /* 7 << 16 */ - /* BIGNUM = 0x80000; 8 << 16 */ /* Unused. */ + BIGNUM_ = 0x80000; /* 8 << 16 */ BYTES = 0x90000; /* 9 << 16 */ ULONG_REP = 0xA0000; /* 10 << 16 */ }; @@ -51,6 +51,7 @@ enum Tag { RSA_PUBLIC_EXPONENT = 0x500c8; // (TagType:ULONG | 200) /* RESERVED: ECIES_SINGLE_HASH_MODE = 0x700c9; // (TagType:BOOL | 201) */ INCLUDE_UNIQUE_ID = 0x700ca; // (TagType:BOOL | 202) + RSA_OAEP_MGF_DIGEST = 0x200cb; // (TagType:ENUM_REP | 203) BLOB_USAGE_REQUIREMENTS = 0x1012d; // (TagType:ENUM | 301) BOOTLOADER_ONLY = 0x7012e; // (TagType:BOOL | 302) ROLLBACK_RESISTANCE = 0x7012f; // (TagType:BOOL | 303) @@ -61,6 +62,7 @@ enum Tag { USAGE_EXPIRE_DATETIME = 0x60192; // (TagType:DATE | 402) MIN_SECONDS_BETWEEN_OPS = 0x30193; // (TagType:UINT | 403) MAX_USES_PER_BOOT = 0x30194; // (TagType:UINT | 404) + USAGE_COUNT_LIMIT = 0x30195; // (TagType:UINT | 405) /* RESERVED: ALL_USERS = 0x701f4; // (TagType:BOOL | 500) */ USER_ID = 0x301f5; // (TagType:UINT | 501) USER_SECURE_ID = 0xa01f6; // (TagType:ULONG_REP | 502) @@ -102,7 +104,9 @@ enum Tag { /* RESERVED: AUTH_TOKEN = 0x903ea; // (TagType:BYTES | 1002) */ MAC_LENGTH = 0x303eb; // (TagType:UINT | 1003) RESET_SINCE_ID_ROTATION = 0x703ec; // (TagType:BOOL | 1004) - CONFIRMATION_TOKEN = 0x903ed;// (TagType:BYTES | 1005) + CONFIRMATION_TOKEN = 0x903ed; // (TagType:BYTES | 1005) + CERTIFICATE_SERIAL = 0x803ee; // (TagType:BIGNUM | 1006) + CERTIFICATE_SUBJECT = 0x903ef; // (TagType:BYTES | 1007) }; enum Algorithm { @@ -173,7 +177,9 @@ enum KeyPurpose { VERIFY = 3; /* RESERVED: DERIVE_KEY = 4; */ WRAP_KEY = 5; - PURPOSE_MAX = 6; + AGREE_KEY = 6; + ATTEST_KEY = 7; + PURPOSE_MAX = 8; }; enum ErrorCode { @@ -259,6 +265,8 @@ enum ErrorCode { ATTESTATION_IDS_NOT_PROVISIONED = 79; INVALID_OPERATION = 80; STORAGE_KEY_UNSUPPORTED = 81; + INCOMPATIBLE_MGF_DIGEST = 82; + UNSUPPORTED_MGF_DIGEST = 83; }; enum SecurityLevel { @@ -307,6 +315,8 @@ enum ChipFusing { FUSING_DVT = 1; FUSING_PVT = 2; // Strongbox gen v0 certs. FUSING_PVT_1 = 3; // Strongbox gen v1 certs. + FUSING_D_PVT = 4; // Dauntless gen v0 certs. + FUSING_D_PVT_1 = 5; // Dauntless gen v1 certs. } enum CertificateStatus { diff --git a/nugget/proto/nugget/app/keymaster/keymaster_types.proto b/nugget/proto/nugget/app/keymaster/keymaster_types.proto index 2689498..4a66d4e 100644 --- a/nugget/proto/nugget/app/keymaster/keymaster_types.proto +++ b/nugget/proto/nugget/app/keymaster/keymaster_types.proto @@ -108,6 +108,8 @@ enum AttestationSelector { ATTEST_TEST = 0; ATTEST_BATCH = 1; ATTEST_INDIVIDUAL = 2; + ATTEST_SELF = 3; + ATTEST_CALLER = 4; } message VigoKey { diff --git a/nugget/proto/nugget/app/weaver/Android.bp b/nugget/proto/nugget/app/weaver/Android.bp index 4d81059..6a1dbde 100644 --- a/nugget/proto/nugget/app/weaver/Android.bp +++ b/nugget/proto/nugget/app/weaver/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "external_nos_host_generic_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["external_nos_host_generic_license"], +} + genrule { name: "nos_app_weaver_service_genc++", out: ["Weaver.client.cpp"], |