diff options
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/crypto/fipsmodule/aes/asm/aesni-x86.pl | 47 | ||||
-rw-r--r-- | src/crypto/fipsmodule/aes/internal.h | 2 | ||||
-rw-r--r-- | src/crypto/perlasm/x86asm.pl | 17 | ||||
-rw-r--r-- | src/crypto/stack/stack_test.cc | 4 | ||||
-rw-r--r-- | src/crypto/thread_win.c | 14 | ||||
-rw-r--r-- | src/crypto/x509/asn1_gen.c | 3 | ||||
-rw-r--r-- | src/crypto/x509v3/internal.h | 51 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_akey.c | 7 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_alt.c | 23 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_conf.c | 3 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_cpols.c | 5 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_pci.c | 3 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_skey.c | 7 | ||||
-rw-r--r-- | src/crypto/x509v3/v3_utl.c | 15 |
15 files changed, 140 insertions, 63 deletions
diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index ee9626a1..b1ca70e1 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -53,7 +53,7 @@ if(NOT OPENSSL_NO_ASM) set(PERLASM_STYLE win32n) set(PERLASM_FLAGS "-DOPENSSL_IA32_SSE2") endif() - set(CMAKE_ASM_NASM_FLAGS "-gcv8") + set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -gcv8") # On Windows, we use the NASM output, specifically built with Yasm. set(ASM_EXT asm) diff --git a/src/crypto/fipsmodule/aes/asm/aesni-x86.pl b/src/crypto/fipsmodule/aes/asm/aesni-x86.pl index cf1a51e0..aff2b408 100644 --- a/src/crypto/fipsmodule/aes/asm/aesni-x86.pl +++ b/src/crypto/fipsmodule/aes/asm/aesni-x86.pl @@ -67,9 +67,10 @@ # Goldmont 3.84/1.39 1.39 1.63 1.31 1.70 # Bulldozer 5.80/0.98 1.05 1.24 0.93 1.23 -$PREFIX="aesni"; # if $PREFIX is set to "AES", the script +$PREFIX="aes_hw"; # if $PREFIX is set to "AES", the script # generates drop-in replacement for # crypto/aes/asm/aes-586.pl:-) +$AESNI_PREFIX="aes_hw"; $inline=1; # inline _aesni_[en|de]crypt $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; @@ -85,7 +86,7 @@ open OUT,">$output"; &external_label("OPENSSL_ia32cap_P"); &static_label("key_const"); -if ($PREFIX eq "aesni") { $movekey=\&movups; } +if ($PREFIX eq $AESNI_PREFIX) { $movekey=\&movups; } else { $movekey=\&movups; } $len="eax"; @@ -414,21 +415,21 @@ sub aesni_generate6 &ret(); &function_end_B("_aesni_${p}rypt6"); } -&aesni_generate2("enc") if ($PREFIX eq "aesni"); +&aesni_generate2("enc") if ($PREFIX eq $AESNI_PREFIX); &aesni_generate2("dec"); -&aesni_generate3("enc") if ($PREFIX eq "aesni"); +&aesni_generate3("enc") if ($PREFIX eq $AESNI_PREFIX); &aesni_generate3("dec"); -&aesni_generate4("enc") if ($PREFIX eq "aesni"); +&aesni_generate4("enc") if ($PREFIX eq $AESNI_PREFIX); &aesni_generate4("dec"); -&aesni_generate6("enc") if ($PREFIX eq "aesni"); +&aesni_generate6("enc") if ($PREFIX eq $AESNI_PREFIX); &aesni_generate6("dec"); -if ($PREFIX eq "aesni") { +if ($PREFIX eq $AESNI_PREFIX) { ###################################################################### -# void aesni_ecb_encrypt (const void *in, void *out, +# void aes_hw_ecb_encrypt (const void *in, void *out, # size_t length, const AES_KEY *key, # int enc); -&function_begin("aesni_ecb_encrypt"); +&function_begin("${PREFIX}_ecb_encrypt"); &mov ($inp,&wparam(0)); &mov ($out,&wparam(1)); &mov ($len,&wparam(2)); @@ -647,10 +648,10 @@ if ($PREFIX eq "aesni") { &pxor ("xmm5","xmm5"); &pxor ("xmm6","xmm6"); &pxor ("xmm7","xmm7"); -&function_end("aesni_ecb_encrypt"); +&function_end("${PREFIX}_ecb_encrypt"); ###################################################################### -# void aesni_ccm64_[en|de]crypt_blocks (const void *in, void *out, +# void aes_hw_ccm64_[en|de]crypt_blocks (const void *in, void *out, # size_t blocks, const AES_KEY *key, # const char *ivec,char *cmac); # @@ -659,7 +660,7 @@ if ($PREFIX eq "aesni") { # (see engine/eng_aesni.c for details) # { my $cmac=$inout1; -&function_begin("aesni_ccm64_encrypt_blocks"); +&function_begin("${PREFIX}_ccm64_encrypt_blocks"); &mov ($inp,&wparam(0)); &mov ($out,&wparam(1)); &mov ($len,&wparam(2)); @@ -745,9 +746,9 @@ if ($PREFIX eq "aesni") { &pxor ("xmm5","xmm5"); &pxor ("xmm6","xmm6"); &pxor ("xmm7","xmm7"); -&function_end("aesni_ccm64_encrypt_blocks"); +&function_end("${PREFIX}_ccm64_encrypt_blocks"); -&function_begin("aesni_ccm64_decrypt_blocks"); +&function_begin("${PREFIX}_ccm64_decrypt_blocks"); &mov ($inp,&wparam(0)); &mov ($out,&wparam(1)); &mov ($len,&wparam(2)); @@ -854,11 +855,11 @@ if ($PREFIX eq "aesni") { &pxor ("xmm5","xmm5"); &pxor ("xmm6","xmm6"); &pxor ("xmm7","xmm7"); -&function_end("aesni_ccm64_decrypt_blocks"); +&function_end("${PREFIX}_ccm64_decrypt_blocks"); } ###################################################################### -# void aesni_ctr32_encrypt_blocks (const void *in, void *out, +# void aes_hw_ctr32_encrypt_blocks (const void *in, void *out, # size_t blocks, const AES_KEY *key, # const char *ivec); # @@ -873,7 +874,7 @@ if ($PREFIX eq "aesni") { # 64 2nd triplet of counter vector # 80 saved %esp -&function_begin("aesni_ctr32_encrypt_blocks"); +&function_begin("${PREFIX}_ctr32_encrypt_blocks"); &mov ($inp,&wparam(0)); &mov ($out,&wparam(1)); &mov ($len,&wparam(2)); @@ -1115,16 +1116,16 @@ if ($PREFIX eq "aesni") { &movdqa (&QWP(64,"esp"),"xmm0"); &pxor ("xmm7","xmm7"); &mov ("esp",&DWP(80,"esp")); -&function_end("aesni_ctr32_encrypt_blocks"); +&function_end("${PREFIX}_ctr32_encrypt_blocks"); ###################################################################### -# void aesni_xts_[en|de]crypt(const char *inp,char *out,size_t len, +# void aes_hw_xts_[en|de]crypt(const char *inp,char *out,size_t len, # const AES_KEY *key1, const AES_KEY *key2 # const unsigned char iv[16]); # { my ($tweak,$twtmp,$twres,$twmask)=($rndkey1,$rndkey0,$inout0,$inout1); -&function_begin("aesni_xts_encrypt"); +&function_begin("${PREFIX}_xts_encrypt"); &mov ($key,&wparam(4)); # key2 &mov ($inp,&wparam(5)); # clear-text tweak @@ -1470,9 +1471,9 @@ if ($PREFIX eq "aesni") { &pxor ("xmm7","xmm7"); &movdqa (&QWP(16*5,"esp"),"xmm0"); &mov ("esp",&DWP(16*7+4,"esp")); # restore %esp -&function_end("aesni_xts_encrypt"); +&function_end("${PREFIX}_xts_encrypt"); -&function_begin("aesni_xts_decrypt"); +&function_begin("${PREFIX}_xts_decrypt"); &mov ($key,&wparam(4)); # key2 &mov ($inp,&wparam(5)); # clear-text tweak @@ -1846,7 +1847,7 @@ if ($PREFIX eq "aesni") { &pxor ("xmm7","xmm7"); &movdqa (&QWP(16*5,"esp"),"xmm0"); &mov ("esp",&DWP(16*7+4,"esp")); # restore %esp -&function_end("aesni_xts_decrypt"); +&function_end("${PREFIX}_xts_decrypt"); } } diff --git a/src/crypto/fipsmodule/aes/internal.h b/src/crypto/fipsmodule/aes/internal.h index 7c19b9c5..a9f8a8c7 100644 --- a/src/crypto/fipsmodule/aes/internal.h +++ b/src/crypto/fipsmodule/aes/internal.h @@ -26,7 +26,7 @@ extern "C" { #if !defined(OPENSSL_NO_ASM) -#if defined(OPENSSL_X86_64) +#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64) #define HWAES #define HWAES_ECB diff --git a/src/crypto/perlasm/x86asm.pl b/src/crypto/perlasm/x86asm.pl index c9f645e0..3d2943bc 100644 --- a/src/crypto/perlasm/x86asm.pl +++ b/src/crypto/perlasm/x86asm.pl @@ -262,7 +262,20 @@ $comment This file is generated from a similarly-named Perl script in the Boring $comment source tree. Do not edit by hand. ___ - print "#if defined(__i386__)\n" unless ($win32 || $netware); + if ($win32 || $netware) { + print <<___ unless $masm; +%ifdef BORINGSSL_PREFIX +%include "boringssl_prefix_symbols_nasm.inc" +%endif +___ + } else { + print <<___; +#if defined(__i386__) +#if defined(BORINGSSL_PREFIX) +#include <boringssl_prefix_symbols_asm.h> +#endif +___ + } print @out; print "#endif\n" unless ($win32 || $netware); } @@ -288,7 +301,7 @@ sub ::asm_init #elsif (($type eq "nw-mwasm")) #{ $netware=1; $mwerks=1; require "x86nasm.pl"; } elsif (($type eq "win32")) - { $win32=1; require "x86masm.pl"; } + { $win32=1; $masm=1; require "x86masm.pl"; } elsif (($type eq "macosx")) { $aout=1; $macosx=1; require "x86gas.pl"; } elsif (($type eq "android")) diff --git a/src/crypto/stack/stack_test.cc b/src/crypto/stack/stack_test.cc index 8b269719..7be84ed0 100644 --- a/src/crypto/stack/stack_test.cc +++ b/src/crypto/stack/stack_test.cc @@ -31,9 +31,9 @@ using TEST_INT = int; static void TEST_INT_free(TEST_INT *x) { OPENSSL_free(x); } -namespace bssl { +BSSL_NAMESPACE_BEGIN BORINGSSL_MAKE_DELETER(TEST_INT, TEST_INT_free) -} // namespace bssl +BSSL_NAMESPACE_END static bssl::UniquePtr<TEST_INT> TEST_INT_new(int x) { bssl::UniquePtr<TEST_INT> ret( diff --git a/src/crypto/thread_win.c b/src/crypto/thread_win.c index 8b2b2da5..45011650 100644 --- a/src/crypto/thread_win.c +++ b/src/crypto/thread_win.c @@ -146,12 +146,18 @@ static void NTAPI thread_local_destructor(PVOID module, DWORD reason, // if it's not already there. (E.g. if __declspec(thread) is not used). Force // a reference to p_thread_callback_boringssl to prevent whole program // optimization from discarding the variable. +// +// Note, in the prefixed build, |p_thread_callback_boringssl| may be a macro. +#define STRINGIFY(x) #x +#define EXPAND_AND_STRINGIFY(x) STRINGIFY(x) #ifdef _WIN64 -#pragma comment(linker, "/INCLUDE:_tls_used") -#pragma comment(linker, "/INCLUDE:p_thread_callback_boringssl") +__pragma(comment(linker, "/INCLUDE:_tls_used")) +__pragma(comment( + linker, "/INCLUDE:" EXPAND_AND_STRINGIFY(p_thread_callback_boringssl))) #else -#pragma comment(linker, "/INCLUDE:__tls_used") -#pragma comment(linker, "/INCLUDE:_p_thread_callback_boringssl") +__pragma(comment(linker, "/INCLUDE:__tls_used")) +__pragma(comment( + linker, "/INCLUDE:_" EXPAND_AND_STRINGIFY(p_thread_callback_boringssl))) #endif // .CRT$XLA to .CRT$XLZ is an array of PIMAGE_TLS_CALLBACK pointers that are diff --git a/src/crypto/x509/asn1_gen.c b/src/crypto/x509/asn1_gen.c index 5b74cd1e..98a6facd 100644 --- a/src/crypto/x509/asn1_gen.c +++ b/src/crypto/x509/asn1_gen.c @@ -65,6 +65,7 @@ #include <openssl/x509v3.h> #include "../internal.h" +#include "../x509v3/internal.h" /* * Although this file is in crypto/x509 for layering purposes, it emits @@ -769,7 +770,7 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) if (format == ASN1_GEN_FORMAT_HEX) { - if (!(rdata = string_to_hex((char *)str, &rdlen))) { + if (!(rdata = x509v3_hex_to_bytes((char *)str, &rdlen))) { OPENSSL_PUT_ERROR(ASN1, ASN1_R_ILLEGAL_HEX); goto bad_str; } diff --git a/src/crypto/x509v3/internal.h b/src/crypto/x509v3/internal.h new file mode 100644 index 00000000..e6be6841 --- /dev/null +++ b/src/crypto/x509v3/internal.h @@ -0,0 +1,51 @@ +/* Copyright (c) 2018, Google Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifndef OPENSSL_HEADER_X509V3_INTERNAL_H +#define OPENSSL_HEADER_X509V3_INTERNAL_H + +#include <openssl/base.h> + +#if defined(__cplusplus) +extern "C" { +#endif + + +// x509v3_bytes_to_hex encodes |len| bytes from |buffer| to hex and returns a +// newly-allocated NUL-terminated string containing the result, or NULL on +// allocation error. +// +// Note this function was historically named |hex_to_string| in OpenSSL, not +// |string_to_hex|. +char *x509v3_bytes_to_hex(const unsigned char *buffer, long len); + +// x509v3_hex_string_to_bytes decodes |str| in hex and returns a newly-allocated +// array containing the result, or NULL on error. On success, it sets |*len| to +// the length of the result. Colon separators between bytes in the input are +// allowed and ignored. +// +// Note this function was historically named |string_to_hex| in OpenSSL, not +// |hex_to_string|. +unsigned char *x509v3_hex_to_bytes(const char *str, long *len); + +// x509v3_name_cmp returns zero if |name| is equal to |cmp| or begins with |cmp| +// followed by '.'. Otherwise, it returns a non-zero number. +int x509v3_name_cmp(const char *name, const char *cmp); + + +#if defined(__cplusplus) +} /* extern C */ +#endif + +#endif /* OPENSSL_HEADER_X509V3_INTERNAL_H */ diff --git a/src/crypto/x509v3/v3_akey.c b/src/crypto/x509v3/v3_akey.c index 4503e615..30c02e2c 100644 --- a/src/crypto/x509v3/v3_akey.c +++ b/src/crypto/x509v3/v3_akey.c @@ -66,6 +66,9 @@ #include <openssl/obj.h> #include <openssl/x509v3.h> +#include "internal.h" + + static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, AUTHORITY_KEYID *akeyid, STACK_OF(CONF_VALUE) @@ -92,14 +95,14 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_KEYID(X509V3_EXT_METHOD *method, { char *tmp; if (akeyid->keyid) { - tmp = hex_to_string(akeyid->keyid->data, akeyid->keyid->length); + tmp = x509v3_bytes_to_hex(akeyid->keyid->data, akeyid->keyid->length); X509V3_add_value("keyid", tmp, &extlist); OPENSSL_free(tmp); } if (akeyid->issuer) extlist = i2v_GENERAL_NAMES(NULL, akeyid->issuer, extlist); if (akeyid->serial) { - tmp = hex_to_string(akeyid->serial->data, akeyid->serial->length); + tmp = x509v3_bytes_to_hex(akeyid->serial->data, akeyid->serial->length); X509V3_add_value("serial", tmp, &extlist); OPENSSL_free(tmp); } diff --git a/src/crypto/x509v3/v3_alt.c b/src/crypto/x509v3/v3_alt.c index b78a4105..5a4fadf9 100644 --- a/src/crypto/x509v3/v3_alt.c +++ b/src/crypto/x509v3/v3_alt.c @@ -64,6 +64,9 @@ #include <openssl/obj.h> #include <openssl/x509v3.h> +#include "internal.h" + + static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval); @@ -261,7 +264,7 @@ static GENERAL_NAMES *v2i_issuer_alt(X509V3_EXT_METHOD *method, } for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { cnf = sk_CONF_VALUE_value(nval, i); - if (!name_cmp(cnf->name, "issuer") && cnf->value && + if (!x509v3_name_cmp(cnf->name, "issuer") && cnf->value && !strcmp(cnf->value, "copy")) { if (!copy_issuer(ctx, gens)) goto err; @@ -331,11 +334,11 @@ static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method, } for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { cnf = sk_CONF_VALUE_value(nval, i); - if (!name_cmp(cnf->name, "email") && cnf->value && + if (!x509v3_name_cmp(cnf->name, "email") && cnf->value && !strcmp(cnf->value, "copy")) { if (!copy_email(ctx, gens, 0)) goto err; - } else if (!name_cmp(cnf->name, "email") && cnf->value && + } else if (!x509v3_name_cmp(cnf->name, "email") && cnf->value && !strcmp(cnf->value, "move")) { if (!copy_email(ctx, gens, 1)) goto err; @@ -545,19 +548,19 @@ GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, return NULL; } - if (!name_cmp(name, "email")) + if (!x509v3_name_cmp(name, "email")) type = GEN_EMAIL; - else if (!name_cmp(name, "URI")) + else if (!x509v3_name_cmp(name, "URI")) type = GEN_URI; - else if (!name_cmp(name, "DNS")) + else if (!x509v3_name_cmp(name, "DNS")) type = GEN_DNS; - else if (!name_cmp(name, "RID")) + else if (!x509v3_name_cmp(name, "RID")) type = GEN_RID; - else if (!name_cmp(name, "IP")) + else if (!x509v3_name_cmp(name, "IP")) type = GEN_IPADD; - else if (!name_cmp(name, "dirName")) + else if (!x509v3_name_cmp(name, "dirName")) type = GEN_DIRNAME; - else if (!name_cmp(name, "otherName")) + else if (!x509v3_name_cmp(name, "otherName")) type = GEN_OTHERNAME; else { OPENSSL_PUT_ERROR(X509V3, X509V3_R_UNSUPPORTED_OPTION); diff --git a/src/crypto/x509v3/v3_conf.c b/src/crypto/x509v3/v3_conf.c index ff2eae14..e98d0fcd 100644 --- a/src/crypto/x509v3/v3_conf.c +++ b/src/crypto/x509v3/v3_conf.c @@ -69,6 +69,7 @@ #include <openssl/x509v3.h> #include "../internal.h" +#include "internal.h" static int v3_check_critical(char **value); static int v3_check_generic(char **value); @@ -278,7 +279,7 @@ static X509_EXTENSION *v3_generic_extension(const char *ext, char *value, } if (gen_type == 1) - ext_der = string_to_hex(value, &ext_len); + ext_der = x509v3_hex_to_bytes(value, &ext_len); else if (gen_type == 2) ext_der = generic_asn1(value, ctx, &ext_len); diff --git a/src/crypto/x509v3/v3_cpols.c b/src/crypto/x509v3/v3_cpols.c index 4def530a..18d260b5 100644 --- a/src/crypto/x509v3/v3_cpols.c +++ b/src/crypto/x509v3/v3_cpols.c @@ -69,6 +69,7 @@ #include <openssl/stack.h> #include <openssl/x509v3.h> +#include "internal.h" #include "pcy_int.h" /* Certificate policies extension support: this one is a bit complex... */ @@ -231,7 +232,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx, } pol->policyid = pobj; - } else if (!name_cmp(cnf->name, "CPS")) { + } else if (!x509v3_name_cmp(cnf->name, "CPS")) { if (!pol->qualifiers) pol->qualifiers = sk_POLICYQUALINFO_new_null(); if (!(qual = POLICYQUALINFO_new())) @@ -251,7 +252,7 @@ static POLICYINFO *policy_section(X509V3_CTX *ctx, if (!ASN1_STRING_set(qual->d.cpsuri, cnf->value, strlen(cnf->value))) goto merr; - } else if (!name_cmp(cnf->name, "userNotice")) { + } else if (!x509v3_name_cmp(cnf->name, "userNotice")) { STACK_OF(CONF_VALUE) *unot; if (*cnf->value != '@') { OPENSSL_PUT_ERROR(X509V3, X509V3_R_EXPECTED_A_SECTION_NAME); diff --git a/src/crypto/x509v3/v3_pci.c b/src/crypto/x509v3/v3_pci.c index 4352abee..f9031c04 100644 --- a/src/crypto/x509v3/v3_pci.c +++ b/src/crypto/x509v3/v3_pci.c @@ -44,6 +44,7 @@ #include <openssl/x509v3.h> #include "../internal.h" +#include "internal.h" static int i2r_pci(X509V3_EXT_METHOD *method, PROXY_CERT_INFO_EXTENSION *ext, @@ -123,7 +124,7 @@ static int process_pci_value(CONF_VALUE *val, } if (strncmp(val->value, "hex:", 4) == 0) { unsigned char *tmp_data2 = - string_to_hex(val->value + 4, &val_len); + x509v3_hex_to_bytes(val->value + 4, &val_len); if (!tmp_data2) { OPENSSL_PUT_ERROR(X509V3, X509V3_R_ILLEGAL_HEX_DIGIT); diff --git a/src/crypto/x509v3/v3_skey.c b/src/crypto/x509v3/v3_skey.c index 65f8287c..6a16e78e 100644 --- a/src/crypto/x509v3/v3_skey.c +++ b/src/crypto/x509v3/v3_skey.c @@ -63,6 +63,9 @@ #include <openssl/obj.h> #include <openssl/x509v3.h> +#include "internal.h" + + static ASN1_OCTET_STRING *s2i_skey_id(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str); const X509V3_EXT_METHOD v3_skey_id = { @@ -76,7 +79,7 @@ const X509V3_EXT_METHOD v3_skey_id = { char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *oct) { - return hex_to_string(oct->data, oct->length); + return x509v3_bytes_to_hex(oct->data, oct->length); } ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, @@ -90,7 +93,7 @@ ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, return NULL; } - if (!(oct->data = string_to_hex(str, &length))) { + if (!(oct->data = x509v3_hex_to_bytes(str, &length))) { M_ASN1_OCTET_STRING_free(oct); return NULL; } diff --git a/src/crypto/x509v3/v3_utl.c b/src/crypto/x509v3/v3_utl.c index 589e296d..2a293dc8 100644 --- a/src/crypto/x509v3/v3_utl.c +++ b/src/crypto/x509v3/v3_utl.c @@ -72,6 +72,7 @@ #include "../conf/internal.h" #include "../internal.h" +#include "internal.h" static char *strip_spaces(char *name); @@ -446,7 +447,7 @@ static char *strip_spaces(char *name) * on EBCDIC machines) */ -char *hex_to_string(const unsigned char *buffer, long len) +char *x509v3_bytes_to_hex(const unsigned char *buffer, long len) { char *tmp, *q; const unsigned char *p; @@ -469,11 +470,7 @@ char *hex_to_string(const unsigned char *buffer, long len) return tmp; } -/* - * Give a string of hex digits convert to a buffer - */ - -unsigned char *string_to_hex(const char *str, long *len) +unsigned char *x509v3_hex_to_bytes(const char *str, long *len) { unsigned char *hexbuf, *q; unsigned char ch, cl, *p; @@ -533,11 +530,7 @@ unsigned char *string_to_hex(const char *str, long *len) } -/* - * V2I name comparison function: returns zero if 'name' matches cmp or cmp.* - */ - -int name_cmp(const char *name, const char *cmp) +int x509v3_name_cmp(const char *name, const char *cmp) { int len, ret; char c; |