/src/openssl/include/internal/to_hex.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. |
3 | | * |
4 | | * Licensed under the Apache License 2.0 (the "License"). You may not use |
5 | | * this file except in compliance with the License. You can obtain a copy |
6 | | * in the file LICENSE in the source distribution or at |
7 | | * https://www.openssl.org/source/license.html |
8 | | */ |
9 | | |
10 | | #ifndef OSSL_INTERNAL_TO_HEX_H |
11 | | # define OSSL_INTERNAL_TO_HEX_H |
12 | | # pragma once |
13 | | |
14 | | static ossl_inline size_t to_hex(char *buf, uint8_t n, const char hexdig[17]) |
15 | 0 | { |
16 | 0 | *buf++ = hexdig[(n >> 4) & 0xf]; |
17 | 0 | *buf = hexdig[n & 0xf]; |
18 | 0 | return 2; |
19 | 0 | } |
20 | | |
21 | | static ossl_inline size_t ossl_to_lowerhex(char *buf, uint8_t n) |
22 | 0 | { |
23 | 0 | static const char hexdig[] = "0123456789abcdef"; |
24 | 0 |
|
25 | 0 | return to_hex(buf, n, hexdig); |
26 | 0 | } |
27 | | #endif |