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"
#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
* 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 */
symmetric_key key;
#ifdef LRW_TABLES
#ifdef LTC_LRW_TABLES
/** The pre-computed multiplication table */
unsigned char PC[16][256][16];
#endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -210,7 +210,7 @@ static const crypt_size _crypt_sizes[] = {
_SZ_STRINGIFY_T(ecc_key),
_SZ_STRINGIFY_T(ecc_point),
#endif
#ifdef MKAT
#ifdef LTC_MKAT
_SZ_STRINGIFY_T(katja_key),
#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];
int x, err;
#ifdef LRW_TABLES
#ifdef LTC_LRW_TABLES
int y;
#endif
@ -55,7 +55,7 @@ int lrw_process(const unsigned char *pt, unsigned char *ct, unsigned long len, i
}
/* 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 (; x < 16; x++) {
#ifdef LTC_FAST

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@
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]

View File

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

View File

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

View File

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

View File

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