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

Commit 6cfbd96e authored by Raphael Kim's avatar Raphael Kim Committed by Automerger Merge Worker
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 am: ffc308aa am: 12db8972

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24827551



Change-Id: Ic0fcd6c61e235d0b84122d16bd84387c3e66ed0e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 58829717 12db8972
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -562,7 +562,8 @@ public class SecureChannel {
    private byte[] constructToken(D2DHandshakeContext.Role role, byte[] authValue)
    private byte[] constructToken(D2DHandshakeContext.Role role, byte[] authValue)
            throws GeneralSecurityException {
            throws GeneralSecurityException {
        MessageDigest hash = MessageDigest.getInstance("SHA-256");
        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;
        int tokenLength = roleUtf8.length + authValue.length;
        return hash.digest(ByteBuffer.allocate(tokenLength)
        return hash.digest(ByteBuffer.allocate(tokenLength)
                .put(roleUtf8)
                .put(roleUtf8)