Another refactor, deleting AbstractFactoryRegistry.
I should have known better than to make these singletons to begin
with. Globals create problems. This undoes that mistake.
Change-Id: Idf61d5f72e3c34b5c4ddb27cc94b05f506561743
diff --git a/key.h b/key.h
index 0eb1539..c0dc14e 100644
--- a/key.h
+++ b/key.h
@@ -17,16 +17,17 @@
#ifndef SYSTEM_KEYMASTER_KEY_H_
#define SYSTEM_KEYMASTER_KEY_H_
+#include <UniquePtr.h>
+
#include <hardware/keymaster_defs.h>
#include <keymaster/authorization_set.h>
-#include <keymaster/logger.h>
-
-#include "abstract_factory_registry.h"
namespace keymaster {
class Key;
class KeymasterContext;
+class OperationFactory;
+struct KeymasterKeyBlob;
/**
* KeyFactory is a abstraction whose subclasses know how to construct a specific subclass of Key.
@@ -37,36 +38,33 @@
KeyFactory(const KeymasterContext* context) : context_(context) {}
virtual ~KeyFactory() {}
- // Required for registry
- typedef keymaster_algorithm_t KeyType;
- virtual keymaster_algorithm_t registry_key() const = 0;
-
// Factory methods.
virtual keymaster_error_t GenerateKey(const AuthorizationSet& key_description,
KeymasterKeyBlob* key_blob, AuthorizationSet* hw_enforced,
- AuthorizationSet* sw_enforced) = 0;
+ AuthorizationSet* sw_enforced) const = 0;
virtual keymaster_error_t ImportKey(const AuthorizationSet& key_description,
keymaster_key_format_t input_key_material_format,
const KeymasterKeyBlob& input_key_material,
KeymasterKeyBlob* output_key_blob,
AuthorizationSet* hw_enforced,
- AuthorizationSet* sw_enforced) = 0;
+ AuthorizationSet* sw_enforced) const = 0;
virtual keymaster_error_t LoadKey(const KeymasterKeyBlob& key_material,
const AuthorizationSet& hw_enforced,
- const AuthorizationSet& sw_enforced, UniquePtr<Key>* key) = 0;
+ const AuthorizationSet& sw_enforced,
+ UniquePtr<Key>* key) const = 0;
+
+ virtual OperationFactory* GetOperationFactory(keymaster_purpose_t purpose) const = 0;
// Informational methods.
- virtual const keymaster_key_format_t* SupportedImportFormats(size_t* format_count) = 0;
- virtual const keymaster_key_format_t* SupportedExportFormats(size_t* format_count) = 0;
+ virtual const keymaster_key_format_t* SupportedImportFormats(size_t* format_count) const = 0;
+ virtual const keymaster_key_format_t* SupportedExportFormats(size_t* format_count) const = 0;
protected:
const KeymasterContext* context_;
};
-typedef AbstractFactoryRegistry<KeyFactory> KeyFactoryRegistry;
-
class KeyBlob;
class Operation;
class UnencryptedKeyBlob;