add LTC prefix to most macros

This commit is contained in:
Steffen Jaeckel 2014-07-17 10:49:05 +02:00
parent 3c76dcdd29
commit 155a54ba40
24 changed files with 74 additions and 74 deletions

View File

@ -15,7 +15,7 @@
*/ */
#include "tomcrypt.h" #include "tomcrypt.h"
#if defined(LTC_GCM_TABLES) || defined(LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) #if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))
/* this is x*2^128 mod p(x) ... the results are 16 bytes each stored in a packed format. Since only the /* this is x*2^128 mod p(x) ... the results are 16 bytes each stored in a packed format. Since only the
* lower 16 bits are not zero'ed I removed the upper 14 bytes */ * lower 16 bits are not zero'ed I removed the upper 14 bytes */

View File

@ -310,7 +310,7 @@ typedef struct {
/** The scheduled symmetric key */ /** The scheduled symmetric key */
symmetric_key key; symmetric_key key;
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
/** The pre-computed multiplication table */ /** The pre-computed multiplication table */
unsigned char PC[16][256][16]; unsigned char PC[16][256][16];
#endif #endif

View File

@ -108,7 +108,7 @@
#define LTC_SPRNG #define LTC_SPRNG
#define LTC_YARROW #define LTC_YARROW
#define LTC_DEVRANDOM #define LTC_DEVRANDOM
#define TRY_URANDOM_FIRST #define LTC_TRY_URANDOM_FIRST
#define LTC_NO_PK #define LTC_NO_PK
#define LTC_MRSA #define LTC_MRSA
@ -212,7 +212,7 @@
/* like GCM mode this will enable 16 8x128 tables [64KB] that make /* like GCM mode this will enable 16 8x128 tables [64KB] that make
* seeking very fast. * seeking very fast.
*/ */
#define LRW_TABLES #define LTC_LRW_TABLES
#endif #endif
/* XTS mode */ /* XTS mode */
@ -304,7 +304,7 @@
/* the *nix style /dev/random device */ /* the *nix style /dev/random device */
#define LTC_DEVRANDOM #define LTC_DEVRANDOM
/* try /dev/urandom before trying /dev/random */ /* try /dev/urandom before trying /dev/random */
#define TRY_URANDOM_FIRST #define LTC_TRY_URANDOM_FIRST
#endif /* LTC_NO_PRNGS */ #endif /* LTC_NO_PRNGS */
@ -324,23 +324,23 @@
/* is_prime fails for GMP */ /* is_prime fails for GMP */
#define LTC_MDH #define LTC_MDH
/* Supported Key Sizes */ /* Supported Key Sizes */
#define DH768 #define LTC_DH768
#define DH1024 #define LTC_DH1024
#define DH1280 #define LTC_DH1280
#define DH1536 #define LTC_DH1536
#define DH1792 #define LTC_DH1792
#define DH2048 #define LTC_DH2048
#ifndef TFM_DESC #ifndef TFM_DESC
/* tfm has a problem in fp_isprime for larger key sizes */ /* tfm has a problem in fp_isprime for larger key sizes */
#define DH2560 #define LTC_DH2560
#define DH3072 #define LTC_DH3072
#define DH4096 #define LTC_DH4096
#endif #endif
#endif #endif
/* Include Katja (a Rabin variant like RSA) */ /* Include Katja (a Rabin variant like RSA) */
/* #define MKAT */ /* #define LTC_MKAT */
/* Digital Signature Algorithm */ /* Digital Signature Algorithm */
#define LTC_MDSA #define LTC_MDSA
@ -398,20 +398,20 @@
#ifdef LTC_MECC #ifdef LTC_MECC
/* Supported ECC Key Sizes */ /* Supported ECC Key Sizes */
#ifndef LTC_NO_CURVES #ifndef LTC_NO_CURVES
#define ECC112 #define LTC_ECC112
#define ECC128 #define LTC_ECC128
#define ECC160 #define LTC_ECC160
#define ECC192 #define LTC_ECC192
#define ECC224 #define LTC_ECC224
#define ECC256 #define LTC_ECC256
#define ECC384 #define LTC_ECC384
#define ECC521 #define LTC_ECC521
#endif #endif
#endif #endif
#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(MKATJA) #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT)
/* Include the MPI functionality? (required by the PK algorithms) */ /* Include the MPI functionality? (required by the PK algorithms) */
#define MPI #define LTC_MPI
#endif #endif
#ifdef LTC_MRSA #ifdef LTC_MRSA
@ -435,11 +435,11 @@
#error LTC_YARROW requires LTC_CTR_MODE chaining mode to be defined! #error LTC_YARROW requires LTC_CTR_MODE chaining mode to be defined!
#endif #endif
#if defined(LTC_DER) && !defined(MPI) #if defined(LTC_DER) && !defined(LTC_MPI)
#error ASN.1 DER requires MPI functionality #error ASN.1 DER requires MPI functionality
#endif #endif
#if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC) || defined(MKATJA)) && !defined(LTC_DER) #if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC) || defined(LTC_MKAT)) && !defined(LTC_DER)
#error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled #error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled
#endif #endif

View File

@ -292,7 +292,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
/* table shared between GCM and LRW */ /* table shared between GCM and LRW */
#if defined(LTC_GCM_TABLES) || defined(LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST)) #if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))
extern const unsigned char gcm_shift_table[]; extern const unsigned char gcm_shift_table[];
#endif #endif

View File

@ -111,7 +111,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key);
#endif #endif
/* ---- Katja ---- */ /* ---- Katja ---- */
#ifdef MKAT #ifdef LTC_MKAT
/* Min and Max KAT key sizes (in bits) */ /* Min and Max KAT key sizes (in bits) */
#define MIN_KAT_SIZE 1024 #define MIN_KAT_SIZE 1024

