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

Commit c217adaf authored by Chad Brubaker's avatar Chad Brubaker Committed by Android Git Automerger
Browse files

am 9db6e4d7: am 5aeb0853: Merge "Enforce tag types in KeymasterArgument classes"

* commit '9db6e4d7':
  Enforce tag types in KeymasterArgument classes
parents 46c95313 9db6e4d7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27,6 +27,13 @@ class KeymasterBlobArgument extends KeymasterArgument {

    public KeymasterBlobArgument(int tag, byte[] blob) {
        super(tag);
        switch (KeymasterDefs.getTagType(tag)) {
            case KeymasterDefs.KM_BIGNUM:
            case KeymasterDefs.KM_BYTES:
                break; // OK.
            default:
                throw new IllegalArgumentException("Bad blob tag " + tag);
        }
        this.blob = blob;
    }

+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ class KeymasterBooleanArgument extends KeymasterArgument {

    public KeymasterBooleanArgument(int tag) {
        super(tag);
        switch (KeymasterDefs.getTagType(tag)) {
            case KeymasterDefs.KM_BOOL:
                break; // OK.
            default:
                throw new IllegalArgumentException("Bad bool tag " + tag);
        }
    }

    public KeymasterBooleanArgument(int tag, Parcel in) {
+6 −0
Original line number Diff line number Diff line
@@ -29,6 +29,12 @@ class KeymasterDateArgument extends KeymasterArgument {

    public KeymasterDateArgument(int tag, Date date) {
        super(tag);
        switch (KeymasterDefs.getTagType(tag)) {
            case KeymasterDefs.KM_DATE:
                break; // OK.
            default:
                throw new IllegalArgumentException("Bad date tag " + tag);
        }
        this.date = date;
    }

+9 −0
Original line number Diff line number Diff line
@@ -27,6 +27,15 @@ class KeymasterIntArgument extends KeymasterArgument {

    public KeymasterIntArgument(int tag, int value) {
        super(tag);
        switch (KeymasterDefs.getTagType(tag)) {
            case KeymasterDefs.KM_INT:
            case KeymasterDefs.KM_INT_REP:
            case KeymasterDefs.KM_ENUM:
            case KeymasterDefs.KM_ENUM_REP:
                break; // OK.
            default:
                throw new IllegalArgumentException("Bad int tag " + tag);
        }
        this.value = value;
    }

+6 −0
Original line number Diff line number Diff line
@@ -27,6 +27,12 @@ class KeymasterLongArgument extends KeymasterArgument {

    public KeymasterLongArgument(int tag, long value) {
        super(tag);
        switch (KeymasterDefs.getTagType(tag)) {
            case KeymasterDefs.KM_LONG:
                break; // OK.
            default:
                throw new IllegalArgumentException("Bad long tag " + tag);
        }
        this.value = value;
    }