contexts: fix signature of overridden function

The new version of Clang emits errors on this code, since the function
being overridden returns a `const keymaster_algorithm_t*`, but the
overriding function specifies `keymaster_algorithm_t*`.

BUG=b:407993702
TEST=FEATURES=test emerge-brya arc-keymint

Change-Id: Ic7d29a77d6e27018240ed6c9df1c31a01301804c
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/keymaster/+/6427205
Commit-Queue: George Burgess <[email protected]>
Reviewed-by: Vaibhav Raheja <[email protected]>
Tested-by: George Burgess <[email protected]>
diff --git a/contexts/pure_soft_keymaster_context.cpp b/contexts/pure_soft_keymaster_context.cpp
index 937238b..562f25c 100644
--- a/contexts/pure_soft_keymaster_context.cpp
+++ b/contexts/pure_soft_keymaster_context.cpp
@@ -157,10 +157,10 @@
     }
 }
 
-static keymaster_algorithm_t supported_algorithms[] = {KM_ALGORITHM_RSA, KM_ALGORITHM_EC,
-                                                       KM_ALGORITHM_AES, KM_ALGORITHM_HMAC};
+const static keymaster_algorithm_t supported_algorithms[] = {
+  KM_ALGORITHM_RSA, KM_ALGORITHM_EC, KM_ALGORITHM_AES, KM_ALGORITHM_HMAC};
 
-keymaster_algorithm_t*
+const keymaster_algorithm_t*
 PureSoftKeymasterContext::GetSupportedAlgorithms(size_t* algorithms_count) const {
     *algorithms_count = array_length(supported_algorithms);
     return supported_algorithms;
diff --git a/include/keymaster/contexts/pure_soft_keymaster_context.h b/include/keymaster/contexts/pure_soft_keymaster_context.h
index 834a092..00c4584 100644
--- a/include/keymaster/contexts/pure_soft_keymaster_context.h
+++ b/include/keymaster/contexts/pure_soft_keymaster_context.h
@@ -62,7 +62,7 @@
     KeyFactory* GetKeyFactory(keymaster_algorithm_t algorithm) const override;
     OperationFactory* GetOperationFactory(keymaster_algorithm_t algorithm,
                                           keymaster_purpose_t purpose) const override;
-    keymaster_algorithm_t* GetSupportedAlgorithms(size_t* algorithms_count) const override;
+    const keymaster_algorithm_t* GetSupportedAlgorithms(size_t* algorithms_count) const override;
     keymaster_error_t UpgradeKeyBlob(const KeymasterKeyBlob& key_to_upgrade,
                                      const AuthorizationSet& upgrade_params,
                                      KeymasterKeyBlob* upgraded_key) const override;