Package list libcryptx-perl / c1b3588
Update upstream source from tag 'upstream/0.061' Update to upstream version '0.061' with Debian dir bc4a3928ccd97d11728bc3a5e23ae22d1728f988 gregor herrmann 3 years ago
643 changed file(s) with 1929 addition(s) and 1858 deletion(s). Raw diff Collapse all Expand all
00 Changes for CryptX
1
2 0.061 2018-06-07
3 - bundled libtommath update (+stdint.h workaround)
4 - bundled libtomcrypt update (+necessary adaptation)
5 - fix #43 HP-UX 11.11 C-ANSI-C has no stdint.h
6 - fix #44 Anonymous unions are GNU and C11 (troubles with HP C/aC++, HP-UX 11.31/IA64)
17
28 0.060 2018-05-01
39 - bundled libtomcrypt update
254254 src/ltc/headers/tomcrypt_misc.h
255255 src/ltc/headers/tomcrypt_pk.h
256256 src/ltc/headers/tomcrypt_pkcs.h
257 src/ltc/headers/tomcrypt_private.h
257258 src/ltc/headers/tomcrypt_prng.h
258259 src/ltc/mac/blake2/blake2bmac.c
259260 src/ltc/mac/blake2/blake2bmac_file.c
482483 src/ltc/pk/ecc/ecc_free.c
483484 src/ltc/pk/ecc/ecc_get_curve.c
484485 src/ltc/pk/ecc/ecc_get_key.c
486 src/ltc/pk/ecc/ecc_get_oid_str.c
485487 src/ltc/pk/ecc/ecc_get_size.c
486488 src/ltc/pk/ecc/ecc_import.c
487489 src/ltc/pk/ecc/ecc_import_openssl.c
551553 src/ltc/stream/salsa20/salsa20_ivctr64.c
552554 src/ltc/stream/salsa20/salsa20_keystream.c
553555 src/ltc/stream/salsa20/salsa20_setup.c
556 src/ltc/stream/salsa20/xsalsa20_setup.c
554557 src/ltc/stream/sober128/sober128_stream.c
555558 src/ltc/stream/sober128/sober128tab.c
556559 src/ltc/stream/sosemanuk/sosemanuk.c
595598 src/ltm/bn_mp_gcd.c
596599 src/ltm/bn_mp_get_int.c
597600 src/ltm/bn_mp_get_long.c
598 src/ltm/bn_mp_get_long_long.c
599601 src/ltm/bn_mp_grow.c
600602 src/ltm/bn_mp_import.c
601603 src/ltm/bn_mp_init.c
652654 src/ltm/bn_mp_set.c
653655 src/ltm/bn_mp_set_int.c
654656 src/ltm/bn_mp_set_long.c
655 src/ltm/bn_mp_set_long_long.c
656657 src/ltm/bn_mp_shrink.c
657658 src/ltm/bn_mp_signed_bin_size.c
658659 src/ltm/bn_mp_sqr.c
4444 "url" : "https://github.com/DCIT/perl-CryptX"
4545 }
4646 },
47 "version" : "0.060",
47 "version" : "0.061",
4848 "x_serialization_backend" : "JSON::PP version 2.94"
4949 }
2121 resources:
2222 bugtracker: https://github.com/DCIT/perl-CryptX/issues
2323 repository: https://github.com/DCIT/perl-CryptX
24 version: '0.060'
24 version: '0.061'
2525 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
4949 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
5050 rv = ecc_import_openssl(data, (unsigned long)data_len, &self->key);
5151 if (rv != CRYPT_OK) croak("FATAL: ecc_import_openssl failed: %s", error_to_string(rv));
52 XPUSHs(ST(0)); /* return self */
53 }
54
55 void
56 _import_old(Crypt::PK::ECC self, SV * key_data)
57 PPCODE:
58 {
59 int rv;
60 unsigned char *data=NULL;
61 STRLEN data_len=0;
62
63 data = (unsigned char *)SvPVbyte(key_data, data_len);
64 if (self->key.type != -1) { ecc_free(&self->key); self->key.type = -1; }
65 rv = ecc_import(data, (unsigned long)data_len, &self->key);
66 if (rv != CRYPT_OK) croak("FATAL: ecc_import failed: %s", error_to_string(rv));
5267 XPUSHs(ST(0)); /* return self */
5368 }
5469
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( ccm_encrypt_authenticate ccm_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( chacha20poly1305_encrypt_authenticate chacha20poly1305_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( eax_encrypt_authenticate eax_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( gcm_encrypt_authenticate gcm_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( ocb_encrypt_authenticate ocb_decrypt_verify )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::Checksum Exporter);
77 our %EXPORT_TAGS = ( all => [qw( adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::Checksum Exporter);
77 our %EXPORT_TAGS = ( all => [qw( crc32_data crc32_data_hex crc32_data_int crc32_file crc32_file_hex crc32_file_int )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw/ adler32_data adler32_data_hex adler32_data_int adler32_file adler32_file_hex adler32_file_int
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Cipher);
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_160 blake2b_160_hex blake2b_160_b64 blake2b_160_b64u blake2b_160_file blake2b_160_file_hex blake2b_160_file_b64 blake2b_160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_256 blake2b_256_hex blake2b_256_b64 blake2b_256_b64u blake2b_256_file blake2b_256_file_hex blake2b_256_file_b64 blake2b_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_384 blake2b_384_hex blake2b_384_b64 blake2b_384_b64u blake2b_384_file blake2b_384_file_hex blake2b_384_file_b64 blake2b_384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b_512 blake2b_512_hex blake2b_512_b64 blake2b_512_b64u blake2b_512_file blake2b_512_file_hex blake2b_512_file_b64 blake2b_512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_128 blake2s_128_hex blake2s_128_b64 blake2s_128_b64u blake2s_128_file blake2s_128_file_hex blake2s_128_file_b64 blake2s_128_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_160 blake2s_160_hex blake2s_160_b64 blake2s_160_b64u blake2s_160_file blake2s_160_file_hex blake2s_160_file_b64 blake2s_160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_224 blake2s_224_hex blake2s_224_b64 blake2s_224_b64u blake2s_224_file blake2s_224_file_hex blake2s_224_file_b64 blake2s_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s_256 blake2s_256_hex blake2s_256_b64 blake2s_256_b64u blake2s_256_file blake2s_256_file_hex blake2s_256_file_b64 blake2s_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( chaes chaes_hex chaes_b64 chaes_b64u chaes_file chaes_file_hex chaes_file_b64 chaes_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak224 keccak224_hex keccak224_b64 keccak224_b64u keccak224_file keccak224_file_hex keccak224_file_b64 keccak224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak256 keccak256_hex keccak256_b64 keccak256_b64u keccak256_file keccak256_file_hex keccak256_file_b64 keccak256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak384 keccak384_hex keccak384_b64 keccak384_b64u keccak384_file keccak384_file_hex keccak384_file_b64 keccak384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( keccak512 keccak512_hex keccak512_b64 keccak512_b64u keccak512_file keccak512_file_hex keccak512_file_b64 keccak512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md2 md2_hex md2_b64 md2_b64u md2_file md2_file_hex md2_file_b64 md2_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md4 md4_hex md4_b64 md4_b64u md4_file md4_file_hex md4_file_b64 md4_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( md5 md5_hex md5_b64 md5_b64u md5_file md5_file_hex md5_file_b64 md5_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd128 ripemd128_hex ripemd128_b64 ripemd128_b64u ripemd128_file ripemd128_file_hex ripemd128_file_b64 ripemd128_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd160 ripemd160_hex ripemd160_b64 ripemd160_b64u ripemd160_file ripemd160_file_hex ripemd160_file_b64 ripemd160_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd256 ripemd256_hex ripemd256_b64 ripemd256_b64u ripemd256_file ripemd256_file_hex ripemd256_file_b64 ripemd256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( ripemd320 ripemd320_hex ripemd320_b64 ripemd320_b64u ripemd320_file ripemd320_file_hex ripemd320_file_b64 ripemd320_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha1 sha1_hex sha1_b64 sha1_b64u sha1_file sha1_file_hex sha1_file_b64 sha1_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha224 sha224_hex sha224_b64 sha224_b64u sha224_file sha224_file_hex sha224_file_b64 sha224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha256 sha256_hex sha256_b64 sha256_b64u sha256_file sha256_file_hex sha256_file_b64 sha256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha384 sha384_hex sha384_b64 sha384_b64u sha384_file sha384_file_hex sha384_file_b64 sha384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_224 sha3_224_hex sha3_224_b64 sha3_224_b64u sha3_224_file sha3_224_file_hex sha3_224_file_b64 sha3_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_256 sha3_256_hex sha3_256_b64 sha3_256_b64u sha3_256_file sha3_256_file_hex sha3_256_file_b64 sha3_256_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_384 sha3_384_hex sha3_384_b64 sha3_384_b64u sha3_384_file sha3_384_file_hex sha3_384_file_b64 sha3_384_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha3_512 sha3_512_hex sha3_512_b64 sha3_512_b64u sha3_512_file sha3_512_file_hex sha3_512_file_b64 sha3_512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512 sha512_hex sha512_b64 sha512_b64u sha512_file sha512_file_hex sha512_file_b64 sha512_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512_224 sha512_224_hex sha512_224_b64 sha512_224_b64u sha512_224_file sha512_224_file_hex sha512_224_file_b64 sha512_224_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( sha512_256 sha512_256_hex sha512_256_b64 sha512_256_b64u sha512_256_file sha512_256_file_hex sha512_256_file_b64 sha512_256_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( tiger192 tiger192_hex tiger192_b64 tiger192_b64u tiger192_file tiger192_file_hex tiger192_file_b64 tiger192_file_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Digest Exporter);
99 our %EXPORT_TAGS = ( all => [qw( whirlpool whirlpool_hex whirlpool_b64 whirlpool_b64u whirlpool_file whirlpool_file_hex whirlpool_file_b64 whirlpool_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( digest_data digest_data_hex digest_data_b64 digest_data_b64u digest_file digest_file_hex digest_file_b64 digest_file_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw(pbkdf1 pbkdf2 hkdf hkdf_expand hkdf_extract)] );
2121 Crypt::KeyDerivation - PBKDF1, PBKDF2 and HKDF key derivation functions
2222
2323 =head1 SYNOPSIS
24
25 use Crypt::KeyDerivation ':all';
2426
2527 ### PBKDF1/2
2628 $derived_key1 = pbkdf1($password, $salt, $iteration_count, $hash_name, $len);
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2b blake2b_hex blake2b_b64 blake2b_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( blake2s blake2s_hex blake2s_b64 blake2s_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( f9 f9_hex f9_b64 f9_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( hmac hmac_hex hmac_b64 hmac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( omac omac_hex omac_b64 omac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( pmac pmac_hex pmac_b64 pmac_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( pelican pelican_hex pelican_b64 pelican_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( poly1305 poly1305_hex poly1305_b64 poly1305_b64u )] );
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use base qw(Crypt::Mac Exporter);
99 our %EXPORT_TAGS = ( all => [qw( xcbc xcbc_hex xcbc_b64 xcbc_b64u )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use Carp;
77 $Carp::Internal{(__PACKAGE__)}++;
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 5.57 'import';
77 use Carp 'croak';
215215 my ($cipher, undef, $klen, $mode) = $cipher_name =~ /^(AES|CAMELLIA|DES|DES-EDE3|SEED)(-(\d+))?-(CBC|CFB|ECB|OFB)$/i;
216216 croak "FATAL: unsupported cipher '$cipher_name'" unless $cipher && $mode;
217217 $cipher = $trans{$cipher} || $cipher;
218 $klen = 192 if $cipher eq 'DES_EDE';
219 $klen = 64 if $cipher eq 'DES';
220 $klen = 128 if $cipher eq 'SEED';
218221 $klen = $klen ? int($klen/8) : Crypt::Cipher::min_keysize($cipher);
219222 my $ilen = Crypt::Cipher::blocksize($cipher);
220223 croak "FATAL: unsupported cipher '$cipher_name'" unless $klen && $ilen;
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use Crypt::Cipher;
99
33
44 use strict;
55 use warnings;
6 our $VERSION = '0.060';
6 our $VERSION = '0.061';
77
88 use Crypt::Cipher;
99
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 ### not used
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( dh_shared_secret )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( dsa_encrypt dsa_decrypt dsa_sign_message dsa_verify_message dsa_sign_hash dsa_verify_hash )] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw( ecc_encrypt ecc_decrypt ecc_sign_message ecc_verify_message ecc_sign_hash ecc_verify_hash ecc_shared_secret )] );
215215
216216 if ($data =~ /-----BEGIN (EC PRIVATE|EC PUBLIC|PUBLIC) KEY-----(.*?)-----END/sg) {
217217 $data = pem_to_der($data, $password);
218 return $self->_import($data);
218 my $rv = eval { $self->_import($data) } || eval { $self->_import_old($data) };
219 return $rv if $rv;
219220 }
220221 elsif ($data =~ /-----BEGIN PRIVATE KEY-----(.*?)-----END/sg) {
221222 $data = pem_to_der($data, $password);
252253 return $self->import_key_raw($pubkey, "$2") if $pubkey && $typ =~ /^ecdsa-(.+?)-(.*)$/;
253254 }
254255 else {
255 my $rv = eval { $self->_import($data) } || eval { $self->_import_pkcs8($data, $password) } || eval { $self->_import_x509($data) };
256 my $rv = eval { $self->_import($data) } ||
257 eval { $self->_import_old($data) } ||
258 eval { $self->_import_pkcs8($data, $password) } ||
259 eval { $self->_import_x509($data) };
256260 return $rv if $rv;
257261 }
258262 croak "FATAL: invalid or unsupported EC key format";
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw(rsa_encrypt rsa_decrypt rsa_sign_message rsa_verify_message rsa_sign_hash rsa_verify_hash)] );
99 our @EXPORT = qw();
1010
1111 use Carp;
12 $Carp::Internal{(__PACKAGE__)}++;
1213 use CryptX;
1314 use Crypt::Digest qw(digest_data digest_data_b64u);
1415 use Crypt::Misc qw(read_rawfile encode_b64u decode_b64u encode_b64 decode_b64 pem_to_der der_to_pem);
2122
2223 sub export_key_pem {
2324 my ($self, $type, $password, $cipher) = @_;
25 local $SIG{__DIE__} = \&CryptX::_croak;
2426 my $key = $self->export_key_der($type||'');
2527 return unless $key;
2628
3739
3840 sub export_key_jwk {
3941 my ($self, $type, $wanthash) = @_;
42 local $SIG{__DIE__} = \&CryptX::_croak;
4043 my $kh = $self->key2hash;
4144 if ($type eq 'private') {
4245 return unless $kh->{N} && $kh->{e} && $kh->{d} && $kh->{p} && $kh->{q} && $kh->{dP} && $kh->{dQ} && $kh->{qP};
7275
7376 sub export_key_jwk_thumbprint {
7477 my ($self, $hash_name) = @_;
78 local $SIG{__DIE__} = \&CryptX::_croak;
7579 $hash_name ||= 'SHA256';
7680 my $h = $self->export_key_jwk('public', 1);
7781 my $json = CryptX::_encode_json({kty=>$h->{kty}, n=>$h->{n}, e=>$h->{e}});
8084
8185 sub import_key {
8286 my ($self, $key, $password) = @_;
87 local $SIG{__DIE__} = \&CryptX::_croak;
8388 croak "FATAL: undefined key" unless $key;
8489
8590 # special case
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use Carp;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use base qw(Crypt::PRNG Exporter);
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import';
77 our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] );
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
11
22 use strict;
33 use warnings ;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 require XSLoader;
77 XSLoader::load('CryptX', $VERSION);
11
22 use strict;
33 use warnings;
4 our $VERSION = '0.060';
4 our $VERSION = '0.061';
55
66 use CryptX;
77
102102 ltc/pk/dsa/dsa_verify_hash.o ltc/pk/dsa/dsa_verify_key.o ltc/pk/ecc/ecc.o ltc/pk/ecc/ecc_ansi_x963_export.o \
103103 ltc/pk/ecc/ecc_ansi_x963_import.o ltc/pk/ecc/ecc_decrypt_key.o ltc/pk/ecc/ecc_encrypt_key.o \
104104 ltc/pk/ecc/ecc_export.o ltc/pk/ecc/ecc_export_openssl.o ltc/pk/ecc/ecc_free.o ltc/pk/ecc/ecc_get_curve.o \
105 ltc/pk/ecc/ecc_get_key.o ltc/pk/ecc/ecc_get_size.o ltc/pk/ecc/ecc_import.o ltc/pk/ecc/ecc_import_openssl.o \
106 ltc/pk/ecc/ecc_import_pkcs8.o ltc/pk/ecc/ecc_import_x509.o ltc/pk/ecc/ecc_make_key.o \
107 ltc/pk/ecc/ecc_set_dp.o ltc/pk/ecc/ecc_set_dp_internal.o ltc/pk/ecc/ecc_set_key.o \
108 ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o ltc/pk/ecc/ecc_sizes.o \
109 ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ltc_ecc_export_point.o ltc/pk/ecc/ltc_ecc_import_point.o \
110 ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o ltc/pk/ecc/ltc_ecc_map.o \
111 ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o ltc/pk/ecc/ltc_ecc_mulmod_timing.o \
112 ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o ltc/pk/ecc/ltc_ecc_projective_dbl_point.o \
113 ltc/pk/ecc/ltc_ecc_verify_key.o ltc/pk/pkcs1/pkcs_1_i2osp.o ltc/pk/pkcs1/pkcs_1_mgf1.o \
114 ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o ltc/pk/pkcs1/pkcs_1_os2ip.o \
115 ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o ltc/pk/pkcs1/pkcs_1_v1_5_decode.o \
116 ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o ltc/pk/rsa/rsa_encrypt_key.o \
117 ltc/pk/rsa/rsa_export.o ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o ltc/pk/rsa/rsa_get_size.o \
118 ltc/pk/rsa/rsa_import.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o \
105 ltc/pk/ecc/ecc_get_key.o ltc/pk/ecc/ecc_get_oid_str.o ltc/pk/ecc/ecc_get_size.o ltc/pk/ecc/ecc_import.o \
106 ltc/pk/ecc/ecc_import_openssl.o ltc/pk/ecc/ecc_import_pkcs8.o ltc/pk/ecc/ecc_import_x509.o \
107 ltc/pk/ecc/ecc_make_key.o ltc/pk/ecc/ecc_set_dp.o ltc/pk/ecc/ecc_set_dp_internal.o \
108 ltc/pk/ecc/ecc_set_key.o ltc/pk/ecc/ecc_shared_secret.o ltc/pk/ecc/ecc_sign_hash.o \
109 ltc/pk/ecc/ecc_sizes.o ltc/pk/ecc/ecc_verify_hash.o ltc/pk/ecc/ltc_ecc_export_point.o \
110 ltc/pk/ecc/ltc_ecc_import_point.o ltc/pk/ecc/ltc_ecc_is_point.o ltc/pk/ecc/ltc_ecc_is_point_at_infinity.o \
111 ltc/pk/ecc/ltc_ecc_map.o ltc/pk/ecc/ltc_ecc_mul2add.o ltc/pk/ecc/ltc_ecc_mulmod.o \
112 ltc/pk/ecc/ltc_ecc_mulmod_timing.o ltc/pk/ecc/ltc_ecc_points.o ltc/pk/ecc/ltc_ecc_projective_add_point.o \
113 ltc/pk/ecc/ltc_ecc_projective_dbl_point.o ltc/pk/ecc/ltc_ecc_verify_key.o ltc/pk/pkcs1/pkcs_1_i2osp.o \
114 ltc/pk/pkcs1/pkcs_1_mgf1.o ltc/pk/pkcs1/pkcs_1_oaep_decode.o ltc/pk/pkcs1/pkcs_1_oaep_encode.o \
115 ltc/pk/pkcs1/pkcs_1_os2ip.o ltc/pk/pkcs1/pkcs_1_pss_decode.o ltc/pk/pkcs1/pkcs_1_pss_encode.o \
116 ltc/pk/pkcs1/pkcs_1_v1_5_decode.o ltc/pk/pkcs1/pkcs_1_v1_5_encode.o ltc/pk/rsa/rsa_decrypt_key.o \
117 ltc/pk/rsa/rsa_encrypt_key.o ltc/pk/rsa/rsa_export.o ltc/pk/rsa/rsa_exptmod.o ltc/pk/rsa/rsa_free.o \
118 ltc/pk/rsa/rsa_get_size.o ltc/pk/rsa/rsa_import.o ltc/pk/rsa/rsa_import_pkcs8.o ltc/pk/rsa/rsa_import_x509.o \
119119 ltc/pk/rsa/rsa_make_key.o ltc/pk/rsa/rsa_set.o ltc/pk/rsa/rsa_sign_hash.o ltc/pk/rsa/rsa_sign_saltlen_get.o \
120120 ltc/pk/rsa/rsa_verify_hash.o ltc/prngs/chacha20.o ltc/prngs/fortuna.o ltc/prngs/rc4.o \
121121 ltc/prngs/rng_get_bytes.o ltc/prngs/rng_make_prng.o ltc/prngs/sober128.o ltc/prngs/sprng.o \
123123 ltc/stream/chacha/chacha_ivctr32.o ltc/stream/chacha/chacha_ivctr64.o ltc/stream/chacha/chacha_keystream.o \
124124 ltc/stream/chacha/chacha_setup.o ltc/stream/rabbit/rabbit.o ltc/stream/rc4/rc4_stream.o \
125125 ltc/stream/salsa20/salsa20_crypt.o ltc/stream/salsa20/salsa20_done.o ltc/stream/salsa20/salsa20_ivctr64.o \
126 ltc/stream/salsa20/salsa20_keystream.o ltc/stream/salsa20/salsa20_setup.o ltc/stream/sober128/sober128_stream.o \
127 ltc/stream/sosemanuk/sosemanuk.o ltm/bncore.o ltm/bn_error.o ltm/bn_fast_mp_invmod.o \
128 ltm/bn_fast_mp_montgomery_reduce.o ltm/bn_fast_s_mp_mul_digs.o ltm/bn_fast_s_mp_mul_high_digs.o \
129 ltm/bn_fast_s_mp_sqr.o ltm/bn_mp_2expt.o ltm/bn_mp_abs.o ltm/bn_mp_add.o ltm/bn_mp_addmod.o \
130 ltm/bn_mp_add_d.o ltm/bn_mp_and.o ltm/bn_mp_clamp.o ltm/bn_mp_clear.o ltm/bn_mp_clear_multi.o \
131 ltm/bn_mp_cmp.o ltm/bn_mp_cmp_d.o ltm/bn_mp_cmp_mag.o ltm/bn_mp_cnt_lsb.o ltm/bn_mp_copy.o \
132 ltm/bn_mp_count_bits.o ltm/bn_mp_div.o ltm/bn_mp_div_2.o ltm/bn_mp_div_2d.o ltm/bn_mp_div_3.o \
133 ltm/bn_mp_div_d.o ltm/bn_mp_dr_is_modulus.o ltm/bn_mp_dr_reduce.o ltm/bn_mp_dr_setup.o \
134 ltm/bn_mp_exch.o ltm/bn_mp_export.o ltm/bn_mp_exptmod.o ltm/bn_mp_exptmod_fast.o \
135 ltm/bn_mp_expt_d.o ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exteuclid.o ltm/bn_mp_fread.o \
136 ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o ltm/bn_mp_get_long_long.o \
126 ltc/stream/salsa20/salsa20_keystream.o ltc/stream/salsa20/salsa20_setup.o ltc/stream/salsa20/xsalsa20_setup.o \
127 ltc/stream/sober128/sober128_stream.o ltc/stream/sosemanuk/sosemanuk.o ltm/bncore.o \
128 ltm/bn_error.o ltm/bn_fast_mp_invmod.o ltm/bn_fast_mp_montgomery_reduce.o ltm/bn_fast_s_mp_mul_digs.o \
129 ltm/bn_fast_s_mp_mul_high_digs.o ltm/bn_fast_s_mp_sqr.o ltm/bn_mp_2expt.o ltm/bn_mp_abs.o \
130 ltm/bn_mp_add.o ltm/bn_mp_addmod.o ltm/bn_mp_add_d.o ltm/bn_mp_and.o ltm/bn_mp_clamp.o \
131 ltm/bn_mp_clear.o ltm/bn_mp_clear_multi.o ltm/bn_mp_cmp.o ltm/bn_mp_cmp_d.o ltm/bn_mp_cmp_mag.o \
132 ltm/bn_mp_cnt_lsb.o ltm/bn_mp_copy.o ltm/bn_mp_count_bits.o ltm/bn_mp_div.o ltm/bn_mp_div_2.o \
133 ltm/bn_mp_div_2d.o ltm/bn_mp_div_3.o ltm/bn_mp_div_d.o ltm/bn_mp_dr_is_modulus.o \
134 ltm/bn_mp_dr_reduce.o ltm/bn_mp_dr_setup.o ltm/bn_mp_exch.o ltm/bn_mp_export.o ltm/bn_mp_exptmod.o \
135 ltm/bn_mp_exptmod_fast.o ltm/bn_mp_expt_d.o ltm/bn_mp_expt_d_ex.o ltm/bn_mp_exteuclid.o \
136 ltm/bn_mp_fread.o ltm/bn_mp_fwrite.o ltm/bn_mp_gcd.o ltm/bn_mp_get_int.o ltm/bn_mp_get_long.o \
137137 ltm/bn_mp_grow.o ltm/bn_mp_import.o ltm/bn_mp_init.o ltm/bn_mp_init_copy.o ltm/bn_mp_init_multi.o \
138138 ltm/bn_mp_init_set.o ltm/bn_mp_init_set_int.o ltm/bn_mp_init_size.o ltm/bn_mp_invmod.o \
139139 ltm/bn_mp_invmod_slow.o ltm/bn_mp_is_square.o ltm/bn_mp_jacobi.o ltm/bn_mp_karatsuba_mul.o \
148148 ltm/bn_mp_reduce.o ltm/bn_mp_reduce_2k.o ltm/bn_mp_reduce_2k_l.o ltm/bn_mp_reduce_2k_setup.o \
149149 ltm/bn_mp_reduce_2k_setup_l.o ltm/bn_mp_reduce_is_2k.o ltm/bn_mp_reduce_is_2k_l.o \
150150 ltm/bn_mp_reduce_setup.o ltm/bn_mp_rshd.o ltm/bn_mp_set.o ltm/bn_mp_set_int.o ltm/bn_mp_set_long.o \
151 ltm/bn_mp_set_long_long.o ltm/bn_mp_shrink.o ltm/bn_mp_signed_bin_size.o ltm/bn_mp_sqr.o \
152 ltm/bn_mp_sqrmod.o ltm/bn_mp_sqrt.o ltm/bn_mp_sqrtmod_prime.o ltm/bn_mp_sub.o ltm/bn_mp_submod.o \
153 ltm/bn_mp_sub_d.o ltm/bn_mp_toom_mul.o ltm/bn_mp_toom_sqr.o ltm/bn_mp_toradix.o ltm/bn_mp_toradix_n.o \
151 ltm/bn_mp_shrink.o ltm/bn_mp_signed_bin_size.o ltm/bn_mp_sqr.o ltm/bn_mp_sqrmod.o \
152 ltm/bn_mp_sqrt.o ltm/bn_mp_sqrtmod_prime.o ltm/bn_mp_sub.o ltm/bn_mp_submod.o ltm/bn_mp_sub_d.o \
153 ltm/bn_mp_toom_mul.o ltm/bn_mp_toom_sqr.o ltm/bn_mp_toradix.o ltm/bn_mp_toradix_n.o \
154154 ltm/bn_mp_to_signed_bin.o ltm/bn_mp_to_signed_bin_n.o ltm/bn_mp_to_unsigned_bin.o \
155155 ltm/bn_mp_to_unsigned_bin_n.o ltm/bn_mp_unsigned_bin_size.o ltm/bn_mp_xor.o ltm/bn_mp_zero.o \
156156 ltm/bn_prime_tab.o ltm/bn_reverse.o ltm/bn_s_mp_add.o ltm/bn_s_mp_exptmod.o ltm/bn_s_mp_mul_digs.o \
109109 ltc/pk/dsa/dsa_verify_key.obj ltc/pk/ecc/ecc.obj ltc/pk/ecc/ecc_ansi_x963_export.obj \
110110 ltc/pk/ecc/ecc_ansi_x963_import.obj ltc/pk/ecc/ecc_decrypt_key.obj ltc/pk/ecc/ecc_encrypt_key.obj \
111111 ltc/pk/ecc/ecc_export.obj ltc/pk/ecc/ecc_export_openssl.obj ltc/pk/ecc/ecc_free.obj \
112 ltc/pk/ecc/ecc_get_curve.obj ltc/pk/ecc/ecc_get_key.obj ltc/pk/ecc/ecc_get_size.obj \
113 ltc/pk/ecc/ecc_import.obj ltc/pk/ecc/ecc_import_openssl.obj ltc/pk/ecc/ecc_import_pkcs8.obj \
114 ltc/pk/ecc/ecc_import_x509.obj ltc/pk/ecc/ecc_make_key.obj ltc/pk/ecc/ecc_set_dp.obj \
115 ltc/pk/ecc/ecc_set_dp_internal.obj ltc/pk/ecc/ecc_set_key.obj ltc/pk/ecc/ecc_shared_secret.obj \
116 ltc/pk/ecc/ecc_sign_hash.obj ltc/pk/ecc/ecc_sizes.obj ltc/pk/ecc/ecc_verify_hash.obj \
117 ltc/pk/ecc/ltc_ecc_export_point.obj ltc/pk/ecc/ltc_ecc_import_point.obj ltc/pk/ecc/ltc_ecc_is_point.obj \
118 ltc/pk/ecc/ltc_ecc_is_point_at_infinity.obj ltc/pk/ecc/ltc_ecc_map.obj ltc/pk/ecc/ltc_ecc_mul2add.obj \
119 ltc/pk/ecc/ltc_ecc_mulmod.obj ltc/pk/ecc/ltc_ecc_mulmod_timing.obj ltc/pk/ecc/ltc_ecc_points.obj \
120 ltc/pk/ecc/ltc_ecc_projective_add_point.obj ltc/pk/ecc/ltc_ecc_projective_dbl_point.obj \
112 ltc/pk/ecc/ecc_get_curve.obj ltc/pk/ecc/ecc_get_key.obj ltc/pk/ecc/ecc_get_oid_str.obj \
113 ltc/pk/ecc/ecc_get_size.obj ltc/pk/ecc/ecc_import.obj ltc/pk/ecc/ecc_import_openssl.obj \
114 ltc/pk/ecc/ecc_import_pkcs8.obj ltc/pk/ecc/ecc_import_x509.obj ltc/pk/ecc/ecc_make_key.obj \
115 ltc/pk/ecc/ecc_set_dp.obj ltc/pk/ecc/ecc_set_dp_internal.obj ltc/pk/ecc/ecc_set_key.obj \
116 ltc/pk/ecc/ecc_shared_secret.obj ltc/pk/ecc/ecc_sign_hash.obj ltc/pk/ecc/ecc_sizes.obj \
117 ltc/pk/ecc/ecc_verify_hash.obj ltc/pk/ecc/ltc_ecc_export_point.obj ltc/pk/ecc/ltc_ecc_import_point.obj \
118 ltc/pk/ecc/ltc_ecc_is_point.obj ltc/pk/ecc/ltc_ecc_is_point_at_infinity.obj ltc/pk/ecc/ltc_ecc_map.obj \
119 ltc/pk/ecc/ltc_ecc_mul2add.obj ltc/pk/ecc/ltc_ecc_mulmod.obj ltc/pk/ecc/ltc_ecc_mulmod_timing.obj \
120 ltc/pk/ecc/ltc_ecc_points.obj ltc/pk/ecc/ltc_ecc_projective_add_point.obj ltc/pk/ecc/ltc_ecc_projective_dbl_point.obj \
121121 ltc/pk/ecc/ltc_ecc_verify_key.obj ltc/pk/pkcs1/pkcs_1_i2osp.obj ltc/pk/pkcs1/pkcs_1_mgf1.obj \
122122 ltc/pk/pkcs1/pkcs_1_oaep_decode.obj ltc/pk/pkcs1/pkcs_1_oaep_encode.obj ltc/pk/pkcs1/pkcs_1_os2ip.obj \
123123 ltc/pk/pkcs1/pkcs_1_pss_decode.obj ltc/pk/pkcs1/pkcs_1_pss_encode.obj ltc/pk/pkcs1/pkcs_1_v1_5_decode.obj \
131131 ltc/stream/chacha/chacha_ivctr32.obj ltc/stream/chacha/chacha_ivctr64.obj ltc/stream/chacha/chacha_keystream.obj \
132132 ltc/stream/chacha/chacha_setup.obj ltc/stream/rabbit/rabbit.obj ltc/stream/rc4/rc4_stream.obj \
133133 ltc/stream/salsa20/salsa20_crypt.obj ltc/stream/salsa20/salsa20_done.obj ltc/stream/salsa20/salsa20_ivctr64.obj \
134 ltc/stream/salsa20/salsa20_keystream.obj ltc/stream/salsa20/salsa20_setup.obj ltc/stream/sober128/sober128_stream.obj \
135 ltc/stream/sosemanuk/sosemanuk.obj ltm/bncore.obj ltm/bn_error.obj ltm/bn_fast_mp_invmod.obj \
136 ltm/bn_fast_mp_montgomery_reduce.obj ltm/bn_fast_s_mp_mul_digs.obj ltm/bn_fast_s_mp_mul_high_digs.obj \
137 ltm/bn_fast_s_mp_sqr.obj ltm/bn_mp_2expt.obj ltm/bn_mp_abs.obj ltm/bn_mp_add.obj \
138 ltm/bn_mp_addmod.obj ltm/bn_mp_add_d.obj ltm/bn_mp_and.obj ltm/bn_mp_clamp.obj ltm/bn_mp_clear.obj \
139 ltm/bn_mp_clear_multi.obj ltm/bn_mp_cmp.obj ltm/bn_mp_cmp_d.obj ltm/bn_mp_cmp_mag.obj \
140 ltm/bn_mp_cnt_lsb.obj ltm/bn_mp_copy.obj ltm/bn_mp_count_bits.obj ltm/bn_mp_div.obj \
141 ltm/bn_mp_div_2.obj ltm/bn_mp_div_2d.obj ltm/bn_mp_div_3.obj ltm/bn_mp_div_d.obj \
134 ltc/stream/salsa20/salsa20_keystream.obj ltc/stream/salsa20/salsa20_setup.obj ltc/stream/salsa20/xsalsa20_setup.obj \
135 ltc/stream/sober128/sober128_stream.obj ltc/stream/sosemanuk/sosemanuk.obj ltm/bncore.obj \
136 ltm/bn_error.obj ltm/bn_fast_mp_invmod.obj ltm/bn_fast_mp_montgomery_reduce.obj ltm/bn_fast_s_mp_mul_digs.obj \
137 ltm/bn_fast_s_mp_mul_high_digs.obj ltm/bn_fast_s_mp_sqr.obj ltm/bn_mp_2expt.obj ltm/bn_mp_abs.obj \
138 ltm/bn_mp_add.obj ltm/bn_mp_addmod.obj ltm/bn_mp_add_d.obj ltm/bn_mp_and.obj ltm/bn_mp_clamp.obj \
139 ltm/bn_mp_clear.obj ltm/bn_mp_clear_multi.obj ltm/bn_mp_cmp.obj ltm/bn_mp_cmp_d.obj \
140 ltm/bn_mp_cmp_mag.obj ltm/bn_mp_cnt_lsb.obj ltm/bn_mp_copy.obj ltm/bn_mp_count_bits.obj \
141 ltm/bn_mp_div.obj ltm/bn_mp_div_2.obj ltm/bn_mp_div_2d.obj ltm/bn_mp_div_3.obj ltm/bn_mp_div_d.obj \
142142 ltm/bn_mp_dr_is_modulus.obj ltm/bn_mp_dr_reduce.obj ltm/bn_mp_dr_setup.obj ltm/bn_mp_exch.obj \
143143 ltm/bn_mp_export.obj ltm/bn_mp_exptmod.obj ltm/bn_mp_exptmod_fast.obj ltm/bn_mp_expt_d.obj \
144144 ltm/bn_mp_expt_d_ex.obj ltm/bn_mp_exteuclid.obj ltm/bn_mp_fread.obj ltm/bn_mp_fwrite.obj \
145 ltm/bn_mp_gcd.obj ltm/bn_mp_get_int.obj ltm/bn_mp_get_long.obj ltm/bn_mp_get_long_long.obj \
146 ltm/bn_mp_grow.obj ltm/bn_mp_import.obj ltm/bn_mp_init.obj ltm/bn_mp_init_copy.obj \
147 ltm/bn_mp_init_multi.obj ltm/bn_mp_init_set.obj ltm/bn_mp_init_set_int.obj ltm/bn_mp_init_size.obj \
148 ltm/bn_mp_invmod.obj ltm/bn_mp_invmod_slow.obj ltm/bn_mp_is_square.obj ltm/bn_mp_jacobi.obj \
149 ltm/bn_mp_karatsuba_mul.obj ltm/bn_mp_karatsuba_sqr.obj ltm/bn_mp_lcm.obj ltm/bn_mp_lshd.obj \
150 ltm/bn_mp_mod.obj ltm/bn_mp_mod_2d.obj ltm/bn_mp_mod_d.obj ltm/bn_mp_montgomery_calc_normalization.obj \
145 ltm/bn_mp_gcd.obj ltm/bn_mp_get_int.obj ltm/bn_mp_get_long.obj ltm/bn_mp_grow.obj \
146 ltm/bn_mp_import.obj ltm/bn_mp_init.obj ltm/bn_mp_init_copy.obj ltm/bn_mp_init_multi.obj \
147 ltm/bn_mp_init_set.obj ltm/bn_mp_init_set_int.obj ltm/bn_mp_init_size.obj ltm/bn_mp_invmod.obj \
148 ltm/bn_mp_invmod_slow.obj ltm/bn_mp_is_square.obj ltm/bn_mp_jacobi.obj ltm/bn_mp_karatsuba_mul.obj \
149 ltm/bn_mp_karatsuba_sqr.obj ltm/bn_mp_lcm.obj ltm/bn_mp_lshd.obj ltm/bn_mp_mod.obj \
150 ltm/bn_mp_mod_2d.obj ltm/bn_mp_mod_d.obj ltm/bn_mp_montgomery_calc_normalization.obj \
151151 ltm/bn_mp_montgomery_reduce.obj ltm/bn_mp_montgomery_setup.obj ltm/bn_mp_mul.obj \
152152 ltm/bn_mp_mulmod.obj ltm/bn_mp_mul_2.obj ltm/bn_mp_mul_2d.obj ltm/bn_mp_mul_d.obj \
153153 ltm/bn_mp_neg.obj ltm/bn_mp_n_root.obj ltm/bn_mp_n_root_ex.obj ltm/bn_mp_or.obj ltm/bn_mp_prime_fermat.obj \
158158 ltm/bn_mp_reduce_2k.obj ltm/bn_mp_reduce_2k_l.obj ltm/bn_mp_reduce_2k_setup.obj ltm/bn_mp_reduce_2k_setup_l.obj \
159159 ltm/bn_mp_reduce_is_2k.obj ltm/bn_mp_reduce_is_2k_l.obj ltm/bn_mp_reduce_setup.obj \
160160 ltm/bn_mp_rshd.obj ltm/bn_mp_set.obj ltm/bn_mp_set_int.obj ltm/bn_mp_set_long.obj \
161 ltm/bn_mp_set_long_long.obj ltm/bn_mp_shrink.obj ltm/bn_mp_signed_bin_size.obj ltm/bn_mp_sqr.obj \
162 ltm/bn_mp_sqrmod.obj ltm/bn_mp_sqrt.obj ltm/bn_mp_sqrtmod_prime.obj ltm/bn_mp_sub.obj \
163 ltm/bn_mp_submod.obj ltm/bn_mp_sub_d.obj ltm/bn_mp_toom_mul.obj ltm/bn_mp_toom_sqr.obj \
164 ltm/bn_mp_toradix.obj ltm/bn_mp_toradix_n.obj ltm/bn_mp_to_signed_bin.obj ltm/bn_mp_to_signed_bin_n.obj \
161 ltm/bn_mp_shrink.obj ltm/bn_mp_signed_bin_size.obj ltm/bn_mp_sqr.obj ltm/bn_mp_sqrmod.obj \
162 ltm/bn_mp_sqrt.obj ltm/bn_mp_sqrtmod_prime.obj ltm/bn_mp_sub.obj ltm/bn_mp_submod.obj \
163 ltm/bn_mp_sub_d.obj ltm/bn_mp_toom_mul.obj ltm/bn_mp_toom_sqr.obj ltm/bn_mp_toradix.obj \
164 ltm/bn_mp_toradix_n.obj ltm/bn_mp_to_signed_bin.obj ltm/bn_mp_to_signed_bin_n.obj \
165165 ltm/bn_mp_to_unsigned_bin.obj ltm/bn_mp_to_unsigned_bin_n.obj ltm/bn_mp_unsigned_bin_size.obj \
166166 ltm/bn_mp_xor.obj ltm/bn_mp_zero.obj ltm/bn_prime_tab.obj ltm/bn_reverse.obj ltm/bn_s_mp_add.obj \
167167 ltm/bn_s_mp_exptmod.obj ltm/bn_s_mp_mul_digs.obj ltm/bn_s_mp_mul_high_digs.obj ltm/bn_s_mp_sqr.obj \
2727 Implementation of AES
2828 */
2929
30 #include "tomcrypt.h"
30 #include "tomcrypt_private.h"
3131
3232 #ifdef LTC_RIJNDAEL
3333
1212 Authors: Paulo S.L.M. Barreto and Vincent Rijmen.
1313 */
1414
15 #include "tomcrypt.h"
15 #include "tomcrypt_private.h"
1616
1717 #ifdef LTC_ANUBIS
1818
99 @file blowfish.c
1010 Implementation of the Blowfish block cipher, Tom St Denis
1111 */
12 #include "tomcrypt.h"
12 #include "tomcrypt_private.h"
1313
1414 #ifdef LTC_BLOWFISH
1515
393393 ulong32 L, R;
394394 int r;
395395 #ifndef __GNUC__
396 ulong32 *S1, *S2, *S3, *S4;
396 const ulong32 *S1, *S2, *S3, *S4;
397397 #endif
398398
399399 LTC_ARGCHK(pt != NULL);
455455 ulong32 L, R;
456456 int r;
457457 #ifndef __GNUC__
458 ulong32 *S1, *S2, *S3, *S4;
458 const ulong32 *S1, *S2, *S3, *S4;
459459 #endif
460460
461461 LTC_ARGCHK(pt != NULL);
1111 Implementation by Tom St Denis of Elliptic Semiconductor
1212 */
1313
14 #include "tomcrypt.h"
14 #include "tomcrypt_private.h"
1515
1616 #ifdef LTC_CAMELLIA
1717
1010 @file cast5.c
1111 Implementation of LTC_CAST5 (RFC 2144) by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_CAST5
1616
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file des.c
3535 {
3636 "3des",
3737 14,
38 24, 24, 8, 16,
38 16, 24, 8, 16,
3939 &des3_setup,
4040 &des3_ecb_encrypt,
4141 &des3_ecb_decrypt,
20672067 int des3_keysize(int *keysize)
20682068 {
20692069 LTC_ARGCHK(keysize != NULL);
2070 if(*keysize < 24) {
2071 return CRYPT_INVALID_KEYSIZE;
2070 if (*keysize < 16)
2071 return CRYPT_INVALID_KEYSIZE;
2072 if (*keysize < 24) {
2073 *keysize = 16;
2074 return CRYPT_OK;
20722075 }
20732076 *keysize = 24;
20742077 return CRYPT_OK;
2121 and Japan (JP 3225440) (expired May 16, 2011).
2222 */
2323
24 #include "tomcrypt.h"
24 #include "tomcrypt_private.h"
2525
2626 #ifdef LTC_IDEA
2727
1212 Derived from the 3GPP standard source code
1313 */
1414
15 #include "tomcrypt.h"
15 #include "tomcrypt_private.h"
1616
1717 #ifdef LTC_KASUMI
1818
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file khazad.c
1212 Tom St Denis
1313 */
1414
15 #include "tomcrypt.h"
15 #include "tomcrypt_private.h"
1616
1717 #ifdef LTC_KSEED
1818
1010 @file multi2.c
1111 Multi-2 implementation (not public domain, hence the default disable)
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_MULTI2
1616
99 @file noekeon.c
1010 Implementation of the Noekeon block cipher by Tom St Denis
1111 */
12 #include "tomcrypt.h"
12 #include "tomcrypt_private.h"
1313
1414 #ifdef LTC_NOEKEON
1515
1515 * Thanks to CodeView, SoftIce, and D86 for helping bring this code to *
1616 * the public. *
1717 \**********************************************************************/
18 #include "tomcrypt.h"
18 #include "tomcrypt_private.h"
1919
2020 /**
2121 @file rc2.c
1111 LTC_RC5 code by Tom St Denis
1212 */
1313
14 #include "tomcrypt.h"
14 #include "tomcrypt_private.h"
1515
1616 #ifdef LTC_RC5
1717
1010 @file rc6.c
1111 LTC_RC6 code by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_RC6
1616
2525 *
2626 *******************************************************************************/
2727
28 #include "tomcrypt.h"
28 #include "tomcrypt_private.h"
2929
3030 #ifdef LTC_SAFER
3131
1010 @file saferp.c
1111 LTC_SAFER+ Implementation by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_SAFERP
1616
1414 https://en.wikipedia.org/wiki/Serpent_(cipher)
1515 */
1616
17 #include "tomcrypt.h"
17 #include "tomcrypt_private.h"
1818
1919 #ifdef LTC_SERPENT
2020
1010 @file skipjack.c
1111 Skipjack Implementation by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_SKIPJACK
1616
1010 @file twofish.c
1111 Implementation of Twofish by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_TWOFISH
1616
472472 const ulong32 *k;
473473 int r;
474474 #if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
475 ulong32 *S1, *S2, *S3, *S4;
475 const ulong32 *S1, *S2, *S3, *S4;
476476 #endif
477477
478478 LTC_ARGCHK(pt != NULL);
546546 const ulong32 *k;
547547 int r;
548548 #if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
549 ulong32 *S1, *S2, *S3, *S4;
549 const ulong32 *S1, *S2, *S3, *S4;
550550 #endif
551551
552552 LTC_ARGCHK(pt != NULL);
1010 @file xtea.c
1111 Implementation of LTC_XTEA, Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_XTEA
1616
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_CCM_MODE
1111
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_CCM_MODE
1111
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_CCM_MODE
1111
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_CCM_MODE
1111
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file ccm_memory.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_CCM_MODE
1111
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_CCM_MODE
1111
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 #ifdef LTC_CHACHA20POLY1305_MODE
1212
99 @file eax_addheader.c
1010 EAX implementation, add meta-data, by Tom St Denis
1111 */
12 #include "tomcrypt.h"
12 #include "tomcrypt_private.h"
1313
1414 #ifdef LTC_EAX_MODE
1515
1010 @file eax_decrypt.c
1111 EAX implementation, decrypt block, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_EAX_MODE
1616
1010 @file eax_decrypt_verify_memory.c
1111 EAX implementation, decrypt block of memory, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_EAX_MODE
1616
1010 @file eax_done.c
1111 EAX implementation, terminate session, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_EAX_MODE
1616
1010 @file eax_encrypt.c
1111 EAX implementation, encrypt block by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_EAX_MODE
1616
1010 @file eax_encrypt_authenticate_memory.c
1111 EAX implementation, encrypt a block of memory, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_EAX_MODE
1616
1010 @file eax_init.c
1111 EAX implementation, initialized EAX state, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_EAX_MODE
1616
1010 @file gcm_add_aad.c
1111 GCM implementation, Add AAD data to the stream, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file gcm_add_iv.c
1111 GCM implementation, add IV data to the state, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file gcm_done.c
1111 GCM implementation, Terminate the stream, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file gcm_gf_mult.c
1111 GCM implementation, do the GF mult, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))
1616
1010 @file gcm_init.c
1111 GCM implementation, initialize state, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file gcm_memory.c
1111 GCM implementation, process a packet, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file gcm_mult_h.c
1111 GCM implementation, do the GF mult, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #if defined(LTC_GCM_MODE)
1616 /**
1010 @file gcm_process.c
1111 GCM implementation, process message data, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file gcm_reset.c
1111 GCM implementation, reset a used state so it can accept IV data, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_GCM_MODE
1616
1010 @file ocb3_add_aad.c
1111 OCB implementation, add AAD data, by Karel Miko
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_decrypt.c
1111 OCB implementation, decrypt data, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_decrypt_last.c
1111 OCB implementation, internal helper, by Karel Miko
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_decrypt_verify_memory.c
1111 OCB implementation, helper to decrypt block of memory, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_done.c
1111 OCB implementation, INTERNAL ONLY helper, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_encrypt.c
1111 OCB implementation, encrypt data, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_encrypt_authenticate_memory.c
1111 OCB implementation, encrypt block of memory, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_encrypt_last.c
1111 OCB implementation, internal helper, by Karel Miko
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_init.c
1111 OCB implementation, initialize state, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_int_ntz.c
1111 OCB implementation, INTERNAL ONLY helper, by Tom St Denis
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
1010 @file ocb3_int_xor_blocks.c
1111 OCB implementation, INTERNAL ONLY helper, by Karel Miko
1212 */
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #ifdef LTC_OCB3_MODE
1616
2222 */
2323 /* see also https://www.ietf.org/rfc/rfc7693.txt */
2424
25 #include "tomcrypt.h"
25 #include "tomcrypt_private.h"
2626
2727 #ifdef LTC_BLAKE2B
2828
198198 return CRYPT_OK;
199199 }
200200
201 /**
202 Initialize the hash/MAC state
203
204 Use this function to init for arbitrary sizes.
205
206 Give a key and keylen to init for MAC mode.
207
208 @param md The hash state you wish to initialize
209 @param outlen The desired output-length
210 @param key The key of the MAC
211 @param keylen The length of the key
212 @return CRYPT_OK if successful
213 */
201214 int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen)
202215 {
203216 unsigned char P[BLAKE2B_PARAM_SIZE];
236249 return CRYPT_OK;
237250 }
238251
252 /**
253 Initialize the hash state
254 @param md The hash state you wish to initialize
255 @return CRYPT_OK if successful
256 */
239257 int blake2b_160_init(hash_state *md) { return blake2b_init(md, 20, NULL, 0); }
240258
259 /**
260 Initialize the hash state
261 @param md The hash state you wish to initialize
262 @return CRYPT_OK if successful
263 */
241264 int blake2b_256_init(hash_state *md) { return blake2b_init(md, 32, NULL, 0); }
242265
266 /**
267 Initialize the hash state
268 @param md The hash state you wish to initialize
269 @return CRYPT_OK if successful
270 */
243271 int blake2b_384_init(hash_state *md) { return blake2b_init(md, 48, NULL, 0); }
244272
273 /**
274 Initialize the hash state
275 @param md The hash state you wish to initialize
276 @return CRYPT_OK if successful
277 */
245278 int blake2b_512_init(hash_state *md) { return blake2b_init(md, 64, NULL, 0); }
246279
247280 #define G(r, i, a, b, c, d) \
327360 }
328361 #endif
329362
363 /**
364 Process a block of memory through the hash
365 @param md The hash state
366 @param in The data to hash
367 @param inlen The length of the data (octets)
368 @return CRYPT_OK if successful
369 */
330370 int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen)
331371 {
332372 LTC_ARGCHK(md != NULL);
359399 return CRYPT_OK;
360400 }
361401
402 /**
403 Terminate the hash to get the digest
404 @param md The hash state
405 @param out [out] The destination of the hash (size depending on the length used on init)
406 @return CRYPT_OK if successful
407 */
362408 int blake2b_done(hash_state *md, unsigned char *out)
363409 {
364410 unsigned char buffer[BLAKE2B_OUTBYTES] = { 0 };
2222 */
2323 /* see also https://www.ietf.org/rfc/rfc7693.txt */
2424
25 #include "tomcrypt.h"
25 #include "tomcrypt_private.h"
2626
2727 #ifdef LTC_BLAKE2S
2828
192192 return CRYPT_OK;
193193 }
194194
195 /**
196 Initialize the hash/MAC state
197
198 Use this function to init for arbitrary sizes.
199
200 Give a key and keylen to init for MAC mode.
201
202 @param md The hash state you wish to initialize
203 @param outlen The desired output-length
204 @param key The key of the MAC
205 @param keylen The length of the key
206 @return CRYPT_OK if successful
207 */
195208 int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen)
196209 {
197210 unsigned char P[BLAKE2S_PARAM_SIZE];
229242 return CRYPT_OK;
230243 }
231244
245 /**
246 Initialize the hash state
247 @param md The hash state you wish to initialize
248 @return CRYPT_OK if successful
249 */
232250 int blake2s_128_init(hash_state *md) { return blake2s_init(md, 16, NULL, 0); }
233251
252 /**
253 Initialize the hash state
254 @param md The hash state you wish to initialize
255 @return CRYPT_OK if successful
256 */
234257 int blake2s_160_init(hash_state *md) { return blake2s_init(md, 20, NULL, 0); }
235258
259 /**
260 Initialize the hash state
261 @param md The hash state you wish to initialize
262 @return CRYPT_OK if successful
263 */
236264 int blake2s_224_init(hash_state *md) { return blake2s_init(md, 28, NULL, 0); }
237265
266 /**
267 Initialize the hash state
268 @param md The hash state you wish to initialize
269 @return CRYPT_OK if successful
270 */
238271 int blake2s_256_init(hash_state *md) { return blake2s_init(md, 32, NULL, 0); }
239272
240273 #define G(r, i, a, b, c, d) \
315348 }
316349 #endif
317350
351 /**
352 Process a block of memory through the hash
353 @param md The hash state
354 @param in The data to hash
355 @param inlen The length of the data (octets)
356 @return CRYPT_OK if successful
357 */
318358 int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen)
319359 {
320360 LTC_ARGCHK(md != NULL);
347387 return CRYPT_OK;
348388 }
349389
390 /**
391 Terminate the hash to get the digest
392 @param md The hash state
393 @param out [out] The destination of the hash (size depending on the length used on init)
394 @return CRYPT_OK if successful
395 */
350396 int blake2s_done(hash_state *md, unsigned char *out)
351397 {
352398 unsigned char buffer[BLAKE2S_OUTBYTES] = { 0 };
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 /**
1212 @file chc.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifndef LTC_NO_FILE
1111 /**
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifndef LTC_NO_FILE
1111 /**
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 #ifdef LTC_HASH_HELPERS
1111 /**
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99 #include <stdarg.h>
1010
1111 #ifdef LTC_HASH_HELPERS
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @param md2.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @param md4.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010
1111 /**
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @param rmd128.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file rmd160.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @param rmd256.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file rmd320.c
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file sha1.c
1010 LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis)
1111 */
1212
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #if defined(LTC_SHA224) && defined(LTC_SHA256)
1616
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @file sha256.c
1010 LTC_SHA384 hash included in sha512.c, Tom St Denis
1111 */
1212
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #if defined(LTC_SHA384) && defined(LTC_SHA512)
1616
55 * The library is free for all purposes without any express
66 * guarantee it works.
77 */
8 #include "tomcrypt.h"
8 #include "tomcrypt_private.h"
99
1010 /**
1111 @param sha512.c
1010 SHA512/224 hash included in sha512.c
1111 */
1212
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #if defined(LTC_SHA512_224) && defined(LTC_SHA512)
1616
1010 SHA512/256 hash included in sha512.c
1111 */
1212
13 #include "tomcrypt.h"
13 #include "tomcrypt_private.h"
1414
1515 #if defined(LTC_SHA512_256) && defined(LTC_SHA512)
1616
88
99 /* based on https://github.com/brainhub/SHA3IUF (public domain) */
1010
11 #include "tomcrypt.h"
11 #include "tomcrypt_private.h"
1212
1313 #ifdef LTC_SHA3
1414
88
99 /* based on https://github.com/brainhub/SHA3IUF (public domain) */
1010
11 #include "tomcrypt.h"
11 #include "tomcrypt_private.h"
1212
1313 #ifdef LTC_SHA3
1414
66 * guarantee it works.
77 */
88
9 #include "tomcrypt.h"
9 #include "tomcrypt_private.h"
1010
1111 /**
1212 @file tiger.c
1111 LTC_WHIRLPOOL (using their new sbox) hash function by Tom St Denis
1212 */
1313
14 #include "tomcrypt.h"
14 #include "tomcrypt_private.h"
1515
1616 #ifdef LTC_WHIRLPOOL
1717
10301030
10311031 #endif /* LTC_SALSA20 */
10321032
1033 #ifdef LTC_XSALSA20
1034
1035 int xsalsa20_setup(salsa20_state *st, const unsigned char *key, unsigned long keylen,
1036 const unsigned char *nonce, unsigned long noncelen,
1037 int rounds);
1038 int xsalsa20_test(void);
1039
1040 #endif /* LTC_XSALSA20 */
1041
10331042 #ifdef LTC_SOSEMANUK
10341043
10351044 typedef struct {
207207 /* stream ciphers */
208208 #define LTC_CHACHA
209209 #define LTC_SALSA20
210 #define LTC_XSALSA20
210211 #define LTC_SOSEMANUK
211212 #define LTC_RABBIT
212213 #define LTC_RC4_STREAM
363364 /* time-based rate limit of the reseeding */
364365 #define LTC_FORTUNA_RESEED_RATELIMIT_TIMED
365366
367 /* with non-glibc or glibc 2.17+ prefer clock_gettime over gettimeofday */
368 #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
369 #if __GLIBC_PREREQ(2, 17)
370 #define LTC_CLOCK_GETTIME
371 #endif
372 #elif defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
373 #define LTC_CLOCK_GETTIME
374 #endif
375
366376 #else
367377
368378 #ifndef LTC_FORTUNA_WD
413423 #define LTC_DH6144
414424 #define LTC_DH8192
415425 #endif
416
417 /* Include Katja (a Rabin variant like RSA) */
418 /* #define LTC_MKAT */
419426
420427 /* Digital Signature Algorithm */
421428 #define LTC_MDSA
537544 #endif
538545 #endif
539546
540 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT)
547 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA)
541548 /* Include the MPI functionality? (required by the PK algorithms) */
542549 #define LTC_MPI
543550
567574 #error ASN.1 DER requires MPI functionality
568575 #endif
569576
570 #if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC) || defined(LTC_MKAT)) && !defined(LTC_DER)
577 #if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC)) && !defined(LTC_DER)
571578 #error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled
572579 #endif
573580
577584
578585 #if defined(LTC_CHACHA20_PRNG) && !defined(LTC_CHACHA)
579586 #error LTC_CHACHA20_PRNG requires LTC_CHACHA
587 #endif
588
589 #if defined(LTC_XSALSA20) && !defined(LTC_SALSA20)
590 #error LTC_XSALSA20 requires LTC_SALSA20
580591 #endif
581592
582593 #if defined(LTC_RC4) && !defined(LTC_RC4_STREAM)
506506 int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen);
507507 #endif
508508
509 /* a simple macro for making hash "process" functions */
510 #define HASH_PROCESS(func_name, compress_name, state_var, block_size) \
511 int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) \
512 { \
513 unsigned long n; \
514 int err; \
515 LTC_ARGCHK(md != NULL); \
516 LTC_ARGCHK(in != NULL); \
517 if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
518 return CRYPT_INVALID_ARG; \
519 } \
520 if ((md-> state_var .length + inlen) < md-> state_var .length) { \
521 return CRYPT_HASH_OVERFLOW; \
522 } \
523 while (inlen > 0) { \
524 if (md-> state_var .curlen == 0 && inlen >= block_size) { \
525 if ((err = compress_name (md, in)) != CRYPT_OK) { \
526 return err; \
527 } \
528 md-> state_var .length += block_size * 8; \
529 in += block_size; \
530 inlen -= block_size; \
531 } else { \
532 n = MIN(inlen, (block_size - md-> state_var .curlen)); \
533 XMEMCPY(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
534 md-> state_var .curlen += n; \
535 in += n; \
536 inlen -= n; \
537 if (md-> state_var .curlen == block_size) { \
538 if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \
539 return err; \
540 } \
541 md-> state_var .length += 8*block_size; \
542 md-> state_var .curlen = 0; \
543 } \
544 } \
545 } \
546 return CRYPT_OK; \
547 }
548
549509 /* ref: $Format:%D$ */
550510 /* git commit: $Format:%H$ */
551511 /* commit time: $Format:%ai$ */
145145 int blake2bmac_test(void);
146146 #endif /* LTC_BLAKE2BMAC */
147147
148
148149 #ifdef LTC_PELICAN
149150
150151 typedef struct pelican_state
390391
391392 int ocb3_test(void);
392393
393 #ifdef LTC_SOURCE
394 /* internal helper functions */
395 int ocb3_int_ntz(unsigned long x);
396 void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len);
397 #endif /* LTC_SOURCE */
398
399394 #endif /* LTC_OCB3_MODE */
400395
401396 #ifdef LTC_CCM_MODE
523523 extern const ltc_math_descriptor gmp_desc;
524524 #endif
525525
526 #if !defined(DESC_DEF_ONLY) && defined(LTC_SOURCE)
527
528 #define MP_DIGIT_BIT ltc_mp.bits_per_digit
529
530 /* some handy macros */
531 #define mp_init(a) ltc_mp.init(a)
532 #define mp_init_multi ltc_init_multi
533 #define mp_clear(a) ltc_mp.deinit(a)
534 #define mp_clear_multi ltc_deinit_multi
535 #define mp_cleanup_multi ltc_cleanup_multi
536 #define mp_init_copy(a, b) ltc_mp.init_copy(a, b)
537
538 #define mp_neg(a, b) ltc_mp.neg(a, b)
539 #define mp_copy(a, b) ltc_mp.copy(a, b)
540
541 #define mp_set(a, b) ltc_mp.set_int(a, b)
542 #define mp_set_int(a, b) ltc_mp.set_int(a, b)
543 #define mp_get_int(a) ltc_mp.get_int(a)
544 #define mp_get_digit(a, n) ltc_mp.get_digit(a, n)
545 #define mp_get_digit_count(a) ltc_mp.get_digit_count(a)
546 #define mp_cmp(a, b) ltc_mp.compare(a, b)
547 #define mp_cmp_d(a, b) ltc_mp.compare_d(a, b)
548 #define mp_count_bits(a) ltc_mp.count_bits(a)
549 #define mp_cnt_lsb(a) ltc_mp.count_lsb_bits(a)
550 #define mp_2expt(a, b) ltc_mp.twoexpt(a, b)
551
552 #define mp_read_radix(a, b, c) ltc_mp.read_radix(a, b, c)
553 #define mp_toradix(a, b, c) ltc_mp.write_radix(a, b, c)
554 #define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a)
555 #define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b)
556 #define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c)
557
558 #define mp_add(a, b, c) ltc_mp.add(a, b, c)
559 #define mp_add_d(a, b, c) ltc_mp.addi(a, b, c)
560 #define mp_sub(a, b, c) ltc_mp.sub(a, b, c)
561 #define mp_sub_d(a, b, c) ltc_mp.subi(a, b, c)
562 #define mp_mul(a, b, c) ltc_mp.mul(a, b, c)
563 #define mp_mul_d(a, b, c) ltc_mp.muli(a, b, c)
564 #define mp_sqr(a, b) ltc_mp.sqr(a, b)
565 #define mp_sqrtmod_prime(a, b, c) ltc_mp.sqrtmod_prime(a, b, c)
566 #define mp_div(a, b, c, d) ltc_mp.mpdiv(a, b, c, d)
567 #define mp_div_2(a, b) ltc_mp.div_2(a, b)
568 #define mp_mod(a, b, c) ltc_mp.mpdiv(a, b, NULL, c)
569 #define mp_mod_d(a, b, c) ltc_mp.modi(a, b, c)
570 #define mp_gcd(a, b, c) ltc_mp.gcd(a, b, c)
571 #define mp_lcm(a, b, c) ltc_mp.lcm(a, b, c)
572
573 #define mp_addmod(a, b, c, d) ltc_mp.addmod(a, b, c, d)
574 #define mp_submod(a, b, c, d) ltc_mp.submod(a, b, c, d)
575 #define mp_mulmod(a, b, c, d) ltc_mp.mulmod(a, b, c, d)
576 #define mp_sqrmod(a, b, c) ltc_mp.sqrmod(a, b, c)
577 #define mp_invmod(a, b, c) ltc_mp.invmod(a, b, c)
578
579 #define mp_montgomery_setup(a, b) ltc_mp.montgomery_setup(a, b)
580 #define mp_montgomery_normalization(a, b) ltc_mp.montgomery_normalization(a, b)
581 #define mp_montgomery_reduce(a, b, c) ltc_mp.montgomery_reduce(a, b, c)
582 #define mp_montgomery_free(a) ltc_mp.montgomery_deinit(a)
583
584 #define mp_exptmod(a,b,c,d) ltc_mp.exptmod(a,b,c,d)
585 #define mp_prime_is_prime(a, b, c) ltc_mp.isprime(a, b, c)
586
587 #define mp_iszero(a) (mp_cmp_d(a, 0) == LTC_MP_EQ ? LTC_MP_YES : LTC_MP_NO)
588 #define mp_isodd(a) (mp_get_digit_count(a) > 0 ? (mp_get_digit(a, 0) & 1 ? LTC_MP_YES : LTC_MP_NO) : LTC_MP_NO)
589 #define mp_exch(a, b) do { void *ABC__tmp = a; a = b; b = ABC__tmp; } while(0)
590
591 #define mp_tohex(a, b) mp_toradix(a, b, 16)
592
593 #define mp_rand(a, b) ltc_mp.rand(a, b)
594
595 #endif
596
597526 /* ref: $Format:%D$ */
598527 /* git commit: $Format:%H$ */
599528 /* commit time: $Format:%ai$ */
5353 #ifdef LTC_BASE16
5454 int base16_encode(const unsigned char *in, unsigned long inlen,
5555 char *out, unsigned long *outlen,
56 int caps);
56 unsigned int options);
5757 int base16_decode(const char *in, unsigned long inlen,
5858 unsigned char *out, unsigned long *outlen);
5959 #endif
8484 /* ---- MEM routines ---- */
8585 int mem_neq(const void *a, const void *b, size_t len);
8686 void zeromem(volatile void *dst, size_t len);
87 #ifdef LTC_SOURCE
88 void copy_or_zeromem(const unsigned char* src, unsigned char* dest, unsigned long len, int coz);
89 #endif
9087 void burn_stack(unsigned long len);
9188
9289 const char *error_to_string(int err);
154151
155152 int padding_pad(unsigned char *data, unsigned long length, unsigned long* padded_length, unsigned long mode);
156153 int padding_depad(const unsigned char *data, unsigned long *length, unsigned long mode);
157
158 #ifdef LTC_SOURCE
159 /* internal helper functions */
160 #define LTC_PAD_MASK (0xF000U)
161 #endif
162154 #endif /* LTC_PADDING */
163155
164156 int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which);
2323 };
2424
2525 int rand_prime(void *N, long len, prng_state *prng, int wprng);
26
27 #ifdef LTC_SOURCE
28 /* internal helper functions */
29 int rand_bn_bits(void *N, int bits, prng_state *prng, int wprng);
30 int rand_bn_upto(void *N, void *limit, prng_state *prng, int wprng);
31
32 enum public_key_algorithms {
33 PKA_RSA,
34 PKA_DSA,
35 PKA_EC,
36 PKA_EC_PRIMEF
37 };
38
39 typedef struct Oid {
40 unsigned long OID[16];
41 /** Number of OID digits in use */
42 unsigned long OIDlen;
43 } oid_st;
44
45 int pk_get_oid(int pk, oid_st *st);
46 int pk_oid_str_to_num(const char *OID, unsigned long *oid, unsigned long *oidlen);
47 int pk_oid_num_to_str(const unsigned long *oid, unsigned long oidlen, char *OID, unsigned long *outlen);
48 #endif /* LTC_SOURCE */
4926
5027 /* ---- RSA ---- */
5128 #ifdef LTC_MRSA
148125 rsa_key *key);
149126 #endif
150127
151 /* ---- Katja ---- */
152 #ifdef LTC_MKAT
153
154 /* Min and Max KAT key sizes (in bits) */
155 #define MIN_KAT_SIZE 1024
156 #define MAX_KAT_SIZE 4096
157
158 /** Katja PKCS style key */
159 typedef struct KAT_key {
160 /** Type of key, PK_PRIVATE or PK_PUBLIC */
161 int type;
162 /** The private exponent */
163 void *d;
164 /** The modulus */
165 void *N;
166 /** The p factor of N */
167 void *p;
168 /** The q factor of N */
169 void *q;
170 /** The 1/q mod p CRT param */
171 void *qP;
172 /** The d mod (p - 1) CRT param */
173 void *dP;
174 /** The d mod (q - 1) CRT param */
175 void *dQ;
176 /** The pq param */
177 void *pq;
178 } katja_key;
179
180 int katja_make_key(prng_state *prng, int wprng, int size, katja_key *key);
181
182 int katja_exptmod(const unsigned char *in, unsigned long inlen,
183 unsigned char *out, unsigned long *outlen, int which,
184 katja_key *key);
185
186 void katja_free(katja_key *key);
187
188 /* These use PKCS #1 v2.0 padding */
189 int katja_encrypt_key(const unsigned char *in, unsigned long inlen,
190 unsigned char *out, unsigned long *outlen,
191 const unsigned char *lparam, unsigned long lparamlen,
192 prng_state *prng, int prng_idx, int hash_idx, katja_key *key);
193
194 int katja_decrypt_key(const unsigned char *in, unsigned long inlen,
195 unsigned char *out, unsigned long *outlen,
196 const unsigned char *lparam, unsigned long lparamlen,
197 int hash_idx, int *stat,
198 katja_key *key);
199
200 /* PKCS #1 import/export */
201 int katja_export(unsigned char *out, unsigned long *outlen, int type, katja_key *key);
202 int katja_import(const unsigned char *in, unsigned long inlen, katja_key *key);
203
204 #endif
205
206128 /* ---- DH Routines ---- */
207129 #ifdef LTC_MDH
208130
234156 void dh_free(dh_key *key);
235157
236158 int dh_export_key(void *out, unsigned long *outlen, int type, const dh_key *key);
237
238 #ifdef LTC_SOURCE
239 typedef struct {
240 int size;
241 const char *name, *base, *prime;
242 } ltc_dh_set_type;
243
244 extern const ltc_dh_set_type ltc_dh_sets[];
245
246 /* internal helper functions */
247 int dh_check_pubkey(const dh_key *key);
248 #endif
249
250159 #endif /* LTC_MDH */
251160
252161
346255 int ecc_generate_key(prng_state *prng, int wprng, ecc_key *key);
347256 int ecc_set_key(const unsigned char *in, unsigned long inlen, int type, ecc_key *key);
348257 int ecc_get_key(unsigned char *out, unsigned long *outlen, int type, const ecc_key *key);
258 int ecc_get_oid_str(char *out, unsigned long *outlen, const ecc_key *key);
349259
350260 int ecc_make_key(prng_state *prng, int wprng, int keysize, ecc_key *key);
351261 int ecc_make_key_ex(prng_state *prng, int wprng, ecc_key *key, const ltc_ecc_curve *cu);
391301 int ecc_verify_hash(const unsigned char *sig, unsigned long siglen,
392302 const unsigned char *hash, unsigned long hashlen,
393303 int *stat, const ecc_key *key);
394
395
396 #ifdef LTC_SOURCE
397 /* INTERNAL ONLY - it should be later moved to src/headers/tomcrypt_internal.h */
398
399 int ecc_set_dp_from_mpis(void *a, void *b, void *prime, void *order, void *gx, void *gy, unsigned long cofactor, ecc_key *key);
400 int ecc_copy_dp(const ecc_key *srckey, ecc_key *key);
401 int ecc_set_dp_by_size(int size, ecc_key *key);
402
403 /* low level functions */
404 ecc_point *ltc_ecc_new_point(void);
405 void ltc_ecc_del_point(ecc_point *p);
406 int ltc_ecc_set_point_xyz(ltc_mp_digit x, ltc_mp_digit y, ltc_mp_digit z, ecc_point *p);
407 int ltc_ecc_copy_point(const ecc_point *src, ecc_point *dst);
408 int ltc_ecc_is_point(const ltc_ecc_dp *dp, void *x, void *y);
409 int ltc_ecc_is_point_at_infinity(const ecc_point *P, void *modulus, int *retval);
410 int ltc_ecc_import_point(const unsigned char *in, unsigned long inlen, void *prime, void *a, void *b, void *x, void *y);
411 int ltc_ecc_export_point(unsigned char *out, unsigned long *outlen, void *x, void *y, unsigned long size, int compressed);
412 int ltc_ecc_verify_key(const ecc_key *key);
413
414 /* point ops (mp == montgomery digit) */
415 #if !defined(LTC_MECC_ACCEL) || defined(LTM_DESC) || defined(GMP_DESC)
416 /* R = 2P */
417 int ltc_ecc_projective_dbl_point(const ecc_point *P, ecc_point *R, void *ma, void *modulus, void *mp);
418
419 /* R = P + Q */
420 int ltc_ecc_projective_add_point(const ecc_point *P, const ecc_point *Q, ecc_point *R, void *ma, void *modulus, void *mp);
421 #endif
422
423 #if defined(LTC_MECC_FP)
424 /* optimized point multiplication using fixed point cache (HAC algorithm 14.117) */
425 int ltc_ecc_fp_mulmod(void *k, ecc_point *G, ecc_point *R, void *a, void *modulus, int map);
426
427 /* functions for saving/loading/freeing/adding to fixed point cache */
428 int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen);
429 int ltc_ecc_fp_restore_state(unsigned char *in, unsigned long inlen);
430 void ltc_ecc_fp_free(void);
431 int ltc_ecc_fp_add_point(ecc_point *g, void *modulus, int lock);
432
433 /* lock/unlock all points currently in fixed point cache */
434 void ltc_ecc_fp_tablelock(int lock);
435 #endif
436
437 /* R = kG */
438 int ltc_ecc_mulmod(void *k, const ecc_point *G, ecc_point *R, void *a, void *modulus, int map);
439
440 #ifdef LTC_ECC_SHAMIR
441 /* kA*A + kB*B = C */
442 int ltc_ecc_mul2add(const ecc_point *A, void *kA,
443 const ecc_point *B, void *kB,
444 ecc_point *C,
445 void *ma,
446 void *modulus);
447
448 #ifdef LTC_MECC_FP
449 /* Shamir's trick with optimized point multiplication using fixed point cache */
450 int ltc_ecc_fp_mul2add(const ecc_point *A, void *kA,
451 const ecc_point *B, void *kB,
452 ecc_point *C,
453 void *ma,
454 void *modulus);
455 #endif
456
457 #endif
458
459
460 /* map P to affine from projective */
461 int ltc_ecc_map(ecc_point *P, void *modulus, void *mp);
462
463 #endif /* LTC_SOURCE */
464304
465305 #endif
466306
538378 int dsa_import(const unsigned char *in, unsigned long inlen, dsa_key *key);
539379 int dsa_export(unsigned char *out, unsigned long *outlen, int type, const dsa_key *key);
540380 int dsa_verify_key(const dsa_key *key, int *stat);
541 #ifdef LTC_SOURCE
542 /* internal helper functions */
543 int dsa_int_validate_xy(const dsa_key *key, int *stat);
544 int dsa_int_validate_pqg(const dsa_key *key, int *stat);
545 int dsa_int_validate_primes(const dsa_key *key, int *stat);
546 #endif
547381 int dsa_shared_secret(void *private_key, void *base,
548382 const dsa_key *public_key,
549383 unsigned char *out, unsigned long *outlen);
550 #endif
384 #endif /* LTC_MDSA */
551385
552386 #ifdef LTC_DER
553387 /* DER handling */
710544 unsigned long *outlen,
711545 unsigned long *payloadlen);
712546
713 #ifdef LTC_SOURCE
714 /* internal helper functions */
715 int der_decode_custom_type_ex(const unsigned char *in, unsigned long inlen,
716 ltc_asn1_list *root,
717 ltc_asn1_list *list, unsigned long outlen, unsigned int flags);
718
719 int der_encode_asn1_identifier(const ltc_asn1_list *id, unsigned char *out, unsigned long *outlen);
720 int der_decode_asn1_identifier(const unsigned char *in, unsigned long *inlen, ltc_asn1_list *id);
721 int der_length_asn1_identifier(const ltc_asn1_list *id, unsigned long *idlen);
722
723 int der_encode_asn1_length(unsigned long len, unsigned char* out, unsigned long* outlen);
724 int der_decode_asn1_length(const unsigned char* len, unsigned long* lenlen, unsigned long* outlen);
725 int der_length_asn1_length(unsigned long len, unsigned long *outlen);
726
727 int der_length_sequence_ex(const ltc_asn1_list *list, unsigned long inlen,
728 unsigned long *outlen, unsigned long *payloadlen);
729
730 extern const ltc_asn1_type der_asn1_tag_to_type_map[];
731 extern const unsigned long der_asn1_tag_to_type_map_sz;
732
733 extern const int der_asn1_type_to_identifier_map[];
734 extern const unsigned long der_asn1_type_to_identifier_map_sz;
735 #endif /* LTC_SOURCE */
736
737547 /* SET */
738548 #define der_decode_set(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, LTC_DER_SEQ_SET)
739549 #define der_length_set der_length_sequence
746556 /* VA list handy helpers with triplets of <type, size, data> */
747557 int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...);
748558 int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...);
749 #ifdef LTC_SOURCE
750 /* internal helper functions */
751 int der_decode_sequence_multi_ex(const unsigned char *in, unsigned long inlen, unsigned int flags, ...);
752 #endif /* LTC_SOURCE */
753559
754560 /* FLEXI DECODER handle unknown list decoder */
755561 int der_decode_sequence_flexi(const unsigned char *in, unsigned long *inlen, ltc_asn1_list **out);
814620 unsigned char *out, unsigned long *outlen);
815621 int der_length_teletex_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen);
816622
817 #ifdef LTC_SOURCE
818 /* internal helper functions */
819 int der_teletex_char_encode(int c);
820 int der_teletex_value_decode(int v);
821 #endif /* LTC_SOURCE */
822
823
824623 /* PRINTABLE STRING */
825624 int der_encode_printable_string(const unsigned char *in, unsigned long inlen,
826625 unsigned char *out, unsigned long *outlen);
833632
834633 /* UTF-8 */
835634 #if (defined(SIZE_MAX) || __STDC_VERSION__ >= 199901L || defined(WCHAR_MAX) || defined(__WCHAR_MAX__) || defined(_WCHAR_T) || defined(_WCHAR_T_DEFINED) || defined (__WCHAR_TYPE__)) && !defined(LTC_NO_WCHAR)
836 #include <wchar.h>
837 #if defined(__WCHAR_MAX__)
838 #define LTC_WCHAR_MAX __WCHAR_MAX__
839 #elif defined(WCHAR_MAX)
840 #define LTC_WCHAR_MAX WCHAR_MAX
841 #endif
635 #if defined(__WCHAR_MAX__)
636 #define LTC_WCHAR_MAX __WCHAR_MAX__
637 #else
638 #include <wchar.h>
639 #define LTC_WCHAR_MAX WCHAR_MAX
640 #endif
842641 /* please note that it might happen that LTC_WCHAR_MAX is undefined */
843642 #else
844 typedef ulong32 wchar_t;
845 #define LTC_WCHAR_MAX 0xFFFFFFFF
643 typedef ulong32 wchar_t;
644 #define LTC_WCHAR_MAX 0xFFFFFFFF
846645 #endif
847646
848647 int der_encode_utf8_string(const wchar_t *in, unsigned long inlen,
851650 int der_decode_utf8_string(const unsigned char *in, unsigned long inlen,
852651 wchar_t *out, unsigned long *outlen);
853652 unsigned long der_utf8_charsize(const wchar_t c);
854 #ifdef LTC_SOURCE
855 /* internal helper functions */
856 int der_utf8_valid_char(const wchar_t c);
857 #endif /* LTC_SOURCE */
858653 int der_length_utf8_string(const wchar_t *in, unsigned long noctets, unsigned long *outlen);
859654
860655
905700
906701 int der_length_generalizedtime(const ltc_generalizedtime *gtime, unsigned long *outlen);
907702
908 #ifdef LTC_SOURCE
909 /* internal helper functions */
910 /* SUBJECT PUBLIC KEY INFO */
911 int x509_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen,
912 unsigned int algorithm, const void* public_key, unsigned long public_key_len,
913 ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long parameters_len);
914
915 int x509_decode_subject_public_key_info(const unsigned char *in, unsigned long inlen,
916 unsigned int algorithm, void* public_key, unsigned long* public_key_len,
917 ltc_asn1_type parameters_type, ltc_asn1_list* parameters, unsigned long *parameters_len);
918 #endif /* LTC_SOURCE */
919
920703 #endif
921704
922705 /* ref: $Format:%D$ */
0 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
1 *
2 * LibTomCrypt is a library that provides various cryptographic
3 * algorithms in a highly modular and flexible manner.
4 *
5 * The library is free for all purposes without any express
6 * guarantee it works.
7 */
8
9 #include "tomcrypt.h"
10
11 /*
12 * Internal Macros
13 */
14
15 #define LTC_PAD_MASK (0xF000U)
16
17 /*
18 * Internal Enums
19 */
20
21 enum public_key_algorithms {
22 PKA_RSA,
23 PKA_DSA,
24 PKA_EC,
25 PKA_EC_PRIMEF
26 };
27
28 /*
29 * Internal Types
30 */
31
32 typedef struct Oid {
33 unsigned long OID[16];
34 /** Number of OID digits in use */
35 unsigned long OIDlen;
36 } oid_st;
37
38 typedef struct {
39 int size;
40 const char *name, *base, *prime;
41 } ltc_dh_set_type;
42
43
44 /*
45 * Internal functions
46 */
47
48 /* tomcrypt_hash.h */
49
50 /* a simple macro for making hash "process" functions */
51 #define HASH_PROCESS(func_name, compress_name, state_var, block_size) \
52 int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) \
53 { \
54 unsigned long n; \
55 int err; \
56 LTC_ARGCHK(md != NULL); \
57 LTC_ARGCHK(in != NULL); \
58 if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
59 return CRYPT_INVALID_ARG; \
60 } \
61 if ((md-> state_var .length + inlen) < md-> state_var .length) { \
62 return CRYPT_HASH_OVERFLOW; \
63 } \
64 while (inlen > 0) { \
65 if (md-> state_var .curlen == 0 && inlen >= block_size) { \
66 if ((err = compress_name (md, in)) != CRYPT_OK) { \
67 return err; \
68 } \
69 md-> state_var .length += block_size * 8; \
70 in += block_size; \
71 inlen -= block_size; \
72 } else { \
73 n = MIN(inlen, (block_size - md-> state_var .curlen)); \
74 XMEMCPY(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
75 md-> state_var .curlen += n; \
76 in += n; \
77 inlen -= n; \
78 if (md-> state_var .curlen == block_size) { \
79 if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \
80 return err; \
81 } \
82 md-> state_var .length += 8*block_size; \
83 md-> state_var .curlen = 0; \
84 } \
85 } \
86 } \
87 return CRYPT_OK; \
88 }
89
90
91 /* tomcrypt_mac.h */
92
93 int ocb3_int_ntz(unsigned long x);
94 void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const unsigned char *block_b, unsigned long block_len);
95
96
97 /* tomcrypt_math.h */
98
99 #if !defined(DESC_DEF_ONLY)
100
101 #define MP_DIGIT_BIT ltc_mp.bits_per_digit
102
103 /* some handy macros */
104 #define mp_init(a) ltc_mp.init(a)
105 #define mp_init_multi ltc_init_multi
106 #define mp_clear(a) ltc_mp.deinit(a)
107 #define mp_clear_multi ltc_deinit_multi
108 #define mp_cleanup_multi ltc_cleanup_multi
109 #define mp_init_copy(a, b) ltc_mp.init_copy(a, b)
110
111 #define mp_neg(a, b) ltc_mp.neg(a, b)
112 #define mp_copy(a, b) ltc_mp.copy(a, b)
113
114 #define mp_set(a, b) ltc_mp.set_int(a, b)
115 #define mp_set_int(a, b) ltc_mp.set_int(a, b)
116 #define mp_get_int(a) ltc_mp.get_int(a)
117 #define mp_get_digit(a, n) ltc_mp.get_digit(a, n)
118 #define mp_get_digit_count(a) ltc_mp.get_digit_count(a)
119 #define mp_cmp(a, b) ltc_mp.compare(a, b)
120 #define mp_cmp_d(a, b) ltc_mp.compare_d(a, b)
121 #define mp_count_bits(a) ltc_mp.count_bits(a)
122 #define mp_cnt_lsb(a) ltc_mp.count_lsb_bits(a)
123 #define mp_2expt(a, b) ltc_mp.twoexpt(a, b)
124
125 #define mp_read_radix(a, b, c) ltc_mp.read_radix(a, b, c)
126 #define mp_toradix(a, b, c) ltc_mp.write_radix(a, b, c)
127 #define mp_unsigned_bin_size(a) ltc_mp.unsigned_size(a)
128 #define mp_to_unsigned_bin(a, b) ltc_mp.unsigned_write(a, b)
129 #define mp_read_unsigned_bin(a, b, c) ltc_mp.unsigned_read(a, b, c)
130
131 #define mp_add(a, b, c) ltc_mp.add(a, b, c)
132 #define mp_add_d(a, b, c) ltc_mp.addi(a, b, c)
133 #define mp_sub(a, b, c) ltc_mp.sub(a, b, c)
134 #define mp_sub_d(a, b, c) ltc_mp.subi(a, b, c)
135 #define mp_mul(a, b, c) ltc_mp.mul(a, b, c)
136 #define mp_mul_d(a, b, c) ltc_mp.muli(a, b, c)
137 #define mp_sqr(a, b) ltc_mp.sqr(a, b)
138 #define mp_sqrtmod_prime(a, b, c) ltc_mp.sqrtmod_prime(a, b, c)
139 #define mp_div(a, b, c, d) ltc_mp.mpdiv(a, b, c, d)
140 #define mp_div_2(a, b) ltc_mp.div_2(a, b)
141 #define mp_mod(a, b, c) ltc_mp.mpdiv(a, b, NULL, c)
142 #define mp_mod_d(a, b, c) ltc_mp.modi(a, b, c)
143 #define mp_gcd(a, b, c) ltc_mp.gcd(a, b, c)
144 #define mp_lcm(a, b, c) ltc_mp.lcm(a, b, c)
145
146 #define mp_addmod(a, b, c, d) ltc_mp.addmod(a, b, c, d)
147 #define mp_submod(a, b, c, d) ltc_mp.submod(a, b, c, d)
148 #define mp_mulmod(a, b, c, d) ltc_mp.mulmod(a, b, c, d)
149 #define mp_sqrmod(a, b, c) ltc_mp.sqrmod(a, b, c)
150 #define mp_invmod(a, b, c) ltc_mp.invmod(a, b, c)
151
152 #define mp_montgomery_setup(a, b) ltc_mp.montgomery_setup(a, b)
153 #define mp_montgomery_normalization(a, b) ltc_mp.montgomery_normalization(a, b)
154 #define mp_montgomery_reduce(a, b, c) ltc_mp.montgomery_reduce(a, b, c)
155 #define mp_montgomery_free(a) ltc_mp.montgomery_deinit(a)
156