Start of a Fuchsia port

Change-Id: Iba8c5ffc97299f74fab37ed34bba788aa585827a
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..bb40350
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,567 @@
+# Copyright 2016 The Fuchsia Authors. All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#    * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#    * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#    * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+config("dropbear_config") {
+  defines = [ "BUNDLED_LIBTOM" ]
+
+  # https://llvm.org/bugs/show_bug.cgi?id=21689
+  cflags = [ "-Wno-missing-field-initializers" ]
+  include_dirs = [ "fuchsia-config" ]
+}
+
+config("libtommath_config") {
+  include_dirs = [
+    "libtommath",
+    ".",
+  ]
+}
+
+static_library("libtommath") {
+  visibility = [ ":*" ]
+
+  sources = [
+    "libtommath/bn_error.c",
+    "libtommath/bn_fast_mp_invmod.c",
+    "libtommath/bn_fast_mp_montgomery_reduce.c",
+    "libtommath/bn_fast_s_mp_mul_digs.c",
+    "libtommath/bn_fast_s_mp_mul_high_digs.c",
+    "libtommath/bn_fast_s_mp_sqr.c",
+    "libtommath/bn_mp_2expt.c",
+    "libtommath/bn_mp_abs.c",
+    "libtommath/bn_mp_add.c",
+    "libtommath/bn_mp_add_d.c",
+    "libtommath/bn_mp_addmod.c",
+    "libtommath/bn_mp_and.c",
+    "libtommath/bn_mp_clamp.c",
+    "libtommath/bn_mp_clear.c",
+    "libtommath/bn_mp_clear_multi.c",
+    "libtommath/bn_mp_cmp.c",
+    "libtommath/bn_mp_cmp_d.c",
+    "libtommath/bn_mp_cmp_mag.c",
+    "libtommath/bn_mp_cnt_lsb.c",
+    "libtommath/bn_mp_copy.c",
+    "libtommath/bn_mp_count_bits.c",
+    "libtommath/bn_mp_div.c",
+    "libtommath/bn_mp_div_2.c",
+    "libtommath/bn_mp_div_2d.c",
+    "libtommath/bn_mp_div_3.c",
+    "libtommath/bn_mp_div_d.c",
+    "libtommath/bn_mp_dr_is_modulus.c",
+    "libtommath/bn_mp_dr_reduce.c",
+    "libtommath/bn_mp_dr_setup.c",
+    "libtommath/bn_mp_exch.c",
+    "libtommath/bn_mp_expt_d.c",
+    "libtommath/bn_mp_exptmod.c",
+    "libtommath/bn_mp_exptmod_fast.c",
+    "libtommath/bn_mp_exteuclid.c",
+    "libtommath/bn_mp_fread.c",
+    "libtommath/bn_mp_fwrite.c",
+    "libtommath/bn_mp_gcd.c",
+    "libtommath/bn_mp_get_int.c",
+    "libtommath/bn_mp_grow.c",
+    "libtommath/bn_mp_init.c",
+    "libtommath/bn_mp_init_copy.c",
+    "libtommath/bn_mp_init_multi.c",
+    "libtommath/bn_mp_init_set.c",
+    "libtommath/bn_mp_init_set_int.c",
+    "libtommath/bn_mp_init_size.c",
+    "libtommath/bn_mp_invmod.c",
+    "libtommath/bn_mp_invmod_slow.c",
+    "libtommath/bn_mp_is_square.c",
+    "libtommath/bn_mp_jacobi.c",
+    "libtommath/bn_mp_karatsuba_mul.c",
+    "libtommath/bn_mp_karatsuba_sqr.c",
+    "libtommath/bn_mp_lcm.c",
+    "libtommath/bn_mp_lshd.c",
+    "libtommath/bn_mp_mod.c",
+    "libtommath/bn_mp_mod_2d.c",
+    "libtommath/bn_mp_mod_d.c",
+    "libtommath/bn_mp_montgomery_calc_normalization.c",
+    "libtommath/bn_mp_montgomery_reduce.c",
+    "libtommath/bn_mp_montgomery_setup.c",
+    "libtommath/bn_mp_mul.c",
+    "libtommath/bn_mp_mul_2.c",
+    "libtommath/bn_mp_mul_2d.c",
+    "libtommath/bn_mp_mul_d.c",
+    "libtommath/bn_mp_mulmod.c",
+    "libtommath/bn_mp_n_root.c",
+    "libtommath/bn_mp_neg.c",
+    "libtommath/bn_mp_or.c",
+    "libtommath/bn_mp_prime_fermat.c",
+    "libtommath/bn_mp_prime_is_divisible.c",
+    "libtommath/bn_mp_prime_is_prime.c",
+    "libtommath/bn_mp_prime_miller_rabin.c",
+    "libtommath/bn_mp_prime_next_prime.c",
+    "libtommath/bn_mp_prime_rabin_miller_trials.c",
+    "libtommath/bn_mp_prime_random_ex.c",
+    "libtommath/bn_mp_radix_size.c",
+    "libtommath/bn_mp_radix_smap.c",
+    "libtommath/bn_mp_rand.c",
+    "libtommath/bn_mp_read_radix.c",
+    "libtommath/bn_mp_read_signed_bin.c",
+    "libtommath/bn_mp_read_unsigned_bin.c",
+    "libtommath/bn_mp_reduce.c",
+    "libtommath/bn_mp_reduce_2k.c",
+    "libtommath/bn_mp_reduce_2k_l.c",
+    "libtommath/bn_mp_reduce_2k_setup.c",
+    "libtommath/bn_mp_reduce_2k_setup_l.c",
+    "libtommath/bn_mp_reduce_is_2k.c",
+    "libtommath/bn_mp_reduce_is_2k_l.c",
+    "libtommath/bn_mp_reduce_setup.c",
+    "libtommath/bn_mp_rshd.c",
+    "libtommath/bn_mp_set.c",
+    "libtommath/bn_mp_set_int.c",
+    "libtommath/bn_mp_shrink.c",
+    "libtommath/bn_mp_signed_bin_size.c",
+    "libtommath/bn_mp_sqr.c",
+    "libtommath/bn_mp_sqrmod.c",
+    "libtommath/bn_mp_sqrt.c",
+    "libtommath/bn_mp_sub.c",
+    "libtommath/bn_mp_sub_d.c",
+    "libtommath/bn_mp_submod.c",
+    "libtommath/bn_mp_to_signed_bin.c",
+    "libtommath/bn_mp_to_signed_bin_n.c",
+    "libtommath/bn_mp_to_unsigned_bin.c",
+    "libtommath/bn_mp_to_unsigned_bin_n.c",
+    "libtommath/bn_mp_toom_mul.c",
+    "libtommath/bn_mp_toom_sqr.c",
+    "libtommath/bn_mp_toradix.c",
+    "libtommath/bn_mp_toradix_n.c",
+    "libtommath/bn_mp_unsigned_bin_size.c",
+    "libtommath/bn_mp_xor.c",
+    "libtommath/bn_mp_zero.c",
+    "libtommath/bn_prime_tab.c",
+    "libtommath/bn_reverse.c",
+    "libtommath/bn_s_mp_add.c",
+    "libtommath/bn_s_mp_exptmod.c",
+    "libtommath/bn_s_mp_mul_digs.c",
+    "libtommath/bn_s_mp_mul_high_digs.c",
+    "libtommath/bn_s_mp_sqr.c",
+    "libtommath/bn_s_mp_sub.c",
+    "libtommath/bncore.c",
+  ]
+
+  configs += [ ":dropbear_config" ]
+  public_configs = [ ":libtommath_config" ]
+}
+
+config("libtomcrypt_config") {
+  include_dirs = [
+    "libtomcrypt/src/headers",
+    ".",
+  ]
+}
+
+static_library("libtomcrypt") {
+  visibility = [ ":*" ]
+
+  sources = [
+    "libtomcrypt/src/ciphers/aes/aes.c",
+    "libtomcrypt/src/ciphers/anubis.c",
+    "libtomcrypt/src/ciphers/blowfish.c",
+    "libtomcrypt/src/ciphers/cast5.c",
+    "libtomcrypt/src/ciphers/des.c",
+    "libtomcrypt/src/ciphers/kasumi.c",
+    "libtomcrypt/src/ciphers/khazad.c",
+    "libtomcrypt/src/ciphers/kseed.c",
+    "libtomcrypt/src/ciphers/noekeon.c",
+    "libtomcrypt/src/ciphers/rc2.c",
+    "libtomcrypt/src/ciphers/rc5.c",
+    "libtomcrypt/src/ciphers/rc6.c",
+    "libtomcrypt/src/ciphers/safer/safer.c",
+    "libtomcrypt/src/ciphers/safer/safer_tab.c",
+    "libtomcrypt/src/ciphers/safer/saferp.c",
+    "libtomcrypt/src/ciphers/skipjack.c",
+    "libtomcrypt/src/ciphers/twofish/twofish.c",
+    "libtomcrypt/src/ciphers/xtea.c",
+    "libtomcrypt/src/encauth/ccm/ccm_memory.c",
+    "libtomcrypt/src/encauth/ccm/ccm_test.c",
+    "libtomcrypt/src/encauth/eax/eax_addheader.c",
+    "libtomcrypt/src/encauth/eax/eax_decrypt.c",
+    "libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c",
+    "libtomcrypt/src/encauth/eax/eax_done.c",
+    "libtomcrypt/src/encauth/eax/eax_encrypt.c",
+    "libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c",
+    "libtomcrypt/src/encauth/eax/eax_init.c",
+    "libtomcrypt/src/encauth/eax/eax_test.c",
+    "libtomcrypt/src/encauth/gcm/gcm_add_aad.c",
+    "libtomcrypt/src/encauth/gcm/gcm_add_iv.c",
+    "libtomcrypt/src/encauth/gcm/gcm_done.c",
+    "libtomcrypt/src/encauth/gcm/gcm_gf_mult.c",
+    "libtomcrypt/src/encauth/gcm/gcm_init.c",
+    "libtomcrypt/src/encauth/gcm/gcm_memory.c",
+    "libtomcrypt/src/encauth/gcm/gcm_mult_h.c",
+    "libtomcrypt/src/encauth/gcm/gcm_process.c",
+    "libtomcrypt/src/encauth/gcm/gcm_reset.c",
+    "libtomcrypt/src/encauth/gcm/gcm_test.c",
+    "libtomcrypt/src/encauth/ocb/ocb_decrypt.c",
+    "libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c",
+    "libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c",
+    "libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c",
+    "libtomcrypt/src/encauth/ocb/ocb_encrypt.c",
+    "libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c",
+    "libtomcrypt/src/encauth/ocb/ocb_init.c",
+    "libtomcrypt/src/encauth/ocb/ocb_ntz.c",
+    "libtomcrypt/src/encauth/ocb/ocb_shift_xor.c",
+    "libtomcrypt/src/encauth/ocb/ocb_test.c",
+    "libtomcrypt/src/encauth/ocb/s_ocb_done.c",
+    "libtomcrypt/src/hashes/chc/chc.c",
+    "libtomcrypt/src/hashes/helper/hash_file.c",
+    "libtomcrypt/src/hashes/helper/hash_filehandle.c",
+    "libtomcrypt/src/hashes/helper/hash_memory.c",
+    "libtomcrypt/src/hashes/helper/hash_memory_multi.c",
+    "libtomcrypt/src/hashes/md2.c",
+    "libtomcrypt/src/hashes/md4.c",
+    "libtomcrypt/src/hashes/md5.c",
+    "libtomcrypt/src/hashes/rmd128.c",
+    "libtomcrypt/src/hashes/rmd160.c",
+    "libtomcrypt/src/hashes/rmd256.c",
+    "libtomcrypt/src/hashes/rmd320.c",
+    "libtomcrypt/src/hashes/sha1.c",
+    "libtomcrypt/src/hashes/sha2/sha256.c",
+    "libtomcrypt/src/hashes/sha2/sha512.c",
+    "libtomcrypt/src/hashes/tiger.c",
+    "libtomcrypt/src/hashes/whirl/whirl.c",
+    "libtomcrypt/src/headers/tomcrypt.h",
+    "libtomcrypt/src/headers/tomcrypt_argchk.h",
+    "libtomcrypt/src/headers/tomcrypt_cfg.h",
+    "libtomcrypt/src/headers/tomcrypt_cipher.h",
+    "libtomcrypt/src/headers/tomcrypt_custom.h",
+    "libtomcrypt/src/headers/tomcrypt_hash.h",
+    "libtomcrypt/src/headers/tomcrypt_mac.h",
+    "libtomcrypt/src/headers/tomcrypt_macros.h",
+    "libtomcrypt/src/headers/tomcrypt_math.h",
+    "libtomcrypt/src/headers/tomcrypt_misc.h",
+    "libtomcrypt/src/headers/tomcrypt_pk.h",
+    "libtomcrypt/src/headers/tomcrypt_pkcs.h",
+    "libtomcrypt/src/headers/tomcrypt_prng.h",
+    "libtomcrypt/src/mac/f9/f9_done.c",
+    "libtomcrypt/src/mac/f9/f9_file.c",
+    "libtomcrypt/src/mac/f9/f9_init.c",
+    "libtomcrypt/src/mac/f9/f9_memory.c",
+    "libtomcrypt/src/mac/f9/f9_memory_multi.c",
+    "libtomcrypt/src/mac/f9/f9_process.c",
+    "libtomcrypt/src/mac/f9/f9_test.c",
+    "libtomcrypt/src/mac/hmac/hmac_done.c",
+    "libtomcrypt/src/mac/hmac/hmac_file.c",
+    "libtomcrypt/src/mac/hmac/hmac_init.c",
+    "libtomcrypt/src/mac/hmac/hmac_memory.c",
+    "libtomcrypt/src/mac/hmac/hmac_memory_multi.c",
+    "libtomcrypt/src/mac/hmac/hmac_process.c",
+    "libtomcrypt/src/mac/hmac/hmac_test.c",
+    "libtomcrypt/src/mac/omac/omac_done.c",
+    "libtomcrypt/src/mac/omac/omac_file.c",
+    "libtomcrypt/src/mac/omac/omac_init.c",
+    "libtomcrypt/src/mac/omac/omac_memory.c",
+    "libtomcrypt/src/mac/omac/omac_memory_multi.c",
+    "libtomcrypt/src/mac/omac/omac_process.c",
+    "libtomcrypt/src/mac/omac/omac_test.c",
+    "libtomcrypt/src/mac/pelican/pelican.c",
+    "libtomcrypt/src/mac/pelican/pelican_memory.c",
+    "libtomcrypt/src/mac/pelican/pelican_test.c",
+    "libtomcrypt/src/mac/pmac/pmac_done.c",
+    "libtomcrypt/src/mac/pmac/pmac_file.c",
+    "libtomcrypt/src/mac/pmac/pmac_init.c",
+    "libtomcrypt/src/mac/pmac/pmac_memory.c",
+    "libtomcrypt/src/mac/pmac/pmac_memory_multi.c",
+    "libtomcrypt/src/mac/pmac/pmac_ntz.c",
+    "libtomcrypt/src/mac/pmac/pmac_process.c",
+    "libtomcrypt/src/mac/pmac/pmac_shift_xor.c",
+    "libtomcrypt/src/mac/pmac/pmac_test.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_done.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_file.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_init.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_memory.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_memory_multi.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_process.c",
+    "libtomcrypt/src/mac/xcbc/xcbc_test.c",
+    "libtomcrypt/src/math/fp/ltc_ecc_fp_mulmod.c",
+    "libtomcrypt/src/math/gmp_desc.c",
+    "libtomcrypt/src/math/ltm_desc.c",
+    "libtomcrypt/src/math/multi.c",
+    "libtomcrypt/src/math/rand_prime.c",
+    "libtomcrypt/src/math/tfm_desc.c",
+    "libtomcrypt/src/misc/base64/base64_decode.c",
+    "libtomcrypt/src/misc/base64/base64_encode.c",
+    "libtomcrypt/src/misc/burn_stack.c",
+    "libtomcrypt/src/misc/crypt/crypt.c",
+    "libtomcrypt/src/misc/crypt/crypt_argchk.c",
+    "libtomcrypt/src/misc/crypt/crypt_cipher_descriptor.c",
+    "libtomcrypt/src/misc/crypt/crypt_cipher_is_valid.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_cipher.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_cipher_any.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_cipher_id.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_hash.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_hash_any.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_hash_id.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_hash_oid.c",
+    "libtomcrypt/src/misc/crypt/crypt_find_prng.c",
+    "libtomcrypt/src/misc/crypt/crypt_fsa.c",
+    "libtomcrypt/src/misc/crypt/crypt_hash_descriptor.c",
+    "libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c",
+    "libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c",
+    "libtomcrypt/src/misc/crypt/crypt_prng_descriptor.c",
+    "libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c",
+    "libtomcrypt/src/misc/crypt/crypt_register_cipher.c",
+    "libtomcrypt/src/misc/crypt/crypt_register_hash.c",
+    "libtomcrypt/src/misc/crypt/crypt_register_prng.c",
+    "libtomcrypt/src/misc/crypt/crypt_unregister_cipher.c",
+    "libtomcrypt/src/misc/crypt/crypt_unregister_hash.c",
+    "libtomcrypt/src/misc/crypt/crypt_unregister_prng.c",
+    "libtomcrypt/src/misc/error_to_string.c",
+    "libtomcrypt/src/misc/pkcs5/pkcs_5_1.c",
+    "libtomcrypt/src/misc/pkcs5/pkcs_5_2.c",
+    "libtomcrypt/src/misc/zeromem.c",
+    "libtomcrypt/src/modes/cbc/cbc_decrypt.c",
+    "libtomcrypt/src/modes/cbc/cbc_done.c",
+    "libtomcrypt/src/modes/cbc/cbc_encrypt.c",
+    "libtomcrypt/src/modes/cbc/cbc_getiv.c",
+    "libtomcrypt/src/modes/cbc/cbc_setiv.c",
+    "libtomcrypt/src/modes/cbc/cbc_start.c",
+    "libtomcrypt/src/modes/cfb/cfb_decrypt.c",
+    "libtomcrypt/src/modes/cfb/cfb_done.c",
+    "libtomcrypt/src/modes/cfb/cfb_encrypt.c",
+    "libtomcrypt/src/modes/cfb/cfb_getiv.c",
+    "libtomcrypt/src/modes/cfb/cfb_setiv.c",
+    "libtomcrypt/src/modes/cfb/cfb_start.c",
+    "libtomcrypt/src/modes/ctr/ctr_decrypt.c",
+    "libtomcrypt/src/modes/ctr/ctr_done.c",
+    "libtomcrypt/src/modes/ctr/ctr_encrypt.c",
+    "libtomcrypt/src/modes/ctr/ctr_getiv.c",
+    "libtomcrypt/src/modes/ctr/ctr_setiv.c",
+    "libtomcrypt/src/modes/ctr/ctr_start.c",
+    "libtomcrypt/src/modes/ctr/ctr_test.c",
+    "libtomcrypt/src/modes/ecb/ecb_decrypt.c",
+    "libtomcrypt/src/modes/ecb/ecb_done.c",
+    "libtomcrypt/src/modes/ecb/ecb_encrypt.c",
+    "libtomcrypt/src/modes/ecb/ecb_start.c",
+    "libtomcrypt/src/modes/f8/f8_decrypt.c",
+    "libtomcrypt/src/modes/f8/f8_done.c",
+    "libtomcrypt/src/modes/f8/f8_encrypt.c",
+    "libtomcrypt/src/modes/f8/f8_getiv.c",
+    "libtomcrypt/src/modes/f8/f8_setiv.c",
+    "libtomcrypt/src/modes/f8/f8_start.c",
+    "libtomcrypt/src/modes/f8/f8_test_mode.c",
+    "libtomcrypt/src/modes/lrw/lrw_decrypt.c",
+    "libtomcrypt/src/modes/lrw/lrw_done.c",
+    "libtomcrypt/src/modes/lrw/lrw_encrypt.c",
+    "libtomcrypt/src/modes/lrw/lrw_getiv.c",
+    "libtomcrypt/src/modes/lrw/lrw_process.c",
+    "libtomcrypt/src/modes/lrw/lrw_setiv.c",
+    "libtomcrypt/src/modes/lrw/lrw_start.c",
+    "libtomcrypt/src/modes/lrw/lrw_test.c",
+    "libtomcrypt/src/modes/ofb/ofb_decrypt.c",
+    "libtomcrypt/src/modes/ofb/ofb_done.c",
+    "libtomcrypt/src/modes/ofb/ofb_encrypt.c",
+    "libtomcrypt/src/modes/ofb/ofb_getiv.c",
+    "libtomcrypt/src/modes/ofb/ofb_setiv.c",
+    "libtomcrypt/src/modes/ofb/ofb_start.c",
+    "libtomcrypt/src/pk/asn1/der/bit/der_decode_bit_string.c",
+    "libtomcrypt/src/pk/asn1/der/bit/der_encode_bit_string.c",
+    "libtomcrypt/src/pk/asn1/der/bit/der_length_bit_string.c",
+    "libtomcrypt/src/pk/asn1/der/boolean/der_decode_boolean.c",
+    "libtomcrypt/src/pk/asn1/der/boolean/der_encode_boolean.c",
+    "libtomcrypt/src/pk/asn1/der/boolean/der_length_boolean.c",
+    "libtomcrypt/src/pk/asn1/der/choice/der_decode_choice.c",
+    "libtomcrypt/src/pk/asn1/der/ia5/der_decode_ia5_string.c",
+    "libtomcrypt/src/pk/asn1/der/ia5/der_encode_ia5_string.c",
+    "libtomcrypt/src/pk/asn1/der/ia5/der_length_ia5_string.c",
+    "libtomcrypt/src/pk/asn1/der/integer/der_decode_integer.c",
+    "libtomcrypt/src/pk/asn1/der/integer/der_encode_integer.c",
+    "libtomcrypt/src/pk/asn1/der/integer/der_length_integer.c",
+    "libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c",
+    "libtomcrypt/src/pk/asn1/der/object_identifier/der_encode_object_identifier.c",
+    "libtomcrypt/src/pk/asn1/der/object_identifier/der_length_object_identifier.c",
+    "libtomcrypt/src/pk/asn1/der/octet/der_decode_octet_string.c",
+    "libtomcrypt/src/pk/asn1/der/octet/der_encode_octet_string.c",
+    "libtomcrypt/src/pk/asn1/der/octet/der_length_octet_string.c",
+    "libtomcrypt/src/pk/asn1/der/printable_string/der_decode_printable_string.c",
+    "libtomcrypt/src/pk/asn1/der/printable_string/der_encode_printable_string.c",
+    "libtomcrypt/src/pk/asn1/der/printable_string/der_length_printable_string.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_ex.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_decode_sequence_multi.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_ex.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_encode_sequence_multi.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_length_sequence.c",
+    "libtomcrypt/src/pk/asn1/der/sequence/der_sequence_free.c",
+    "libtomcrypt/src/pk/asn1/der/set/der_encode_set.c",
+    "libtomcrypt/src/pk/asn1/der/set/der_encode_setof.c",
+    "libtomcrypt/src/pk/asn1/der/short_integer/der_decode_short_integer.c",
+    "libtomcrypt/src/pk/asn1/der/short_integer/der_encode_short_integer.c",
+    "libtomcrypt/src/pk/asn1/der/short_integer/der_length_short_integer.c",
+    "libtomcrypt/src/pk/asn1/der/utctime/der_decode_utctime.c",
+    "libtomcrypt/src/pk/asn1/der/utctime/der_encode_utctime.c",
+    "libtomcrypt/src/pk/asn1/der/utctime/der_length_utctime.c",
+    "libtomcrypt/src/pk/asn1/der/utf8/der_decode_utf8_string.c",
+    "libtomcrypt/src/pk/asn1/der/utf8/der_encode_utf8_string.c",
+    "libtomcrypt/src/pk/asn1/der/utf8/der_length_utf8_string.c",
+    "libtomcrypt/src/pk/dsa/dsa_decrypt_key.c",
+    "libtomcrypt/src/pk/dsa/dsa_encrypt_key.c",
+    "libtomcrypt/src/pk/dsa/dsa_export.c",
+    "libtomcrypt/src/pk/dsa/dsa_free.c",
+    "libtomcrypt/src/pk/dsa/dsa_import.c",
+    "libtomcrypt/src/pk/dsa/dsa_make_key.c",
+    "libtomcrypt/src/pk/dsa/dsa_shared_secret.c",
+    "libtomcrypt/src/pk/dsa/dsa_sign_hash.c",
+    "libtomcrypt/src/pk/dsa/dsa_verify_hash.c",
+    "libtomcrypt/src/pk/dsa/dsa_verify_key.c",
+    "libtomcrypt/src/pk/ecc/ecc.c",
+    "libtomcrypt/src/pk/ecc/ecc_ansi_x963_export.c",
+    "libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c",
+    "libtomcrypt/src/pk/ecc/ecc_decrypt_key.c",
+    "libtomcrypt/src/pk/ecc/ecc_encrypt_key.c",
+    "libtomcrypt/src/pk/ecc/ecc_export.c",
+    "libtomcrypt/src/pk/ecc/ecc_free.c",
+    "libtomcrypt/src/pk/ecc/ecc_get_size.c",
+    "libtomcrypt/src/pk/ecc/ecc_import.c",
+    "libtomcrypt/src/pk/ecc/ecc_make_key.c",
+    "libtomcrypt/src/pk/ecc/ecc_shared_secret.c",
+    "libtomcrypt/src/pk/ecc/ecc_sign_hash.c",
+    "libtomcrypt/src/pk/ecc/ecc_sizes.c",
+    "libtomcrypt/src/pk/ecc/ecc_test.c",
+    "libtomcrypt/src/pk/ecc/ecc_verify_hash.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_map.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_mul2add.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_mulmod.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_mulmod_timing.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_points.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_projective_add_point.c",
+    "libtomcrypt/src/pk/ecc/ltc_ecc_projective_dbl_point.c",
+    "libtomcrypt/src/pk/katja/katja_decrypt_key.c",
+    "libtomcrypt/src/pk/katja/katja_encrypt_key.c",
+    "libtomcrypt/src/pk/katja/katja_export.c",
+    "libtomcrypt/src/pk/katja/katja_exptmod.c",
+    "libtomcrypt/src/pk/katja/katja_free.c",
+    "libtomcrypt/src/pk/katja/katja_import.c",
+    "libtomcrypt/src/pk/katja/katja_make_key.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_i2osp.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_mgf1.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_decode.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_oaep_encode.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_os2ip.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_pss_decode.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_pss_encode.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_decode.c",
+    "libtomcrypt/src/pk/pkcs1/pkcs_1_v1_5_encode.c",
+    "libtomcrypt/src/pk/rsa/rsa_decrypt_key.c",
+    "libtomcrypt/src/pk/rsa/rsa_encrypt_key.c",
+    "libtomcrypt/src/pk/rsa/rsa_export.c",
+    "libtomcrypt/src/pk/rsa/rsa_exptmod.c",
+    "libtomcrypt/src/pk/rsa/rsa_free.c",
+    "libtomcrypt/src/pk/rsa/rsa_import.c",
+    "libtomcrypt/src/pk/rsa/rsa_make_key.c",
+    "libtomcrypt/src/pk/rsa/rsa_sign_hash.c",
+    "libtomcrypt/src/pk/rsa/rsa_verify_hash.c",
+    "libtomcrypt/src/prngs/fortuna.c",
+    "libtomcrypt/src/prngs/rc4.c",
+    "libtomcrypt/src/prngs/rng_get_bytes.c",
+    "libtomcrypt/src/prngs/rng_make_prng.c",
+    "libtomcrypt/src/prngs/sober128.c",
+    "libtomcrypt/src/prngs/sprng.c",
+    "libtomcrypt/src/prngs/yarrow.c",
+  ]
+
+  configs += [ ":dropbear_config" ]
+  public_configs = [ ":libtomcrypt_config" ]
+  defines = [ "LTC_SOURCE" ]
+
+  deps = [
+    ":libtommath",
+  ]
+}
+
+executable("dropbear") {
+  sources = [
+    "atomicio.c",
+    "bignum.c",
+    "buffer.c",
+    "circbuffer.c",
+    "common-algo.c",
+    "common-channel.c",
+    "common-chansession.c",
+    "common-kex.c",
+    "common-runopts.c",
+    "common-session.c",
+    "compat.c",
+    "crypto_desc.c",
+    "curve25519-donna.c",
+    "dbhelpers.c",
+    "dbrandom.c",
+    "dbutil.c",
+    "dh_groups.c",
+    "dss.c",
+    "ecc.c",
+    "ecdsa.c",
+    "fake-rfc2553.c",
+    "fuchsia-config/config.h",
+    "gendss.c",
+    "genrsa.c",
+    "gensignkey.c",
+    "list.c",
+    "listener.c",
+    "loginrec.c",
+    "ltc_prng.c",
+    "netio.c",
+    "packet.c",
+    "process-packet.c",
+    "queue.c",
+    "rsa.c",
+    "signkey.c",
+    "sshpty.c",
+    "svr-agentfwd.c",
+    "svr-auth.c",
+    "svr-authpam.c",
+    "svr-authpasswd.c",
+    "svr-authpubkey.c",
+    "svr-authpubkeyoptions.c",
+    "svr-chansession.c",
+    "svr-kex.c",
+    "svr-main.c",
+    "svr-runopts.c",
+    "svr-service.c",
+    "svr-session.c",
+    "svr-tcpfwd.c",
+    "svr-x11fwd.c",
+    "tcp-accept.c",
+    "termcodes.c",
+  ]
+
+  configs += [ ":dropbear_config" ]
+
+  defines = [
+    "DROPBEAR_SERVER",
+    "ENCRYPT_ONLY",
+  ]
+
+  deps = [
+    ":libtomcrypt",
+    ":libtommath",
+    "//third_party/zlib",
+  ]
+}
diff --git a/dbrandom.c b/dbrandom.c
index eb747da..9bf7e2a 100644
--- a/dbrandom.c
+++ b/dbrandom.c
@@ -28,6 +28,9 @@
 #include "bignum.h"
 #include "dbrandom.h"
 
