# std.crypto.tls: fix x25519_ml_kem768 key share · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/7afb2777250a251a065b8a970eb7f14e2d5b5ce2)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 7afb2777250a251a065b8a970eb7f14e2d5b5ce2

Requested commit: 7afb2777250a251a065b8a970eb7f14e2d5b5ce2

Commit: 7afb2777250a251a065b8a970eb7f14e2d5b5ce2

Tree: 90a778fca9e850330aa238748b7d830ee36a9127

Author: Jacob Young

Committer: Jacob Young

## Message

```
std.crypto.tls: fix x25519_ml_kem768 key share

This is mostly nfc cleanup as I was bisecting the client hello to find
the problematic part, and the only bug fix ended up being

    key_share.x25519_kp.public_key ++
    key_share.ml_kem768_kp.public_key.toBytes()

to

    key_share.ml_kem768_kp.public_key.toBytes() ++
    key_share.x25519_kp.public_key)

and the same swap in `KeyShare.exchange` as per some random blog that
says "a hybrid keyshare, constructed by concatenating the public KEM key
with the public X25519 key".  I also note that based on the same blog
post, there was a draft version of this method that indeed had these
values swapped, and that used to be supported by this code, but it was
not properly fixed up when this code was updated from the draft spec.

Closes #21747

```

## Parents

- [7f20c78c95d54e7fb0958693a9df2dee40dd99d6](https://git.cafe/gitcafe/zig/commit/7f20c78c95d54e7fb0958693a9df2dee40dd99d6?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/7afb2777250a251a065b8a970eb7f14e2d5b5ce2?format=markdown)
