From 5be35dba6b72a9b8ee1215a5617dd1b770aca050 Mon Sep 17 00:00:00 2001 From: Jbop1626 <34898270+jbop1626@users.noreply.github.com> Date: Tue, 5 Nov 2019 14:23:17 -0500 Subject: [PATCH] Add build dirs/scripts etc. --- bin/include/ecc/ecc.h | 103 ++++++ bin/include/mini-gmp/mini-gmp.h | 298 ++++++++++++++++++ bin/include/ninty-233.h | 59 ++++ build/linux/makefile | 54 ++++ build/msvc/ninty-233-c.sln | 38 +++ .../msvc/ninty-233-dll/ninty-233-dll.vcxproj | 159 ++++++++++ .../ninty-233-static/ninty-233-static.vcxproj | 156 +++++++++ 7 files changed, 867 insertions(+) create mode 100644 bin/include/ecc/ecc.h create mode 100644 bin/include/mini-gmp/mini-gmp.h create mode 100644 bin/include/ninty-233.h create mode 100644 build/linux/makefile create mode 100644 build/msvc/ninty-233-c.sln create mode 100644 build/msvc/ninty-233-dll/ninty-233-dll.vcxproj create mode 100644 build/msvc/ninty-233-static/ninty-233-static.vcxproj diff --git a/bin/include/ecc/ecc.h b/bin/include/ecc/ecc.h new file mode 100644 index 0000000..92aff54 --- /dev/null +++ b/bin/include/ecc/ecc.h @@ -0,0 +1,103 @@ +/* + ecc.h - definitions required for ECC operations using keys + defined with sect233r1 / NIST B-233 + + Copyright © 2018, 2019 Jbop (https://github.com/jbop1626) + + This file is a part of ninty-233. + + ninty-233 is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ninty-233 is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef NINTY_233_ECC_H +#define NINTY_233_ECC_H + +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef uint32_t element[8]; + +typedef struct { + element x; + element y; +} ec_point; + +/* + sect233r1 - domain parameters over GF(2^m). + Defined in "Standards for Efficient Cryptography 2 (SEC 2)" v2.0, pp. 19-20 + Not all are currently used. + (Actual definitions are in ecc.c) +*/ +extern const element POLY_F; +extern const element POLY_R; +extern const element A_COEFF; +extern const element B_COEFF; +extern const element G_X; +extern const element G_Y; +extern const element G_ORDER; /* +extern const uint32_t COFACTOR; */ + +/* + Printing +*/ +void print_element(const element a); +void print_point(const ec_point * a); + +/* + Helper functions for working with elements in GF(2^m) +*/ +int gf2m_is_equal(const element a, const element b); +void gf2m_set_zero(element a); +void gf2m_copy(const element src, element dst); +int gf2m_get_bit(const element a, int index); +void gf2m_left_shift(element a, int shift); +int gf2m_is_one(const element a); +int gf2m_degree(const element a); +void gf2m_swap(element a, element b); + +/* + Arithmetic operations on elements in GF(2^m) +*/ +void gf2m_add(const element a, const element b, element result); +void gf2m_inv(const element a, element result); +void gf2m_mul(const element a, const element b, element result); +void gf2m_div(const element a, const element b, element result); + +/* + Operations on points on the elliptic curve + y^2 + xy = x^3 + ax^2 + b over GF(2^m) +*/ +void ec_point_copy(const ec_point * src, ec_point * dst); +int ec_point_is_equal(const ec_point * a, const ec_point * b); +void ec_point_neg(const ec_point * a, ec_point * result); +void ec_point_double(const ec_point * a, ec_point * result); +void ec_point_add(const ec_point * a, const ec_point * b, ec_point * result); +void ec_point_mul(const element a, const ec_point * b, ec_point * result); +int ec_point_on_curve(const ec_point * a); + +/* + I/O Helpers +*/ +void os_to_elem(const uint8_t * src_os, element dst_elem); +void os_to_point(const uint8_t * src_os, ec_point * dst_point); +void elem_to_os(const element src_elem, uint8_t * dst_os); +void point_to_os(const ec_point * src_point, uint8_t * dst_os); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/bin/include/mini-gmp/mini-gmp.h b/bin/include/mini-gmp/mini-gmp.h new file mode 100644 index 0000000..18d94ed --- /dev/null +++ b/bin/include/mini-gmp/mini-gmp.h @@ -0,0 +1,298 @@ +/* mini-gmp, a minimalistic implementation of a GNU GMP subset. + +Copyright 2011-2015 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + +/* About mini-gmp: This is a minimal implementation of a subset of the + GMP interface. It is intended for inclusion into applications which + have modest bignums needs, as a fallback when the real GMP library + is not installed. + + This file defines the public interface. */ + +#ifndef MINI_GMP_H +#define MINI_GMP_H + +/* For size_t */ +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +void mp_set_memory_functions (void *(*) (size_t), + void *(*) (void *, size_t, size_t), + void (*) (void *, size_t)); + +void mp_get_memory_functions (void *(**) (size_t), + void *(**) (void *, size_t, size_t), + void (**) (void *, size_t)); + +typedef unsigned long mp_limb_t; +typedef long mp_size_t; +typedef unsigned long mp_bitcnt_t; + +typedef mp_limb_t *mp_ptr; +typedef const mp_limb_t *mp_srcptr; + +typedef struct +{ + int _mp_alloc; /* Number of *limbs* allocated and pointed + to by the _mp_d field. */ + int _mp_size; /* abs(_mp_size) is the number of limbs the + last field points to. If _mp_size is + negative this is a negative number. */ + mp_limb_t *_mp_d; /* Pointer to the limbs. */ +} mpz_struct; + +typedef mpz_struct mpz_t[1]; + +typedef mpz_struct *mpz_ptr; +typedef const mpz_struct *mpz_srcptr; + +extern const int mp_bits_per_limb; + +void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t); +void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t); +void mpn_zero (mp_ptr, mp_size_t); + +int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t); +int mpn_zero_p (mp_srcptr, mp_size_t); + +mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); + +mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); + +mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); +mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); + +mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t); +void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t); +void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t); +int mpn_perfect_square_p (mp_srcptr, mp_size_t); +mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t); + +mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); +mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int); + +mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t); +mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t); + +void mpn_com (mp_ptr, mp_srcptr, mp_size_t); +mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t); + +mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t); + +mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t); +#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0) + +size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t); +mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int); + +void mpz_init (mpz_t); +void mpz_init2 (mpz_t, mp_bitcnt_t); +void mpz_clear (mpz_t); + +#define mpz_odd_p(z) (((z)->_mp_size != 0) & (int) (z)->_mp_d[0]) +#define mpz_even_p(z) (! mpz_odd_p (z)) + +int mpz_sgn (const mpz_t); +int mpz_cmp_si (const mpz_t, long); +int mpz_cmp_ui (const mpz_t, unsigned long); +int mpz_cmp (const mpz_t, const mpz_t); +int mpz_cmpabs_ui (const mpz_t, unsigned long); +int mpz_cmpabs (const mpz_t, const mpz_t); +int mpz_cmp_d (const mpz_t, double); +int mpz_cmpabs_d (const mpz_t, double); + +void mpz_abs (mpz_t, const mpz_t); +void mpz_neg (mpz_t, const mpz_t); +void mpz_swap (mpz_t, mpz_t); + +void mpz_add_ui (mpz_t, const mpz_t, unsigned long); +void mpz_add (mpz_t, const mpz_t, const mpz_t); +void mpz_sub_ui (mpz_t, const mpz_t, unsigned long); +void mpz_ui_sub (mpz_t, unsigned long, const mpz_t); +void mpz_sub (mpz_t, const mpz_t, const mpz_t); + +void mpz_mul_si (mpz_t, const mpz_t, long int); +void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_mul (mpz_t, const mpz_t, const mpz_t); +void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_addmul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_addmul (mpz_t, const mpz_t, const mpz_t); +void mpz_submul_ui (mpz_t, const mpz_t, unsigned long int); +void mpz_submul (mpz_t, const mpz_t, const mpz_t); + +void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t); +void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t); +void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t); +void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t); +void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t); +void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t); + +void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t); +void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t); + +void mpz_mod (mpz_t, const mpz_t, const mpz_t); + +void mpz_divexact (mpz_t, const mpz_t, const mpz_t); + +int mpz_divisible_p (const mpz_t, const mpz_t); +int mpz_congruent_p (const mpz_t, const mpz_t, const mpz_t); + +unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); +unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); +unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long); +unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long); +unsigned long mpz_cdiv_ui (const mpz_t, unsigned long); +unsigned long mpz_fdiv_ui (const mpz_t, unsigned long); +unsigned long mpz_tdiv_ui (const mpz_t, unsigned long); + +unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long); + +void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long); + +int mpz_divisible_ui_p (const mpz_t, unsigned long); + +unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long); +void mpz_gcd (mpz_t, const mpz_t, const mpz_t); +void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t); +void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long); +void mpz_lcm (mpz_t, const mpz_t, const mpz_t); +int mpz_invert (mpz_t, const mpz_t, const mpz_t); + +void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t); +void mpz_sqrt (mpz_t, const mpz_t); +int mpz_perfect_square_p (const mpz_t); + +void mpz_pow_ui (mpz_t, const mpz_t, unsigned long); +void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long); +void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t); +void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t); + +void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long); +int mpz_root (mpz_t, const mpz_t, unsigned long); + +void mpz_fac_ui (mpz_t, unsigned long); +void mpz_bin_uiui (mpz_t, unsigned long, unsigned long); + +int mpz_probab_prime_p (const mpz_t, int); + +int mpz_tstbit (const mpz_t, mp_bitcnt_t); +void mpz_setbit (mpz_t, mp_bitcnt_t); +void mpz_clrbit (mpz_t, mp_bitcnt_t); +void mpz_combit (mpz_t, mp_bitcnt_t); + +void mpz_com (mpz_t, const mpz_t); +void mpz_and (mpz_t, const mpz_t, const mpz_t); +void mpz_ior (mpz_t, const mpz_t, const mpz_t); +void mpz_xor (mpz_t, const mpz_t, const mpz_t); + +mp_bitcnt_t mpz_popcount (const mpz_t); +mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t); +mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t); +mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t); + +int mpz_fits_slong_p (const mpz_t); +int mpz_fits_ulong_p (const mpz_t); +long int mpz_get_si (const mpz_t); +unsigned long int mpz_get_ui (const mpz_t); +double mpz_get_d (const mpz_t); +size_t mpz_size (const mpz_t); +mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t); + +void mpz_realloc2 (mpz_t, mp_bitcnt_t); +mp_srcptr mpz_limbs_read (mpz_srcptr); +mp_ptr mpz_limbs_modify (mpz_t, mp_size_t); +mp_ptr mpz_limbs_write (mpz_t, mp_size_t); +void mpz_limbs_finish (mpz_t, mp_size_t); +mpz_srcptr mpz_roinit_n (mpz_t, mp_srcptr, mp_size_t); + +#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }} + +void mpz_set_si (mpz_t, signed long int); +void mpz_set_ui (mpz_t, unsigned long int); +void mpz_set (mpz_t, const mpz_t); +void mpz_set_d (mpz_t, double); + +void mpz_init_set_si (mpz_t, signed long int); +void mpz_init_set_ui (mpz_t, unsigned long int); +void mpz_init_set (mpz_t, const mpz_t); +void mpz_init_set_d (mpz_t, double); + +size_t mpz_sizeinbase (const mpz_t, int); +char *mpz_get_str (char *, int, const mpz_t); +int mpz_set_str (mpz_t, const char *, int); +int mpz_init_set_str (mpz_t, const char *, int); + +/* This long list taken from gmp.h. */ +/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4, + defines EOF but not FILE. */ +#if defined (FILE) \ + || defined (H_STDIO) \ + || defined (_H_STDIO) /* AIX */ \ + || defined (_STDIO_H) /* glibc, Sun, SCO */ \ + || defined (_STDIO_H_) /* BSD, OSF */ \ + || defined (__STDIO_H) /* Borland */ \ + || defined (__STDIO_H__) /* IRIX */ \ + || defined (_STDIO_INCLUDED) /* HPUX */ \ + || defined (__dj_include_stdio_h_) /* DJGPP */ \ + || defined (_FILE_DEFINED) /* Microsoft */ \ + || defined (__STDIO__) /* Apple MPW MrC */ \ + || defined (_MSL_STDIO_H) /* Metrowerks */ \ + || defined (_STDIO_H_INCLUDED) /* QNX4 */ \ + || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \ + || defined (__STDIO_LOADED) /* VMS */ +size_t mpz_out_str (FILE *, int, const mpz_t); +#endif + +void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *); +void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t); + +#if defined (__cplusplus) +} +#endif +#endif /* MINI_GMP_H */ diff --git a/bin/include/ninty-233.h b/bin/include/ninty-233.h new file mode 100644 index 0000000..7733818 --- /dev/null +++ b/bin/include/ninty-233.h @@ -0,0 +1,59 @@ +/* + ninty-233 + Library for ECC operations using keys defined with + sect233r1 / NIST B-233 -- the curve/domain parameters + used by Nintendo in the iQue Player and Wii. + + Copyright © 2018, 2019 Jbop (https://github.com/jbop1626) + + This file is a part of ninty-233. + + ninty-233 is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ninty-233 is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +#ifndef NINTY_233_H +#define NINTY_233_H + +#include + +#include "ecc/ecc.h" +#include "mini-gmp/mini-gmp.h" + +#if defined (__cplusplus) +extern "C" { +#endif +/* + Multi-precision integer <--> GF(2^m) element conversions +*/ +void mpz_to_gf2m(const mpz_t src, element dst); +void gf2m_to_mpz(const element src, mpz_t dst); + +/* + SHA-1 result as multi-precision integer +*/ +#define NOT_IQUE_HASH 0 +#define IQUE_HASH 1 +void sha1(const uint8_t * input, uint32_t input_length, unsigned ique_flag, mpz_t hash_out); + +/* + ECC algorithms +*/ +void ecdh(const element private_key, const ec_point * public_key, ec_point * shared_secret_output); +void ecdsa_sign(const mpz_t hash, const element private_key, element r_out, element s_out); +int ecdsa_verify(const mpz_t hash, const ec_point * public_key, const element r_input, const element s_input); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/build/linux/makefile b/build/linux/makefile new file mode 100644 index 0000000..a255e23 --- /dev/null +++ b/build/linux/makefile @@ -0,0 +1,54 @@ +MAJOR = 1 +MINOR = 0 +PATCH = 0 +VERSION = .$(MAJOR).$(MINOR).$(PATCH) + +STATIC_LIB = libninty-233.a +SHARED_LIB = libninty-233.so + +OUTDIR = ../../bin/linux/ +ST_OBJDIR = $(OUTDIR)static_obj/ +SH_OBJDIR = $(OUTDIR)shared_obj/ +SRCDIR = ../../src/ + +CC = gcc +CFLAGS = -std=c99 -Wall -Wextra -pedantic +SONAME = $(SHARED_LIB).$(MAJOR) +SH_OBJ = $(SH_OBJDIR)ninty-233.o $(SH_OBJDIR)ecc.o $(SH_OBJDIR)sha1.o $(SH_OBJDIR)mini-gmp.o +ST_OBJ = $(ST_OBJDIR)ninty-233.o $(ST_OBJDIR)ecc.o $(ST_OBJDIR)sha1.o $(ST_OBJDIR)mini-gmp.o + +.PHONY: all +all: $(STATIC_LIB) $(SHARED_LIB) + +.PHONY: static +static: $(STATIC_LIB) + +.PHONY: shared +shared: $(SHARED_LIB) + +$(STATIC_LIB): $(ST_OBJ) + ar rcs $(OUTDIR)$(STATIC_LIB) $^ + +$(SHARED_LIB): $(SH_OBJ) + $(CC) -shared -Wl,-soname,$(SONAME) -o $(OUTDIR)$(SHARED_LIB)$(VERSION) $^ + +$(SH_OBJDIR)%.o: + @mkdir -p $(SH_OBJDIR) + $(CC) $(CFLAGS) -fPIC -c -o $@ $< +$(SH_OBJDIR)ninty-233.o: $(SRCDIR)ninty-233.c $(SRCDIR)ninty-233.h $(SRCDIR)ecc/ecc.h $(SRCDIR)sha1/sha1.h $(SRCDIR)mini-gmp/mini-gmp.h +$(SH_OBJDIR)ecc.o: $(SRCDIR)ecc/ecc.c $(SRCDIR)ecc/ecc.h +$(SH_OBJDIR)sha1.o: $(SRCDIR)sha1/sha1.c $(SRCDIR)sha1/sha1.h +$(SH_OBJDIR)mini-gmp.o: $(SRCDIR)mini-gmp/mini-gmp.c $(SRCDIR)mini-gmp/mini-gmp.h + +$(ST_OBJDIR)%.o: + @mkdir -p $(ST_OBJDIR) + $(CC) $(CFLAGS) -c -o $@ $< +$(ST_OBJDIR)ninty-233.o: $(SRCDIR)ninty-233.c $(SRCDIR)ninty-233.h $(SRCDIR)ecc/ecc.h $(SRCDIR)sha1/sha1.h $(SRCDIR)mini-gmp/mini-gmp.h +$(ST_OBJDIR)ecc.o: $(SRCDIR)ecc/ecc.c $(SRCDIR)ecc/ecc.h +$(ST_OBJDIR)sha1.o: $(SRCDIR)sha1/sha1.c $(SRCDIR)sha1/sha1.h +$(ST_OBJDIR)mini-gmp.o: $(SRCDIR)mini-gmp/mini-gmp.c $(SRCDIR)mini-gmp/mini-gmp.h + +.PHONY: clean +clean: + rm -f $(OUTDIR)$(STATIC_LIB) $(OUTDIR)$(SHARED_LIB) $(ST_OBJDIR)*.o $(SH_OBJDIR)*.o + diff --git a/build/msvc/ninty-233-c.sln b/build/msvc/ninty-233-c.sln new file mode 100644 index 0000000..c1bb078 --- /dev/null +++ b/build/msvc/ninty-233-c.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ninty-233-static", "ninty-233-static\ninty-233-static.vcxproj", "{026B478D-EEFC-47D5-B139-E49BD902AA6F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ninty-233-dll", "ninty-233-dll\ninty-233-dll.vcxproj", "{F7861F70-0E3A-492D-986D-6DE730767CDD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Debug|x64.ActiveCfg = Debug|x64 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Debug|x64.Build.0 = Debug|x64 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Debug|x86.ActiveCfg = Debug|Win32 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Debug|x86.Build.0 = Debug|Win32 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Release|x64.ActiveCfg = Release|x64 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Release|x64.Build.0 = Release|x64 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Release|x86.ActiveCfg = Release|Win32 + {026B478D-EEFC-47D5-B139-E49BD902AA6F}.Release|x86.Build.0 = Release|Win32 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Debug|x64.ActiveCfg = Debug|x64 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Debug|x64.Build.0 = Debug|x64 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Debug|x86.ActiveCfg = Debug|Win32 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Debug|x86.Build.0 = Debug|Win32 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Release|x64.ActiveCfg = Release|x64 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Release|x64.Build.0 = Release|x64 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Release|x86.ActiveCfg = Release|Win32 + {F7861F70-0E3A-492D-986D-6DE730767CDD}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/msvc/ninty-233-dll/ninty-233-dll.vcxproj b/build/msvc/ninty-233-dll/ninty-233-dll.vcxproj new file mode 100644 index 0000000..7654fd5 --- /dev/null +++ b/build/msvc/ninty-233-dll/ninty-233-dll.vcxproj @@ -0,0 +1,159 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {F7861F70-0E3A-492D-986D-6DE730767CDD} + ninty233dll + 8.1 + ninty-233-dll + + + + DynamicLibrary + true + v141 + MultiByte + + + DynamicLibrary + false + v141 + true + MultiByte + + + DynamicLibrary + true + v141 + MultiByte + + + DynamicLibrary + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\..\bin\msvc\out_dll\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + $(SolutionDir)..\..\bin\msvc\out_dll\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + $(SolutionDir)..\..\bin\msvc\out_dll\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + $(SolutionDir)..\..\bin\msvc\out_dll\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + + EnableAllWarnings + Disabled + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions) + + + DebugFastLink + + + + + EnableAllWarnings + Disabled + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions) + + + + + EnableAllWarnings + MaxSpeed + true + true + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions) + + + true + true + + + + + EnableAllWarnings + MaxSpeed + true + true + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions) + + + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/msvc/ninty-233-static/ninty-233-static.vcxproj b/build/msvc/ninty-233-static/ninty-233-static.vcxproj new file mode 100644 index 0000000..a23ad4d --- /dev/null +++ b/build/msvc/ninty-233-static/ninty-233-static.vcxproj @@ -0,0 +1,156 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {026B478D-EEFC-47D5-B139-E49BD902AA6F} + ninty233static + 8.1 + ninty-233-static + + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + StaticLibrary + true + v141 + MultiByte + + + StaticLibrary + false + v141 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + $(SolutionDir)..\..\bin\msvc\out_static\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + $(SolutionDir)..\..\bin\msvc\out_static\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + $(SolutionDir)..\..\bin\msvc\out_static\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + $(SolutionDir)..\..\bin\msvc\out_static\$(Configuration)\ + $(SolutionDir)..\..\bin\msvc\$(ProjectName)\$(Configuration)\ + ninty-233 + + + + EnableAllWarnings + Disabled + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + + + + + EnableAllWarnings + Disabled + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + + + + + EnableAllWarnings + MaxSpeed + true + true + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + + + true + true + + + + + EnableAllWarnings + MaxSpeed + true + true + false + CompileAsC + _CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) + + + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file