Extract internal-only parts of x509.h

This commit is contained in:
Nick Mathewson 2018-08-12 18:01:14 -04:00
parent 108d9879eb
commit b9ca8f2356
8 changed files with 35 additions and 12 deletions

View File

@ -34,4 +34,5 @@ noinst_HEADERS += \
src/lib/tls/tortls.h \ src/lib/tls/tortls.h \
src/lib/tls/tortls_internal.h \ src/lib/tls/tortls_internal.h \
src/lib/tls/tortls_st.h \ src/lib/tls/tortls_st.h \
src/lib/tls/x509.h src/lib/tls/x509.h \
src/lib/tls/x509_internal.h

View File

@ -11,6 +11,7 @@
#define TOR_X509_PRIVATE #define TOR_X509_PRIVATE
#include "lib/tls/x509.h" #include "lib/tls/x509.h"
#include "lib/tls/x509_internal.h"
#include "lib/log/util_bug.h" #include "lib/log/util_bug.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"

View File

@ -40,15 +40,6 @@ void tor_tls_pick_certificate_lifetime(time_t now,
time_t *start_time_out, time_t *start_time_out,
time_t *end_time_out); time_t *end_time_out);
MOCK_DECL(tor_x509_cert_impl_t *, tor_tls_create_certificate,
(crypto_pk_t *rsa,
crypto_pk_t *rsa_sign,
const char *cname,
const char *cname_sign,
unsigned int cert_lifetime));
MOCK_DECL(tor_x509_cert_t *, tor_x509_cert_new,
(tor_x509_cert_impl_t *x509_cert));
#ifdef TOR_UNIT_TESTS #ifdef TOR_UNIT_TESTS
tor_x509_cert_t *tor_x509_cert_replace_expiration( tor_x509_cert_t *tor_x509_cert_replace_expiration(
const tor_x509_cert_t *inp, const tor_x509_cert_t *inp,
@ -63,8 +54,6 @@ void tor_x509_cert_free_(tor_x509_cert_t *cert);
FREE_AND_NULL(tor_x509_cert_t, tor_x509_cert_free_, (c)) FREE_AND_NULL(tor_x509_cert_t, tor_x509_cert_free_, (c))
tor_x509_cert_t *tor_x509_cert_decode(const uint8_t *certificate, tor_x509_cert_t *tor_x509_cert_decode(const uint8_t *certificate,
size_t certificate_len); size_t certificate_len);
const tor_x509_cert_impl_t *tor_x509_cert_get_impl(
const tor_x509_cert_t *cert);
void tor_x509_cert_get_der(const tor_x509_cert_t *cert, void tor_x509_cert_get_der(const tor_x509_cert_t *cert,
const uint8_t **encoded_out, size_t *size_out); const uint8_t **encoded_out, size_t *size_out);

View File

@ -0,0 +1,28 @@
/* Copyright (c) 2003, Roger Dingledine
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
* Copyright (c) 2007-2018, The Tor Project, Inc. */
/* See LICENSE for licensing information */
#ifndef TOR_X509_INTERNAL_H
#define TOR_X509_INTERNAL_H
/**
* \file x509.h
* \brief Internal headers for tortls.c
**/
#include "lib/crypt_ops/crypto_rsa.h"
#include "lib/testsupport/testsupport.h"
MOCK_DECL(tor_x509_cert_impl_t *, tor_tls_create_certificate,
(crypto_pk_t *rsa,
crypto_pk_t *rsa_sign,
const char *cname,
const char *cname_sign,
unsigned int cert_lifetime));
MOCK_DECL(tor_x509_cert_t *, tor_x509_cert_new,
(tor_x509_cert_impl_t *x509_cert));
const tor_x509_cert_impl_t *tor_x509_cert_get_impl(
const tor_x509_cert_t *cert);
#endif

View File

@ -11,6 +11,7 @@
#define TOR_X509_PRIVATE #define TOR_X509_PRIVATE
#include "lib/tls/x509.h" #include "lib/tls/x509.h"
#include "lib/tls/x509_internal.h"
#include "lib/tls/tortls.h" #include "lib/tls/tortls.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h" #include "lib/crypt_ops/crypto_util.h"

View File

@ -11,6 +11,7 @@
#define TOR_X509_PRIVATE #define TOR_X509_PRIVATE
#include "lib/tls/x509.h" #include "lib/tls/x509.h"
#include "lib/tls/x509_internal.h"
#include "lib/tls/tortls.h" #include "lib/tls/tortls.h"
#include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h" #include "lib/crypt_ops/crypto_util.h"

View File

@ -19,6 +19,7 @@
#include "app/config/config.h" #include "app/config/config.h"
#include "lib/crypt_ops/compat_openssl.h" #include "lib/crypt_ops/compat_openssl.h"
#include "lib/tls/x509.h" #include "lib/tls/x509.h"
#include "lib/tls/x509_internal.h"
#include "lib/tls/tortls.h" #include "lib/tls/tortls.h"
#include "lib/tls/tortls_st.h" #include "lib/tls/tortls_st.h"
#include "lib/tls/tortls_internal.h" #include "lib/tls/tortls_internal.h"

View File

@ -36,6 +36,7 @@ ENABLE_GCC_WARNING(redundant-decls)
#include "app/config/config.h" #include "app/config/config.h"
#include "lib/crypt_ops/compat_openssl.h" #include "lib/crypt_ops/compat_openssl.h"
#include "lib/tls/x509.h" #include "lib/tls/x509.h"
#include "lib/tls/x509_internal.h"
#include "lib/tls/tortls.h" #include "lib/tls/tortls.h"
#include "lib/tls/tortls_st.h" #include "lib/tls/tortls_st.h"
#include "lib/tls/tortls_internal.h" #include "lib/tls/tortls_internal.h"