1 /* Copyright (c) 2018, Google Inc. 2 * 3 * Permission to use, copy, modify, and/or distribute this software for any 4 * purpose with or without fee is hereby granted, provided that the above 5 * copyright notice and this permission notice appear in all copies. 6 * 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ 14 15 #ifndef OPENSSL_HEADER_X509V3_INTERNAL_H 16 #define OPENSSL_HEADER_X509V3_INTERNAL_H 17 18 #include <openssl/base.h> 19 20 #if defined(__cplusplus) 21 extern "C" { 22 #endif 23 24 25 // x509v3_bytes_to_hex encodes |len| bytes from |buffer| to hex and returns a 26 // newly-allocated NUL-terminated string containing the result, or NULL on 27 // allocation error. 28 // 29 // Note this function was historically named |hex_to_string| in OpenSSL, not 30 // |string_to_hex|. 31 char *x509v3_bytes_to_hex(const unsigned char *buffer, long len); 32 33 // x509v3_hex_string_to_bytes decodes |str| in hex and returns a newly-allocated 34 // array containing the result, or NULL on error. On success, it sets |*len| to 35 // the length of the result. Colon separators between bytes in the input are 36 // allowed and ignored. 37 // 38 // Note this function was historically named |string_to_hex| in OpenSSL, not 39 // |hex_to_string|. 40 unsigned char *x509v3_hex_to_bytes(const char *str, long *len); 41 42 // x509v3_name_cmp returns zero if |name| is equal to |cmp| or begins with |cmp| 43 // followed by '.'. Otherwise, it returns a non-zero number. 44 int x509v3_name_cmp(const char *name, const char *cmp); 45 46 47 #if defined(__cplusplus) 48 } /* extern C */ 49 #endif 50 51 #endif /* OPENSSL_HEADER_X509V3_INTERNAL_H */ 52