View File

@ -10,7 +10,7 @@
*/ */
#include "tomcrypt.h" #include "tomcrypt.h"
#ifdef MPI #ifdef LTC_MPI
#include <stdarg.h> #include <stdarg.h>
int ltc_init_multi(void **a, ...) int ltc_init_multi(void **a, ...)

View File

@ -188,7 +188,7 @@ const char *crypt_build_settings =
#endif #endif
#if defined(LTC_LRW_MODE) #if defined(LTC_LRW_MODE)
" LRW" " LRW"
#if defined(LRW_TABLES) #if defined(LTC_LRW_TABLES)
" (tables) " " (tables) "
#endif #endif
"\n" "\n"
@ -282,7 +282,7 @@ const char *crypt_build_settings =
#if defined(LTC_MDSA) #if defined(LTC_MDSA)
" DSA\n" " DSA\n"
#endif #endif
#if defined(MKAT) #if defined(LTC_MKAT)
" Katja\n" " Katja\n"
#endif #endif
@ -338,8 +338,8 @@ const char *crypt_build_settings =
#if defined(MPI) #if defined(MPI)
" MPI " " MPI "
#endif #endif
#if defined(TRY_URANDOM_FIRST) #if defined(LTC_TRY_URANDOM_FIRST)
" TRY_URANDOM_FIRST " " LTC_TRY_URANDOM_FIRST "
#endif #endif
#if defined(LTC_TEST) #if defined(LTC_TEST)
" LTC_TEST " " LTC_TEST "

View File

