1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef CHRE_PLATFORM_SHARED_AUTHENTICATION_H_ 18 #define CHRE_PLATFORM_SHARED_AUTHENTICATION_H_ 19 20 namespace chre { 21 22 /** 23 * Authenticates the signature of the provided binary. If not provided 24 * elsewhere by the platform, this method must ensure that nanoapps are signed 25 * appropriately and no corruption has occurred to the binary prior to being 26 * loaded. If this method succeeds, CHRE will assume the binary has the same 27 * execution privileges as the core framework itself. 28 * 29 * @param binary Pointer to the binary that should be authenticated. 30 * @param realBinaryStart A non-null pointer that, if this method succeeds, must 31 * be filled with the starting address of the raw binary after any headers 32 * used by the authentication code. This will be passed to the dynamic 33 * loader which will assume the starting address is a valid ELF binary. 34 * @return True if the binary passed authentication. 35 */ 36 bool authenticateBinary(void *binary, void **realBinaryStart); 37 38 } // namespace chre 39 40 #endif // CHRE_PLATFORM_SHARED_AUTHENTICATION_H_ 41