+#ifdef __Fuchsia__
+#include <magenta/syscalls.h> // for mx_cprng_draw
+#endif
 
 /* this is used to generate unique output from the same hashpool */
 static uint32_t counter = 0;
@@ -50,6 +53,7 @@
  */
 
 /* Pass len=0 to hash an entire file */
+#ifndef __Fuchsia__
 static int
 process_file(hash_state *hs, const char *filename,
 		unsigned int len, int prngd)
@@ -140,6 +144,7 @@
 	close(readfd);
 	return ret;
 }
+#endif
 
 void addrandom(unsigned char * buf, unsigned int len)
 {
@@ -191,6 +196,13 @@
 		dropbear_exit("Failure reading random device %s", 
 				DROPBEAR_PRNGD_SOCKET);
 	}
+#elif defined(__Fuchsia__)
+  unsigned char mx_random_bits[INIT_SEED_SIZE];
+	mx_ssize_t count = mx_cprng_draw(mx_random_bits, INIT_SEED_SIZE);
+	if (count != INIT_SEED_SIZE) {
+		dropbear_exit("Failure reading kernel random: %ld", count);
+	}
+	addrandom(mx_random_bits, INIT_SEED_SIZE);
 #else
 	/* non-blocking random source (probably /dev/urandom) */
 	if (process_file(&hs, DROPBEAR_URANDOM_DEV, INIT_SEED_SIZE, 0) 
diff --git a/fuchsia-config/config.h b/fuchsia-config/config.h
new file mode 100644
index 0000000..9123dd5
--- /dev/null
+++ b/fuchsia-config/config.h
@@ -0,0 +1,462 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Using AIX */
+#undef AIX
+
+/* Broken getaddrinfo */
+#undef BROKEN_GETADDRINFO
+
+/* Use bundled libtom */
+#undef BUNDLED_LIBTOM
+
+/* lastlog file location */
+#undef CONF_LASTLOG_FILE
+
+/* utmpx file location */
+#undef CONF_UTMPX_FILE
+
+/* utmp file location */
+#undef CONF_UTMP_FILE
+
+/* wtmpx file location */
+#undef CONF_WTMPX_FILE
+
+/* wtmp file location */
+#undef CONF_WTMP_FILE
+
+/* Disable use of lastlog() */
+#define DISABLE_LASTLOG
+
+/* Use PAM */
+#define DISABLE_PAM
+
+/* Disable use of pututline() */
+#define DISABLE_PUTUTLINE
+
+/* Disable use of pututxline() */
+#define DISABLE_PUTUTXLINE
+
+/* Using syslog */
+#define DISABLE_SYSLOG
+
+/* Disable use of utmp */
+#define DISABLE_UTMP
+
+/* Disable use of utmpx */
+#define DISABLE_UTMPX
+
+/* Disable use of wtmp */
+#define DISABLE_WTMP
+
+/* Disable use of wtmpx */
+#define DISABLE_WTMPX
+
+/* Use zlib */
+#undef DISABLE_ZLIB
+
+/* Define to 1 if you have the `basename' function. */
+#define HAVE_BASENAME
+
+/* Define to 1 if you have the `clearenv' function. */
+#define HAVE_CLEARENV
+
+/* Define if gai_strerror() returns const char * */
+#define HAVE_CONST_GAI_STRERROR_PROTO
+
+/* crypt() function */
+#undef HAVE_CRYPT
+
+/* Define to 1 if you have the <crypt.h> header file. */
+#undef HAVE_CRYPT_H
+
+/* Define to 1 if you have the `daemon' function. */
+#undef HAVE_DAEMON
+
+/* Use /dev/ptc & /dev/pts */
+#undef HAVE_DEV_PTS_AND_PTC
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
+/* Define to 1 if you have the `endutent' function. */
+#undef HAVE_ENDUTENT
+
+/* Define to 1 if you have the `endutxent' function. */
+#undef HAVE_ENDUTXENT
+
+/* Define to 1 if you have the `explicit_bzero' function. */
+#undef HAVE_EXPLICIT_BZERO
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `freeaddrinfo' function. */
+#undef HAVE_FREEADDRINFO
+
+/* Define to 1 if you have the `gai_strerror' function. */
+#define HAVE_GAI_STRERROR
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define HAVE_GETADDRINFO
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define HAVE_GETNAMEINFO
+
+/* Define to 1 if you have the `getpass' function. */
+#define HAVE_GETPASS
+
+/* Define to 1 if you have the `getspnam' function. */
+#undef HAVE_GETSPNAM
+
+/* Define to 1 if you have the `getusershell' function. */
+#undef HAVE_GETUSERSHELL
+
+/* Define to 1 if you have the `getutent' function. */
+#undef HAVE_GETUTENT
+
+/* Define to 1 if you have the `getutid' function. */
+#undef HAVE_GETUTID
+
+/* Define to 1 if you have the `getutline' function. */
+#undef HAVE_GETUTLINE
+
+/* Define to 1 if you have the `getutxent' function. */
+#undef HAVE_GETUTXENT
+
+/* Define to 1 if you have the `getutxid' function. */
+#undef HAVE_GETUTXID
+
+/* Define to 1 if you have the `getutxline' function. */
+#undef HAVE_GETUTXLINE
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <ioctl.h> header file. */
+#define HAVE_IOCTL_H
+
+/* Define to 1 if you have the <lastlog.h> header file. */
+#undef HAVE_LASTLOG_H
+
+/* Define to 1 if you have the <libgen.h> header file. */
+#define HAVE_LIBGEN_H
+
+/* Define to 1 if you have the `pam' library (-lpam). */
+#undef HAVE_LIBPAM
+
+/* Define to 1 if you have the <libutil.h> header file. */
+#undef HAVE_LIBUTIL_H
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H
+
+/* Have login() function */
+#undef HAVE_LOGIN
+
+/* Define to 1 if you have the `logout' function. */
+#undef HAVE_LOGOUT
+
+/* Define to 1 if you have the `logwtmp' function. */
+#undef HAVE_LOGWTMP
+
+/* Define to 1 if you have the `mach_absolute_time' function. */
+#undef HAVE_MACH_ABSOLUTE_TIME
+
+/* Define to 1 if you have the <mach/mach_time.h> header file. */
+#undef HAVE_MACH_MACH_TIME_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET
+
+/* Define to 1 if you have the `memset_s' function. */
+#undef HAVE_MEMSET_S
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#define HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#define HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the <netinet/in_systm.h> header file. */
+#define HAVE_NETINET_IN_SYSTM_H
+
+/* Define to 1 if you have the <netinet/tcp.h> header file. */
+#define HAVE_NETINET_TCP_H
+
+/* Have openpty() function */
+#undef HAVE_OPENPTY
+
+/* Define to 1 if you have the `pam_fail_delay' function. */
+#undef HAVE_PAM_FAIL_DELAY
+
+/* Define to 1 if you have the <pam/pam_appl.h> header file. */
+#undef HAVE_PAM_PAM_APPL_H
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H
+
+/* Define to 1 if you have the <pty.h> header file. */
+#undef HAVE_PTY_H
+
+/* Define to 1 if you have the `putenv' function. */
+#undef HAVE_PUTENV
+
+/* Define to 1 if you have the `pututline' function. */
+#undef HAVE_PUTUTLINE
+
+/* Define to 1 if you have the `pututxline' function. */
+#undef HAVE_PUTUTXLINE
+
+/* Define to 1 if you have the <security/pam_appl.h> header file. */
+#undef HAVE_SECURITY_PAM_APPL_H
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT
+
+/* Define to 1 if you have the `setutent' function. */
+#undef HAVE_SETUTENT
+
+/* Define to 1 if you have the `setutxent' function. */
+#undef HAVE_SETUTXENT
+
+/* Define to 1 if you have the <shadow.h> header file. */
+#undef HAVE_SHADOW_H
+
+/* Define to 1 if you have the `socket' function. */
+#define HAVE_SOCKET
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H
+
+/* Define to 1 if you have the `strlcat' function. */
+#define HAVE_STRLCAT
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define HAVE_STRLCPY
+
+/* Define to 1 if you have the <stropts.h> header file. */
+#undef HAVE_STROPTS_H
+
+/* Have struct addrinfo */
+#define HAVE_STRUCT_ADDRINFO
+
+/* Have struct in6_addr */
+#define HAVE_STRUCT_IN6_ADDR
+
+/* Have struct sockaddr_in6 */
+#define HAVE_STRUCT_SOCKADDR_IN6
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE
+
+/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
+#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY
+
+/* Define to 1 if `ut_addr' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_ADDR
+
+/* Define to 1 if `ut_addr_v6' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_ADDR_V6
+
+/* Define to 1 if `ut_host' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_HOST
+
+/* Define to 1 if `ut_id' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_ID
+
+/* Define to 1 if `ut_syslen' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_SYSLEN
+
+/* Define to 1 if `ut_time' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_TIME
+
+/* Define to 1 if `ut_tv' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_TV
+
+/* Define to 1 if `ut_type' is a member of `struct utmpx'. */
+#undef HAVE_STRUCT_UTMPX_UT_TYPE
+
+/* Define to 1 if `ut_addr' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_ADDR
+
+/* Define to 1 if `ut_addr_v6' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_ADDR_V6
+
+/* Define to 1 if `ut_exit' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_EXIT
+
+/* Define to 1 if `ut_host' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_HOST
+
+/* Define to 1 if `ut_id' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_ID
+
+/* Define to 1 if `ut_pid' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_PID
+
+/* Define to 1 if `ut_time' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_TIME
+
+/* Define to 1 if `ut_tv' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_TV
+
+/* Define to 1 if `ut_type' is a member of `struct utmp'. */
+#undef HAVE_STRUCT_UTMP_UT_TYPE
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/uio.h> header file. */
+#define HAVE_SYS_UIO_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define HAVE_UINT16_T
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define HAVE_UINT32_T
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define HAVE_UINT8_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H
+
+/* Define to 1 if you have the `updwtmp' function. */
+#undef HAVE_UPDWTMP
+
+/* Define to 1 if you have the <util.h> header file. */
+#undef HAVE_UTIL_H
+
+/* Define to 1 if you have the `utmpname' function. */
+#undef HAVE_UTMPNAME
+
+/* Define to 1 if you have the `utmpxname' function. */
+#undef HAVE_UTMPXNAME
+
+/* Define to 1 if you have the <utmpx.h> header file. */
+#undef HAVE_UTMPX_H
+
+/* Define to 1 if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
+
+/* Define to 1 if the system has the type `u_int16_t'. */
+#define HAVE_U_INT16_T
+
+/* Define to 1 if the system has the type `u_int32_t'. */
+#define HAVE_U_INT32_T
+
+/* Define to 1 if the system has the type `u_int8_t'. */
+#define HAVE_U_INT8_T
+
+/* Define to 1 if you have the `writev' function. */
+#define HAVE_WRITEV
+
+/* Define to 1 if you have the `_getpty' function. */
+#undef HAVE__GETPTY
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to the type of arg 1 for `select'. */
+#undef SELECT_TYPE_ARG1
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#undef SELECT_TYPE_ARG234
+
+/* Define to the type of arg 5 for `select'. */
+#undef SELECT_TYPE_ARG5
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Use /dev/ptmx */
+#undef USE_DEV_PTMX
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* type to use in place of socklen_t if not defined */
+#undef socklen_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
diff --git a/includes.h b/includes.h
index f91a2c2..31cea2c 100644
--- a/includes.h
+++ b/includes.h
@@ -156,6 +156,13 @@
 typedef u_int32_t uint32_t;
 #endif /* HAVE_UINT32_T */
 
+#ifdef __Fuchsia__
+/* Fuchsia defines this but doesn't implement it or include related symbols:
+   https://fuchsia.atlassian.net/browse/MG-245
+ */
+#undef SO_PRIORITY
+#endif
+
 #ifdef SO_PRIORITY
 #include <linux/types.h>
 #include <linux/pkt_sched.h>
diff --git a/svr-main.c b/svr-main.c
index d1ee764..666d856 100644
--- a/svr-main.c
+++ b/svr-main.c
@@ -32,9 +32,11 @@
 #include "crypto_desc.h"
 
 static size_t listensockets(int *sock, size_t sockcount, int *maxfd);
+#if !defined(__Fuchsia__)
 static void sigchld_handler(int dummy);
 static void sigsegv_handler(int);
 static void sigintterm_handler(int fish);
+#endif
 #ifdef INETD_MODE
 static void main_inetd(void);
 #endif
@@ -331,7 +333,7 @@
 }
 #endif /* NON_INETD_MODE */
 
