Skip to content

Correct handling of ed25519 keys #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions common/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,20 @@ bool read_private_key(uint8_t *buf, size_t len, yh_algorithm *algo,

EVP_PKEY_free(pkey);

if (hash_bytes(bytes, out_len, _SHA512, bytes, bytes_len) == false) {
return false;
}

bytes[0] &= 248;
bytes[31] &= 127;
bytes[31] |= 64;

for (uint8_t i = 0; i < 16; i++) {
uint8_t tmp = bytes[i];
bytes[i] = bytes[31 - i];
bytes[31 - i] = tmp;
}

if (hash_bytes(bytes, out_len, _SHA512, bytes, bytes_len) == false) {
return false;
}

*bytes_len += public_key_len;
#endif
}
Expand Down