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

Commit ffc308aa authored by Raphael Kim's avatar Raphael Kim Committed by Android (Google) Code Review
Browse files

Merge "Use hard-coded string to represent the ukey2 role when salting the...

Merge "Use hard-coded string to represent the ukey2 role when salting the authentication token." into aosp-main-future
parents 4d08179f 3ad5fd59
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -562,7 +562,8 @@ public class SecureChannel {
    private byte[] constructToken(D2DHandshakeContext.Role role, byte[] authValue)
            throws GeneralSecurityException {
        MessageDigest hash = MessageDigest.getInstance("SHA-256");
        byte[] roleUtf8 = role.name().getBytes(StandardCharsets.UTF_8);
        String roleName = role == Role.INITIATOR ? "Initiator" : "Responder";
        byte[] roleUtf8 = roleName.getBytes(StandardCharsets.UTF_8);
        int tokenLength = roleUtf8.length + authValue.length;
        return hash.digest(ByteBuffer.allocate(tokenLength)
                .put(roleUtf8)