1*60b67249SAndroid Build Coastguard Worker // Copyright 2020 Google LLC 2*60b67249SAndroid Build Coastguard Worker // 3*60b67249SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4*60b67249SAndroid Build Coastguard Worker // use this file except in compliance with the License. You may obtain a copy of 5*60b67249SAndroid Build Coastguard Worker // the License at 6*60b67249SAndroid Build Coastguard Worker // 7*60b67249SAndroid Build Coastguard Worker // https://www.apache.org/licenses/LICENSE-2.0 8*60b67249SAndroid Build Coastguard Worker // 9*60b67249SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software 10*60b67249SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11*60b67249SAndroid Build Coastguard Worker // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12*60b67249SAndroid Build Coastguard Worker // License for the specific language governing permissions and limitations under 13*60b67249SAndroid Build Coastguard Worker // the License. 14*60b67249SAndroid Build Coastguard Worker 15*60b67249SAndroid Build Coastguard Worker #ifndef DICE_UTILS_H_ 16*60b67249SAndroid Build Coastguard Worker #define DICE_UTILS_H_ 17*60b67249SAndroid Build Coastguard Worker 18*60b67249SAndroid Build Coastguard Worker #include <stddef.h> 19*60b67249SAndroid Build Coastguard Worker #include <stdint.h> 20*60b67249SAndroid Build Coastguard Worker 21*60b67249SAndroid Build Coastguard Worker #include "dice/dice.h" 22*60b67249SAndroid Build Coastguard Worker 23*60b67249SAndroid Build Coastguard Worker #ifdef __cplusplus 24*60b67249SAndroid Build Coastguard Worker extern "C" { 25*60b67249SAndroid Build Coastguard Worker #endif 26*60b67249SAndroid Build Coastguard Worker 27*60b67249SAndroid Build Coastguard Worker // Converts arbitrary bytes to ascii hex, no NUL terminator is added. Up to 28*60b67249SAndroid Build Coastguard Worker // |num_bytes| from |in| will be converted, and up to |out_size| bytes will be 29*60b67249SAndroid Build Coastguard Worker // written to |out|. If |out_size| is less than |num_bytes| * 2, the output will 30*60b67249SAndroid Build Coastguard Worker // be truncated at |out_size|. 31*60b67249SAndroid Build Coastguard Worker void DiceHexEncode(const uint8_t* in, size_t num_bytes, void* out, 32*60b67249SAndroid Build Coastguard Worker size_t out_size); 33*60b67249SAndroid Build Coastguard Worker 34*60b67249SAndroid Build Coastguard Worker #ifdef __cplusplus 35*60b67249SAndroid Build Coastguard Worker } // extern "C" 36*60b67249SAndroid Build Coastguard Worker #endif 37*60b67249SAndroid Build Coastguard Worker 38*60b67249SAndroid Build Coastguard Worker #endif // DICE_UTILS_H_ 39