-
+#if !defined(__Fuchsia__)
 /* catch + reap zombie children */
 static void sigchld_handler(int UNUSED(unused)) {
 	struct sigaction sa_chld;
@@ -361,10 +363,11 @@
 
 	exitflag = 1;
 }
+#endif
 
 /* Things used by inetd and non-inetd modes */
 static void commonsetup() {
-
+#if !defined(__Fuchsia__)
 	struct sigaction sa_chld;
 #ifndef DISABLE_SYSLOG
 	if (opts.usingsyslog) {
@@ -391,6 +394,7 @@
 	if (signal(SIGSEGV, sigsegv_handler) == SIG_ERR) {
 		dropbear_exit("signal() error");
 	}
+#endif
 
 	crypto_init();
 
diff --git a/svr-session.c b/svr-session.c
index febe79a..51fc517 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -220,7 +220,12 @@
 	if (!opts.usingsyslog || havetrace) {
 		struct tm * local_tm = NULL;
 		timesec = time(NULL);
+#if !defined(__Fuchsia__)
+		/* Fuchsia's date/time support is incomplete:
+		   https://fuchsia.atlassian.net/browse/MG-192
+		 */
 		local_tm = localtime(&timesec);
+#endif
 		if (local_tm == NULL
 			|| strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S", 
 						local_tm) == 0)