1 /* 2 * Copyright 2018 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 REMOTE_KEYMASTER_H_ 18 #define REMOTE_KEYMASTER_H_ 19 20 #include <keymaster/android_keymaster_messages.h> 21 22 #include "common/libs/security/keymaster_channel.h" 23 24 namespace keymaster { 25 26 class RemoteKeymaster { 27 private: 28 cuttlefish::KeymasterChannel* channel_; 29 30 void ForwardCommand( 31 AndroidKeymasterCommand command, const Serializable& req, KeymasterResponse* rsp); 32 public: 33 RemoteKeymaster(cuttlefish::KeymasterChannel*); 34 ~RemoteKeymaster(); 35 bool Initialize(); 36 void GetVersion(const GetVersionRequest& request, GetVersionResponse* response); 37 void SupportedAlgorithms(const SupportedAlgorithmsRequest& request, 38 SupportedAlgorithmsResponse* response); 39 void SupportedBlockModes(const SupportedBlockModesRequest& request, 40 SupportedBlockModesResponse* response); 41 void SupportedPaddingModes(const SupportedPaddingModesRequest& request, 42 SupportedPaddingModesResponse* response); 43 void SupportedDigests(const SupportedDigestsRequest& request, 44 SupportedDigestsResponse* response); 45 void SupportedImportFormats(const SupportedImportFormatsRequest& request, 46 SupportedImportFormatsResponse* response); 47 void SupportedExportFormats(const SupportedExportFormatsRequest& request, 48 SupportedExportFormatsResponse* response); 49 void AddRngEntropy(const AddEntropyRequest& request, AddEntropyResponse* response); 50 void Configure(const ConfigureRequest& request, ConfigureResponse* response); 51 void GenerateKey(const GenerateKeyRequest& request, GenerateKeyResponse* response); 52 void GetKeyCharacteristics(const GetKeyCharacteristicsRequest& request, 53 GetKeyCharacteristicsResponse* response); 54 void ImportKey(const ImportKeyRequest& request, ImportKeyResponse* response); 55 void ImportWrappedKey(const ImportWrappedKeyRequest& request, 56 ImportWrappedKeyResponse* response); 57 void ExportKey(const ExportKeyRequest& request, ExportKeyResponse* response); 58 void AttestKey(const AttestKeyRequest& request, AttestKeyResponse* response); 59 void UpgradeKey(const UpgradeKeyRequest& request, UpgradeKeyResponse* response); 60 void DeleteKey(const DeleteKeyRequest& request, DeleteKeyResponse* response); 61 void DeleteAllKeys(const DeleteAllKeysRequest& request, DeleteAllKeysResponse* response); 62 void BeginOperation(const BeginOperationRequest& request, BeginOperationResponse* response); 63 void UpdateOperation(const UpdateOperationRequest& request, UpdateOperationResponse* response); 64 void FinishOperation(const FinishOperationRequest& request, FinishOperationResponse* response); 65 void AbortOperation(const AbortOperationRequest& request, AbortOperationResponse* response); 66 GetHmacSharingParametersResponse GetHmacSharingParameters(); 67 ComputeSharedHmacResponse ComputeSharedHmac(const ComputeSharedHmacRequest& request); 68 VerifyAuthorizationResponse VerifyAuthorization(const VerifyAuthorizationRequest& request); 69 DeviceLockedResponse DeviceLocked(const DeviceLockedRequest& request); 70 EarlyBootEndedResponse EarlyBootEnded(); 71 }; 72 73 } // namespace keymaster 74 75 #endif // REMOTE_KEYMASTER_H_ 76