Skip to content
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

Add API to convert hex string to bytes without using internal blob structure #2740

Closed
ttjsu-aws opened this issue Apr 19, 2021 · 1 comment
Closed

Comments

@ttjsu-aws
Copy link
Contributor

Problem:

Currently within s2n, we have the following API to convert a hex-encoded string to bytes:

int s2n_hex_string_to_bytes(const uint8_t *str, struct s2n_blob *blob);

https://github.com/aws/s2n-tls/blob/main/utils/s2n_blob.h#L47

However this API relies on internal s2n_blob structure and cannot be used within bin/s2nd.c and bin/s2nc.c.

Solution:

Add s2n APIs to convert hex string to bytes without using internal blob structure.

S2N_API int s2n_hex_str_to_bytes_length(const char *str, uint32_t *bytes_len);
S2N_API int s2n_hex_str_to_bytes(const char *str, uint8_t *bytes, uint32_t *bytes_len);
@zaherd
Copy link

zaherd commented May 6, 2021

Duplicate of #2759

@zaherd zaherd marked this as a duplicate of #2759 May 6, 2021
@zaherd zaherd closed this as completed May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants