Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1aa7d0b authored by Alex Klyubin's avatar Alex Klyubin Committed by Android Git Automerger
Browse files

am 51884f0e: am 499126c4: Merge "Add Keymaster KM_ORIGIN_UNKNOWN constant."

* commit '51884f0e':
  Add Keymaster KM_ORIGIN_UNKNOWN constant.
parents 186fe7b1 51884f0e
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -118,9 +118,9 @@ public final class KeymasterDefs {
    public static final int KM_DIGEST_SHA_2_512 = 6;

    // Key origins.
    public static final int KM_ORIGIN_HARDWARE = 0;
    public static final int KM_ORIGIN_SOFTWARE = 1;
    public static final int KM_ORIGIN_GENERATED = 0;
    public static final int KM_ORIGIN_IMPORTED = 2;
    public static final int KM_ORIGIN_UNKNOWN = 3;

    // Key usability requirements.
    public static final int KM_BLOB_STANDALONE = 0;
+11 −1
Original line number Diff line number Diff line
@@ -225,15 +225,25 @@ public abstract class KeyStoreKeyProperties {
        /** Key was imported into AndroidKeyStore. */
        public static final int IMPORTED = 1 << 1;

        /**
         * Origin of the key is unknown. This can occur only for keys backed by an old TEE
         * implementation which does not record origin information.
         *
         * @hide
         */
        public static final int UNKNOWN = 1 << 2;

        /**
         * @hide
         */
        public static @OriginEnum int fromKeymaster(int origin) {
            switch (origin) {
                case KeymasterDefs.KM_ORIGIN_HARDWARE:
                case KeymasterDefs.KM_ORIGIN_GENERATED:
                    return GENERATED;
                case KeymasterDefs.KM_ORIGIN_IMPORTED:
                    return IMPORTED;
                case KeymasterDefs.KM_ORIGIN_UNKNOWN:
                    return UNKNOWN;
                default:
                    throw new IllegalArgumentException("Unknown origin: " + origin);
            }