commit
51ac4da8fc
@ -16,7 +16,7 @@ myCflags=""
|
||||
myCflags="$myCflags -O2 ${2}"
|
||||
myCflags="$myCflags -pipe -Werror -Wpointer-arith -Winit-self -Wextra -Wall -Wformat -Wformat-security"
|
||||
|
||||
CFLAGS="$myCflags" cov-build --dir cov-int make -f makefile -j3 IGNORE_SPEED=1 1>gcc_1.txt
|
||||
CFLAGS="$myCflags" cov-build --dir cov-int make -f makefile.unix $MAKE_OPTS IGNORE_SPEED=1 1>gcc_1.txt
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
|
@ -47,8 +47,8 @@ $(LIBNAME): $(OBJECTS)
|
||||
|
||||
install: .common_install
|
||||
sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > libtomcrypt.pc
|
||||
install -d $(DESTDIR)/$(LIBPATH)/pkgconfig
|
||||
install -m 644 libtomcrypt.pc $(DESTDIR)/$(LIBPATH)/pkgconfig/
|
||||
install -d $(DESTDIR)$(LIBPATH)/pkgconfig
|
||||
install -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
|
||||
|
||||
install_bins: .common_install_bins
|
||||
|
||||
|
@ -267,22 +267,22 @@ clean:
|
||||
-@rm -f $(OBJECTS) $(TOBJECTS)
|
||||
-@rm -f $(LIBMAIN_S)
|
||||
-@rm -f demos/*.o *_tv.txt
|
||||
-@rm -f test tv_gen hashsum crypt small timing
|
||||
-@rm -f test.exe tv_gen.exe hashsum.exe crypt.exe small.exe timing.exe
|
||||
-@rm -f test tv_gen hashsum ltcrypt small timing
|
||||
-@rm -f test.exe tv_gen.exe hashsum.exe ltcrypt.exe small.exe timing.exe
|
||||
|
||||
#Install the library + headers
|
||||
install: $(LIBMAIN_S) $(HEADERS)
|
||||
@mkdir -p $(DESTDIR)/$(INCPATH) $(DESTDIR)/$(LIBPATH)/pkgconfig
|
||||
@cp $(LIBMAIN_S) $(DESTDIR)/$(LIBPATH)/
|
||||
@cp $(HEADERS) $(DESTDIR)/$(INCPATH)/
|
||||
@sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > $(DESTDIR)/$(LIBPATH)/pkgconfig/libtomcrypt.pc
|
||||
@mkdir -p $(DESTDIR)$(INCPATH) $(DESTDIR)$(LIBPATH)/pkgconfig
|
||||
@cp $(LIBMAIN_S) $(DESTDIR)$(LIBPATH)/
|
||||
@cp $(HEADERS) $(DESTDIR)$(INCPATH)/
|
||||
@sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc
|
||||
|
||||
#Install useful tools
|
||||
install_bins: hashsum
|
||||
@mkdir -p $(DESTDIR)/$(BINPATH)
|
||||
@cp hashsum $(DESTDIR)/$(BINPATH)/
|
||||
@mkdir -p $(DESTDIR)$(BINPATH)
|
||||
@cp hashsum $(DESTDIR)$(BINPATH)/
|
||||
|
||||
#Install documentation
|
||||
install_docs: doc/crypt.pdf
|
||||
@mkdir -p $(DESTDIR)/$(DATAPATH)
|
||||
@cp doc/crypt.pdf $(DESTDIR)/$(DATAPATH)/
|
||||
@mkdir -p $(DESTDIR)$(DATAPATH)
|
||||
@cp doc/crypt.pdf $(DESTDIR)$(DATAPATH)/
|
||||
|
@ -362,18 +362,18 @@ install_all: install install_bins install_docs install_test
|
||||
INSTALL_OPTS ?= -m 644
|
||||
|
||||
.common_install: $(LIBNAME)
|
||||
install -d $(DESTDIR)/$(INCPATH)
|
||||
install -d $(DESTDIR)/$(LIBPATH)
|
||||
$(INSTALL_CMD) $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)/$(LIBPATH)/$(LIBNAME)
|
||||
install -m 644 $(HEADERS) $(DESTDIR)/$(INCPATH)
|
||||
install -d $(DESTDIR)$(INCPATH)
|
||||
install -d $(DESTDIR)$(LIBPATH)
|
||||
$(INSTALL_CMD) $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
|
||||
install -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
|
||||
|
||||
.common_install_bins: $(USEFUL_DEMOS)
|
||||
install -d $(BINPATH)
|
||||
$(INSTALL_CMD) -m 775 $(USEFUL_DEMOS) $(DESTDIR)/$(BINPATH)
|
||||
install -d $(DESTDIR)$(BINPATH)
|
||||
$(INSTALL_CMD) -m 775 $(USEFUL_DEMOS) $(DESTDIR)$(BINPATH)
|
||||
|
||||
install_docs: doc/crypt.pdf
|
||||
install -d $(DATAPATH)
|
||||
install -m 644 doc/crypt.pdf $(DESTDIR)/$(DATAPATH)
|
||||
install -d $(DESTDIR)$(DATAPATH)
|
||||
install -m 644 doc/crypt.pdf $(DESTDIR)$(DATAPATH)
|
||||
|
||||
install_hooks:
|
||||
for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
|
||||
|
@ -342,7 +342,7 @@ int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen
|
||||
unsigned long fill = BLAKE2B_BLOCKBYTES - left;
|
||||
if (inlen > fill) {
|
||||
md->blake2b.curlen = 0;
|
||||
XMEMCPY(md->blake2b.buf + left, in, fill); /* Fill buffer */
|
||||
XMEMCPY(md->blake2b.buf + (left % sizeof(md->blake2b.buf)), in, fill); /* Fill buffer */
|
||||
blake2b_increment_counter(md, BLAKE2B_BLOCKBYTES);
|
||||
blake2b_compress(md, md->blake2b.buf); /* Compress */
|
||||
in += fill;
|
||||
|
@ -330,7 +330,7 @@ int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen
|
||||
unsigned long fill = BLAKE2S_BLOCKBYTES - left;
|
||||
if (inlen > fill) {
|
||||
md->blake2s.curlen = 0;
|
||||
XMEMCPY(md->blake2s.buf + left, in, fill); /* Fill buffer */
|
||||
XMEMCPY(md->blake2s.buf + (left % sizeof(md->blake2s.buf)), in, fill); /* Fill buffer */
|
||||
blake2s_increment_counter(md, BLAKE2S_BLOCKBYTES);
|
||||
blake2s_compress(md, md->blake2s.buf); /* Compress */
|
||||
in += fill;
|
||||
|
@ -299,11 +299,13 @@ int ocb3_decrypt_verify_memory(int cipher,
|
||||
|
||||
int ocb3_test(void);
|
||||
|
||||
#ifdef LTC_SOURCE
|
||||
/* internal helper functions */
|
||||
int ocb3_int_aad_add_block(ocb3_state *ocb, const unsigned char *aad_block);
|
||||
void ocb3_int_calc_offset_zero(ocb3_state *ocb, const unsigned char *nonce, unsigned long noncelen);
|
||||
int ocb3_int_ntz(unsigned long x);
|
||||
void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len);
|
||||
#endif /* LTC_SOURCE */
|
||||
|
||||
#endif /* LTC_OCB3_MODE */
|
||||
|
||||
|
@ -21,6 +21,9 @@ enum {
|
||||
#define PK_MAX_RETRIES 20
|
||||
|
||||
int rand_prime(void *N, long len, prng_state *prng, int wprng);
|
||||
|
||||
#ifdef LTC_SOURCE
|
||||
/* internal helper functions */
|
||||
int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng);
|
||||
int rand_bn_range(void *N, void *limit, prng_state *prng, int wprng);
|
||||
|
||||
@ -36,6 +39,7 @@ typedef struct Oid {
|
||||
} oid_st;
|
||||
|
||||
int pk_get_oid(int pk, oid_st *st);
|
||||
#endif /* LTC_SOURCE */
|
||||
|
||||
/* ---- RSA ---- */
|
||||
#ifdef LTC_MRSA
|
||||
@ -183,10 +187,6 @@ int katja_import(const unsigned char *in, unsigned long inlen, katja_key *key);
|
||||
/* ---- DH Routines ---- */
|
||||
#ifdef LTC_MDH
|
||||
|
||||
#ifndef DH_BUF_SIZE
|
||||
#define DH_BUF_SIZE 2100
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
char *name, *base, *prime;
|
||||
@ -215,7 +215,7 @@ int dh_shared_secret(dh_key *private_key, dh_key *public_key,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
|
||||
#ifdef LTC_SOURCE
|
||||
/* INTERNAL ONLY - it should be later moved to src/headers/tomcrypt_internal.h */
|
||||
/* internal helper functions */
|
||||
int dh_check_pubkey(dh_key *key);
|
||||
#endif
|
||||
|
||||
@ -528,6 +528,9 @@ int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen,
|
||||
int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
||||
unsigned long *outlen);
|
||||
|
||||
|
||||
#ifdef LTC_SOURCE
|
||||
/* internal helper functions */
|
||||
/* SUBJECT PUBLIC KEY INFO */
|
||||
int der_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen,
|
||||
unsigned int algorithm, void* public_key, unsigned long public_key_len,
|
||||
@ -536,6 +539,7 @@ int der_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen
|
||||
int der_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen,
|
||||
unsigned int algorithm, void* public_key, unsigned long* public_key_len,
|
||||
unsigned long parameters_type, ltc_asn1_list* parameters, unsigned long parameters_len);
|
||||
#endif /* LTC_SOURCE */
|
||||
|
||||
/* SET */
|
||||
#define der_decode_set(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, 0)
|
||||
@ -613,8 +617,12 @@ int der_decode_teletex_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_length_teletex_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen);
|
||||
|
||||
#ifdef LTC_SOURCE
|
||||
/* internal helper functions */
|
||||
int der_teletex_char_encode(int c);
|
||||
int der_teletex_value_decode(int v);
|
||||
#endif /* LTC_SOURCE */
|
||||
|
||||
|
||||
/* PRINTABLE STRING */
|
||||
int der_encode_printable_string(const unsigned char *in, unsigned long inlen,
|
||||
@ -646,7 +654,10 @@ int der_encode_utf8_string(const wchar_t *in, unsigned long inlen,
|
||||
int der_decode_utf8_string(const unsigned char *in, unsigned long inlen,
|
||||
wchar_t *out, unsigned long *outlen);
|
||||
unsigned long der_utf8_charsize(const wchar_t c);
|
||||
#ifdef LTC_SOURCE
|
||||
/* internal helper functions */
|
||||
int der_utf8_valid_char(const wchar_t c);
|
||||
#endif /* LTC_SOURCE */
|
||||
int der_length_utf8_string(const wchar_t *in, unsigned long noctets, unsigned long *outlen);
|
||||
|
||||
|
||||
|
@ -97,9 +97,11 @@ int rsa_exptmod(const unsigned char *in, unsigned long inlen,
|
||||
}
|
||||
#endif /* LTC_RSA_BLINDING */
|
||||
|
||||
has_crt_parameters = (key->dP != NULL) && (mp_get_digit_count(key->dP) != 0) &&
|
||||
(key->dQ != NULL) && (mp_get_digit_count(key->dQ) != 0) &&
|
||||
(key->qP != NULL) && (mp_get_digit_count(key->qP) != 0);
|
||||
has_crt_parameters = (key->p != NULL) && (mp_get_digit_count(key->p) != 0) &&
|
||||
(key->q != NULL) && (mp_get_digit_count(key->q) != 0) &&
|
||||
(key->dP != NULL) && (mp_get_digit_count(key->dP) != 0) &&
|
||||
(key->dQ != NULL) && (mp_get_digit_count(key->dQ) != 0) &&
|
||||
(key->qP != NULL) && (mp_get_digit_count(key->qP) != 0);
|
||||
|
||||
if (!has_crt_parameters) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user