@ -56,12 +56,12 @@ static const crypt_constant _crypt_constants[] = {
{"LTC_MRSA", 0}, {"LTC_MRSA", 0},
#endif #endif
#ifdef MKAT #ifdef LTC_MKAT
{"MKAT", 1}, {"LTC_MKAT", 1},
_C_STRINGIFY(MIN_KAT_SIZE), _C_STRINGIFY(MIN_KAT_SIZE),
_C_STRINGIFY(MAX_KAT_SIZE), _C_STRINGIFY(MAX_KAT_SIZE),
#else #else
{"MKAT", 0}, {"LTC_MKAT", 0},
#endif #endif
#ifdef LTC_MECC #ifdef LTC_MECC

View File

@ -210,7 +210,7 @@ static const crypt_size _crypt_sizes[] = {
_SZ_STRINGIFY_T(ecc_key), _SZ_STRINGIFY_T(ecc_key),
_SZ_STRINGIFY_T(ecc_point), _SZ_STRINGIFY_T(ecc_point),
#endif #endif
#ifdef MKAT #ifdef LTC_MKAT
_SZ_STRINGIFY_T(katja_key), _SZ_STRINGIFY_T(katja_key),
#endif #endif

View File

@ -30,7 +30,7 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i
{ {
unsigned char prod[16]; unsigned char prod[16];
int x, err; int x, err;
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
int y; int y;
#endif #endif
@ -55,7 +55,7 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i
} }
/* update pad */ /* update pad */
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
/* for each byte changed we undo it's affect on the pad then add the new product */ /* for each byte changed we undo it's affect on the pad then add the new product */
for (; x < 16; x++) { for (; x < 16; x++) {
#ifdef LTC_FAST #ifdef LTC_FAST

View File

@ -27,7 +27,7 @@
int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw) int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw)
{ {
int err; int err;
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
unsigned char T[16]; unsigned char T[16];
int x, y; int x, y;
#endif #endif
@ -51,7 +51,7 @@ int lrw_setiv(const unsigned char *IV, unsigned long len, symmetric_LRW *lrw)
return CRYPT_OK; return CRYPT_OK;
} }
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
XMEMCPY(T, &lrw->PC[0][IV[0]][0], 16); XMEMCPY(T, &lrw->PC[0][IV[0]][0], 16);
for (x = 1; x < 16; x++) { for (x = 1; x < 16; x++) {
#ifdef LTC_FAST #ifdef LTC_FAST

View File

@ -36,7 +36,7 @@ int lrw_start( int cipher,
symmetric_LRW *lrw) symmetric_LRW *lrw)
{ {
int err; int err;
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
unsigned char B[16]; unsigned char B[16];
int x, y, z, t; int x, y, z, t;
#endif #endif
@ -69,7 +69,7 @@ int lrw_start( int cipher,
/* copy the IV and tweak */ /* copy the IV and tweak */
XMEMCPY(lrw->tweak, tweak, 16); XMEMCPY(lrw->tweak, tweak, 16);
#ifdef LRW_TABLES #ifdef LTC_LRW_TABLES
/* setup tables */ /* setup tables */
/* generate the first table as it has no shifting (from which we make the other tables) */ /* generate the first table as it has no shifting (from which we make the other tables) */
zeromem(B, 16); zeromem(B, 16);

View File

@ -22,7 +22,7 @@
/* This holds the key settings. ***MUST*** be organized by size from smallest to largest. */ /* This holds the key settings. ***MUST*** be organized by size from smallest to largest. */
const dh_set sets[] = { const dh_set sets[] = {
#ifdef DH768 #ifdef LTC_DH768
{ {
96, 96,
"DH-768", "DH-768",
@ -32,7 +32,7 @@ const dh_set sets[] = {
"//////m3wvV" "//////m3wvV"
}, },
#endif #endif
#ifdef DH1024 #ifdef LTC_DH1024
{ {
128, 128,
"DH-1024", "DH-1024",
@ -42,7 +42,7 @@ const dh_set sets[] = {
"////////////////////////////////////////////////m3C47" "////////////////////////////////////////////////m3C47"
}, },
#endif #endif
#ifdef DH1280 #ifdef LTC_DH1280
{ {
160, 160,
"DH-1280", "DH-1280",
@ -53,7 +53,7 @@ const dh_set sets[] = {
"//////////////////////////////m4kSN" "//////////////////////////////m4kSN"
}, },
#endif #endif
#ifdef DH1536 #ifdef LTC_DH1536
{ {
192, 192,
"DH-1536", "DH-1536",
@ -65,7 +65,7 @@ const dh_set sets[] = {
"////////////m5uqd" "////////////m5uqd"
}, },
#endif #endif
#ifdef DH1792 #ifdef LTC_DH1792
{ {
224, 224,
"DH-1792", "DH-1792",
@ -77,7 +77,7 @@ const dh_set sets[] = {
"//////////////////////////////////////////////////////mT/sd" "//////////////////////////////////////////////////////mT/sd"
}, },
#endif #endif
#ifdef DH2048 #ifdef LTC_DH2048
{ {
256, 256,
"DH-2048", "DH-2048",
@ -90,7 +90,7 @@ const dh_set sets[] = {
"/////////////////////////////////////////m8MPh" "/////////////////////////////////////////m8MPh"
}, },
#endif #endif
#ifdef DH2560 #ifdef LTC_DH2560
{ {
320, 320,
"DH-2560", "DH-2560",
@ -105,7 +105,7 @@ const dh_set sets[] = {
"/////mKFpF" "/////mKFpF"
}, },
#endif #endif
#ifdef DH3072 #ifdef LTC_DH3072
{ {
384, 384,
"DH-3072", "DH-3072",
@ -121,7 +121,7 @@ const dh_set sets[] = {
"/////////////////////////////m32nN" "/////////////////////////////m32nN"
}, },
#endif #endif
#ifdef DH4096 #ifdef LTC_DH4096
{ {
512, 512,
"DH-4096", "DH-4096",

View File

@ -25,7 +25,7 @@
/* This holds the key settings. ***MUST*** be organized by size from smallest to largest. */ /* This holds the key settings. ***MUST*** be organized by size from smallest to largest. */
const ltc_ecc_set_type ltc_ecc_sets[] = { const ltc_ecc_set_type ltc_ecc_sets[] = {
#ifdef ECC112 #ifdef LTC_ECC112
{ {
14, 14,
"SECP112R1", "SECP112R1",
@ -36,7 +36,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"A89CE5AF8724C0A23E0E0FF77500" "A89CE5AF8724C0A23E0E0FF77500"
}, },
#endif #endif
#ifdef ECC128 #ifdef LTC_ECC128
{ {
16, 16,
"SECP128R1", "SECP128R1",
@ -47,7 +47,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"CF5AC8395BAFEB13C02DA292DDED7A83", "CF5AC8395BAFEB13C02DA292DDED7A83",
}, },
#endif #endif
#ifdef ECC160 #ifdef LTC_ECC160
{ {
20, 20,
"SECP160R1", "SECP160R1",
@ -58,7 +58,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"23A628553168947D59DCC912042351377AC5FB32", "23A628553168947D59DCC912042351377AC5FB32",
}, },
#endif #endif
#ifdef ECC192 #ifdef LTC_ECC192
{ {
24, 24,
"ECC-192", "ECC-192",
@ -69,7 +69,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"7192B95FFC8DA78631011ED6B24CDD573F977A11E794811", "7192B95FFC8DA78631011ED6B24CDD573F977A11E794811",
}, },
#endif #endif
#ifdef ECC224 #ifdef LTC_ECC224
{ {
28, 28,
"ECC-224", "ECC-224",
@ -80,7 +80,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34", "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",
}, },
#endif #endif
#ifdef ECC256 #ifdef LTC_ECC256
{ {
32, 32,
"ECC-256", "ECC-256",
@ -91,7 +91,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5", "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",
}, },
#endif #endif
#ifdef ECC384 #ifdef LTC_ECC384
{ {
48, 48,
"ECC-384", "ECC-384",
@ -102,7 +102,7 @@ const ltc_ecc_set_type ltc_ecc_sets[] = {
"3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F", "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F",
}, },
#endif #endif
#ifdef ECC521 #ifdef LTC_ECC521
{ {
66, 66,
"ECC-521", "ECC-521",

View File

@ -15,7 +15,7 @@
Katja PKCS #1 OAEP Decryption, Tom St Denis Katja PKCS #1 OAEP Decryption, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
(PKCS #1 v2.0) decrypt then OAEP depad (PKCS #1 v2.0) decrypt then OAEP depad

View File

@ -15,7 +15,7 @@
Katja PKCS-style OAEP encryption, Tom St Denis Katja PKCS-style OAEP encryption, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
(PKCS #1 v2.0) OAEP pad then encrypt (PKCS #1 v2.0) OAEP pad then encrypt

View File

@ -15,7 +15,7 @@
Export Katja PKCS-style keys, Tom St Denis Export Katja PKCS-style keys, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
This will export either an KatjaPublicKey or KatjaPrivateKey This will export either an KatjaPublicKey or KatjaPrivateKey

View File

@ -15,7 +15,7 @@
Katja PKCS-style exptmod, Tom St Denis Katja PKCS-style exptmod, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
Compute an RSA modular exponentiation Compute an RSA modular exponentiation

View File

@ -15,7 +15,7 @@
Free an Katja key, Tom St Denis Free an Katja key, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
Free an Katja key from memory Free an Katja key from memory

View File

@ -15,7 +15,7 @@
Import a PKCS-style Katja key, Tom St Denis Import a PKCS-style Katja key, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
Import an KatjaPublicKey or KatjaPrivateKey [two-prime only, only support >= 1024-bit keys, defined in PKCS #1 v2.1] Import an KatjaPublicKey or KatjaPrivateKey [two-prime only, only support >= 1024-bit keys, defined in PKCS #1 v2.1]

View File

@ -15,7 +15,7 @@
Katja key generation, Tom St Denis Katja key generation, Tom St Denis
*/ */
#ifdef MKAT #ifdef LTC_MKAT
/** /**
Create a Katja key Create a Katja key

View File

@ -25,10 +25,10 @@ static unsigned long rng_nix(unsigned char *buf, unsigned long len,
#else #else
FILE *f; FILE *f;
unsigned long x; unsigned long x;
#ifdef TRY_URANDOM_FIRST #ifdef LTC_TRY_URANDOM_FIRST
f = fopen("/dev/urandom", "rb"); f = fopen("/dev/urandom", "rb");
if (f == NULL) if (f == NULL)
#endif /* TRY_URANDOM_FIRST */ #endif /* LTC_TRY_URANDOM_FIRST */
f = fopen("/dev/random", "rb"); f = fopen("/dev/random", "rb");
if (f == NULL) { if (f == NULL) {

View File

@ -1,6 +1,6 @@
#include <tomcrypt_test.h> #include <tomcrypt_test.h>
#ifdef MKAT #ifdef LTC_MKAT
int katja_test(void) int katja_test(void)
{ {

View File

@ -776,10 +776,10 @@ int time_hash(void)
/*#warning you need an mp_rand!!!*/ /*#warning you need an mp_rand!!!*/
#ifndef USE_LTM #ifndef USE_LTM
#undef MPI #undef LTC_MPI
#endif #endif
#ifdef MPI #ifdef LTC_MPI
void time_mult(void) void time_mult(void)
{ {
ulong64 t1, t2; ulong64 t1, t2;