mirror of
https://github.com/clearml/dropbear
synced 2025-06-26 18:17:32 +00:00
merge from main (libtommath/libtomcrypt/curve25510-donna updates)
--HG-- branch : fuzz
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -333,6 +333,8 @@ kernels, from Steve Dover
|
||||
|
||||
2013.61test - Thursday 14 November 2013
|
||||
|
||||
- Default generated RSA key size changed from 1024 to 2048 bits
|
||||
|
||||
- ECC (elliptic curve) support. Supports ECDSA hostkeys (requires new keys to
|
||||
be generated) and ECDH for setting up encryption keys (no intervention
|
||||
required). This is significantly faster.
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
*
|
||||
* This is, almost, a clean room reimplementation from the curve25519 paper. It
|
||||
* uses many of the tricks described therein. Only the crecip function is taken
|
||||
* from the sample implementation.
|
||||
*/
|
||||
* from the sample implementation. */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
@@ -63,25 +62,23 @@ typedef int64_t limb;
|
||||
* significant first. The value of the field element is:
|
||||
* x[0] + 2^26·x[1] + x^51·x[2] + 2^102·x[3] + ...
|
||||
*
|
||||
* i.e. the limbs are 26, 25, 26, 25, ... bits wide.
|
||||
*/
|
||||
* i.e. the limbs are 26, 25, 26, 25, ... bits wide. */
|
||||
|
||||
/* Sum two numbers: output += in */
|
||||
static void fsum(limb *output, const limb *in) {
|
||||
unsigned i;
|
||||
for (i = 0; i < 10; i += 2) {
|
||||
output[0+i] = (output[0+i] + in[0+i]);
|
||||
output[1+i] = (output[1+i] + in[1+i]);
|
||||
output[0+i] = output[0+i] + in[0+i];
|
||||
output[1+i] = output[1+i] + in[1+i];
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the difference of two numbers: output = in - output
|
||||
* (note the order of the arguments!)
|
||||
*/
|
||||
* (note the order of the arguments!). */
|
||||
static void fdifference(limb *output, const limb *in) {
|
||||
unsigned i;
|
||||
for (i = 0; i < 10; ++i) {
|
||||
output[i] = (in[i] - output[i]);
|
||||
output[i] = in[i] - output[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +94,8 @@ static void fscalar_product(limb *output, const limb *in, const limb scalar) {
|
||||
*
|
||||
* output must be distinct to both inputs. The inputs are reduced coefficient
|
||||
* form, the output is not.
|
||||
*/
|
||||
*
|
||||
* output[x] <= 14 * the largest product of the input limbs. */
|
||||
static void fproduct(limb *output, const limb *in2, const limb *in) {
|
||||
output[0] = ((limb) ((s32) in2[0])) * ((s32) in[0]);
|
||||
output[1] = ((limb) ((s32) in2[0])) * ((s32) in[1]) +
|
||||
@@ -201,9 +199,15 @@ static void fproduct(limb *output, const limb *in2, const limb *in) {
|
||||
output[18] = 2 * ((limb) ((s32) in2[9])) * ((s32) in[9]);
|
||||
}
|
||||
|
||||
/* Reduce a long form to a short form by taking the input mod 2^255 - 19. */
|
||||
/* Reduce a long form to a short form by taking the input mod 2^255 - 19.
|
||||
*
|
||||
* On entry: |output[i]| < 14*2^54
|
||||
* On exit: |output[0..8]| < 280*2^54 */
|
||||
static void freduce_degree(limb *output) {
|
||||
/* Each of these shifts and adds ends up multiplying the value by 19. */
|
||||
/* Each of these shifts and adds ends up multiplying the value by 19.
|
||||
*
|
||||
* For output[0..8], the absolute entry value is < 14*2^54 and we add, at
|
||||
* most, 19*14*2^54 thus, on exit, |output[0..8]| < 280*2^54. */
|
||||
output[8] += output[18] << 4;
|
||||
output[8] += output[18] << 1;
|
||||
output[8] += output[18];
|
||||
@@ -237,11 +241,13 @@ static void freduce_degree(limb *output) {
|
||||
#error "This code only works on a two's complement system"
|
||||
#endif
|
||||
|
||||
/* return v / 2^26, using only shifts and adds. */
|
||||
/* return v / 2^26, using only shifts and adds.
|
||||
*
|
||||
* On entry: v can take any value. */
|
||||
static inline limb
|
||||
div_by_2_26(const limb v)
|
||||
{
|
||||
/* High word of v; no shift needed*/
|
||||
/* High word of v; no shift needed. */
|
||||
const uint32_t highword = (uint32_t) (((uint64_t) v) >> 32);
|
||||
/* Set to all 1s if v was negative; else set to 0s. */
|
||||
const int32_t sign = ((int32_t) highword) >> 31;
|
||||
@@ -251,7 +257,9 @@ div_by_2_26(const limb v)
|
||||
return (v + roundoff) >> 26;
|
||||
}
|
||||
|
||||
/* return v / (2^25), using only shifts and adds. */
|
||||
/* return v / (2^25), using only shifts and adds.
|
||||
*
|
||||
* On entry: v can take any value. */
|
||||
static inline limb
|
||||
div_by_2_25(const limb v)
|
||||
{
|
||||
@@ -265,17 +273,9 @@ div_by_2_25(const limb v)
|
||||
return (v + roundoff) >> 25;
|
||||
}
|
||||
|
||||
static inline s32
|
||||
div_s32_by_2_25(const s32 v)
|
||||
{
|
||||
const s32 roundoff = ((uint32_t)(v >> 31)) >> 7;
|
||||
return (v + roundoff) >> 25;
|
||||
}
|
||||
|
||||
/* Reduce all coefficients of the short form input so that |x| < 2^26.
|
||||
*
|
||||
* On entry: |output[i]| < 2^62
|
||||
*/
|
||||
* On entry: |output[i]| < 280*2^54 */
|
||||
static void freduce_coefficients(limb *output) {
|
||||
unsigned i;
|
||||
|
||||
@@ -283,56 +283,65 @@ static void freduce_coefficients(limb *output) {
|
||||
|
||||
for (i = 0; i < 10; i += 2) {
|
||||
limb over = div_by_2_26(output[i]);
|
||||
/* The entry condition (that |output[i]| < 280*2^54) means that over is, at
|
||||
* most, 280*2^28 in the first iteration of this loop. This is added to the
|
||||
* next limb and we can approximate the resulting bound of that limb by
|
||||
* 281*2^54. */
|
||||
output[i] -= over << 26;
|
||||
output[i+1] += over;
|
||||
|
||||
/* For the first iteration, |output[i+1]| < 281*2^54, thus |over| <
|
||||
* 281*2^29. When this is added to the next limb, the resulting bound can
|
||||
* be approximated as 281*2^54.
|
||||
*
|
||||
* For subsequent iterations of the loop, 281*2^54 remains a conservative
|
||||
* bound and no overflow occurs. */
|
||||
over = div_by_2_25(output[i+1]);
|
||||
output[i+1] -= over << 25;
|
||||
output[i+2] += over;
|
||||
}
|
||||
/* Now |output[10]| < 2 ^ 38 and all other coefficients are reduced. */
|
||||
/* Now |output[10]| < 281*2^29 and all other coefficients are reduced. */
|
||||
output[0] += output[10] << 4;
|
||||
output[0] += output[10] << 1;
|
||||
output[0] += output[10];
|
||||
|
||||
output[10] = 0;
|
||||
|
||||
/* Now output[1..9] are reduced, and |output[0]| < 2^26 + 19 * 2^38
|
||||
* So |over| will be no more than 77825 */
|
||||
/* Now output[1..9] are reduced, and |output[0]| < 2^26 + 19*281*2^29
|
||||
* So |over| will be no more than 2^16. */
|
||||
{
|
||||
limb over = div_by_2_26(output[0]);
|
||||
output[0] -= over << 26;
|
||||
output[1] += over;
|
||||
}
|
||||
|
||||
/* Now output[0,2..9] are reduced, and |output[1]| < 2^25 + 77825
|
||||
* So |over| will be no more than 1. */
|
||||
{
|
||||
/* output[1] fits in 32 bits, so we can use div_s32_by_2_25 here. */
|
||||
s32 over32 = div_s32_by_2_25((s32) output[1]);
|
||||
output[1] -= over32 << 25;
|
||||
output[2] += over32;
|
||||
}
|
||||
|
||||
/* Finally, output[0,1,3..9] are reduced, and output[2] is "nearly reduced":
|
||||
* we have |output[2]| <= 2^26. This is good enough for all of our math,
|
||||
* but it will require an extra freduce_coefficients before fcontract. */
|
||||
/* Now output[0,2..9] are reduced, and |output[1]| < 2^25 + 2^16 < 2^26. The
|
||||
* bound on |output[1]| is sufficient to meet our needs. */
|
||||
}
|
||||
|
||||
/* A helpful wrapper around fproduct: output = in * in2.
|
||||
*
|
||||
* output must be distinct to both inputs. The output is reduced degree and
|
||||
* reduced coefficient.
|
||||
*/
|
||||
* On entry: |in[i]| < 2^27 and |in2[i]| < 2^27.
|
||||
*
|
||||
* output must be distinct to both inputs. The output is reduced degree
|
||||
* (indeed, one need only provide storage for 10 limbs) and |output[i]| < 2^26. */
|
||||
static void
|
||||
fmul(limb *output, const limb *in, const limb *in2) {
|
||||
limb t[19];
|
||||
fproduct(t, in, in2);
|
||||
/* |t[i]| < 14*2^54 */
|
||||
freduce_degree(t);
|
||||
freduce_coefficients(t);
|
||||
/* |t[i]| < 2^26 */
|
||||
memcpy(output, t, sizeof(limb) * 10);
|
||||
}
|
||||
|
||||
/* Square a number: output = in**2
|
||||
*
|
||||
* output must be distinct from the input. The inputs are reduced coefficient
|
||||
* form, the output is not.
|
||||
*
|
||||
* output[x] <= 14 * the largest product of the input limbs. */
|
||||
static void fsquare_inner(limb *output, const limb *in) {
|
||||
output[0] = ((limb) ((s32) in[0])) * ((s32) in[0]);
|
||||
output[1] = 2 * ((limb) ((s32) in[0])) * ((s32) in[1]);
|
||||
@@ -391,12 +400,23 @@ static void fsquare_inner(limb *output, const limb *in) {
|
||||
output[18] = 2 * ((limb) ((s32) in[9])) * ((s32) in[9]);
|
||||
}
|
||||
|
||||
/* fsquare sets output = in^2.
|
||||
*
|
||||
* On entry: The |in| argument is in reduced coefficients form and |in[i]| <
|
||||
* 2^27.
|
||||
*
|
||||
* On exit: The |output| argument is in reduced coefficients form (indeed, one
|
||||
* need only provide storage for 10 limbs) and |out[i]| < 2^26. */
|
||||
static void
|
||||
fsquare(limb *output, const limb *in) {
|
||||
limb t[19];
|
||||
fsquare_inner(t, in);
|
||||
/* |t[i]| < 14*2^54 because the largest product of two limbs will be <
|
||||
* 2^(27+27) and fsquare_inner adds together, at most, 14 of those
|
||||
* products. */
|
||||
freduce_degree(t);
|
||||
freduce_coefficients(t);
|
||||
/* |t[i]| < 2^26 */
|
||||
memcpy(output, t, sizeof(limb) * 10);
|
||||
}
|
||||
|
||||
@@ -417,7 +437,7 @@ fexpand(limb *output, const u8 *input) {
|
||||
F(6, 19, 1, 0x3ffffff);
|
||||
F(7, 22, 3, 0x1ffffff);
|
||||
F(8, 25, 4, 0x3ffffff);
|
||||
F(9, 28, 6, 0x3ffffff);
|
||||
F(9, 28, 6, 0x1ffffff);
|
||||
#undef F
|
||||
}
|
||||
|
||||
@@ -425,60 +445,143 @@ fexpand(limb *output, const u8 *input) {
|
||||
#error "This code only works when >> does sign-extension on negative numbers"
|
||||
#endif
|
||||
|
||||
/* s32_eq returns 0xffffffff iff a == b and zero otherwise. */
|
||||
static s32 s32_eq(s32 a, s32 b) {
|
||||
a = ~(a ^ b);
|
||||
a &= a << 16;
|
||||
a &= a << 8;
|
||||
a &= a << 4;
|
||||
a &= a << 2;
|
||||
a &= a << 1;
|
||||
return a >> 31;
|
||||
}
|
||||
|
||||
/* s32_gte returns 0xffffffff if a >= b and zero otherwise, where a and b are
|
||||
* both non-negative. */
|
||||
static s32 s32_gte(s32 a, s32 b) {
|
||||
a -= b;
|
||||
/* a >= 0 iff a >= b. */
|
||||
return ~(a >> 31);
|
||||
}
|
||||
|
||||
/* Take a fully reduced polynomial form number and contract it into a
|
||||
* little-endian, 32-byte array
|
||||
*/
|
||||
* little-endian, 32-byte array.
|
||||
*
|
||||
* On entry: |input_limbs[i]| < 2^26 */
|
||||
static void
|
||||
fcontract(u8 *output, limb *input) {
|
||||
fcontract(u8 *output, limb *input_limbs) {
|
||||
int i;
|
||||
int j;
|
||||
s32 input[10];
|
||||
s32 mask;
|
||||
|
||||
/* |input_limbs[i]| < 2^26, so it's valid to convert to an s32. */
|
||||
for (i = 0; i < 10; i++) {
|
||||
input[i] = input_limbs[i];
|
||||
}
|
||||
|
||||
for (j = 0; j < 2; ++j) {
|
||||
for (i = 0; i < 9; ++i) {
|
||||
if ((i & 1) == 1) {
|
||||
/* This calculation is a time-invariant way to make input[i] positive
|
||||
by borrowing from the next-larger limb.
|
||||
*/
|
||||
const s32 mask = (s32)(input[i]) >> 31;
|
||||
const s32 carry = -(((s32)(input[i]) & mask) >> 25);
|
||||
input[i] = (s32)(input[i]) + (carry << 25);
|
||||
input[i+1] = (s32)(input[i+1]) - carry;
|
||||
/* This calculation is a time-invariant way to make input[i]
|
||||
* non-negative by borrowing from the next-larger limb. */
|
||||
const s32 mask = input[i] >> 31;
|
||||
const s32 carry = -((input[i] & mask) >> 25);
|
||||
input[i] = input[i] + (carry << 25);
|
||||
input[i+1] = input[i+1] - carry;
|
||||
} else {
|
||||
const s32 mask = (s32)(input[i]) >> 31;
|
||||
const s32 carry = -(((s32)(input[i]) & mask) >> 26);
|
||||
input[i] = (s32)(input[i]) + (carry << 26);
|
||||
input[i+1] = (s32)(input[i+1]) - carry;
|
||||
const s32 mask = input[i] >> 31;
|
||||
const s32 carry = -((input[i] & mask) >> 26);
|
||||
input[i] = input[i] + (carry << 26);
|
||||
input[i+1] = input[i+1] - carry;
|
||||
}
|
||||
}
|
||||
|
||||
/* There's no greater limb for input[9] to borrow from, but we can multiply
|
||||
* by 19 and borrow from input[0], which is valid mod 2^255-19. */
|
||||
{
|
||||
const s32 mask = (s32)(input[9]) >> 31;
|
||||
const s32 carry = -(((s32)(input[9]) & mask) >> 25);
|
||||
input[9] = (s32)(input[9]) + (carry << 25);
|
||||
input[0] = (s32)(input[0]) - (carry * 19);
|
||||
const s32 mask = input[9] >> 31;
|
||||
const s32 carry = -((input[9] & mask) >> 25);
|
||||
input[9] = input[9] + (carry << 25);
|
||||
input[0] = input[0] - (carry * 19);
|
||||
}
|
||||
|
||||
/* After the first iteration, input[1..9] are non-negative and fit within
|
||||
* 25 or 26 bits, depending on position. However, input[0] may be
|
||||
* negative. */
|
||||
}
|
||||
|
||||
/* The first borrow-propagation pass above ended with every limb
|
||||
except (possibly) input[0] non-negative.
|
||||
|
||||
Since each input limb except input[0] is decreased by at most 1
|
||||
by a borrow-propagation pass, the second borrow-propagation pass
|
||||
could only have wrapped around to decrease input[0] again if the
|
||||
first pass left input[0] negative *and* input[1] through input[9]
|
||||
were all zero. In that case, input[1] is now 2^25 - 1, and this
|
||||
last borrow-propagation step will leave input[1] non-negative.
|
||||
*/
|
||||
If input[0] was negative after the first pass, then it was because of a
|
||||
carry from input[9]. On entry, input[9] < 2^26 so the carry was, at most,
|
||||
one, since (2**26-1) >> 25 = 1. Thus input[0] >= -19.
|
||||
|
||||
In the second pass, each limb is decreased by at most one. Thus the second
|
||||
borrow-propagation pass could only have wrapped around to decrease
|
||||
input[0] again if the first pass left input[0] negative *and* input[1]
|
||||
through input[9] were all zero. In that case, input[1] is now 2^25 - 1,
|
||||
and this last borrow-propagation step will leave input[1] non-negative. */
|
||||
{
|
||||
const s32 mask = (s32)(input[0]) >> 31;
|
||||
const s32 carry = -(((s32)(input[0]) & mask) >> 26);
|
||||
input[0] = (s32)(input[0]) + (carry << 26);
|
||||
input[1] = (s32)(input[1]) - carry;
|
||||
const s32 mask = input[0] >> 31;
|
||||
const s32 carry = -((input[0] & mask) >> 26);
|
||||
input[0] = input[0] + (carry << 26);
|
||||
input[1] = input[1] - carry;
|
||||
}
|
||||
|
||||
/* Both passes through the above loop, plus the last 0-to-1 step, are
|
||||
necessary: if input[9] is -1 and input[0] through input[8] are 0,
|
||||
negative values will remain in the array until the end.
|
||||
*/
|
||||
/* All input[i] are now non-negative. However, there might be values between
|
||||
* 2^25 and 2^26 in a limb which is, nominally, 25 bits wide. */
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (i = 0; i < 9; i++) {
|
||||
if ((i & 1) == 1) {
|
||||
const s32 carry = input[i] >> 25;
|
||||
input[i] &= 0x1ffffff;
|
||||
input[i+1] += carry;
|
||||
} else {
|
||||
const s32 carry = input[i] >> 26;
|
||||
input[i] &= 0x3ffffff;
|
||||
input[i+1] += carry;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const s32 carry = input[9] >> 25;
|
||||
input[9] &= 0x1ffffff;
|
||||
input[0] += 19*carry;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the first carry-chain pass, just above, ended up with a carry from
|
||||
* input[9], and that caused input[0] to be out-of-bounds, then input[0] was
|
||||
* < 2^26 + 2*19, because the carry was, at most, two.
|
||||
*
|
||||
* If the second pass carried from input[9] again then input[0] is < 2*19 and
|
||||
* the input[9] -> input[0] carry didn't push input[0] out of bounds. */
|
||||
|
||||
/* It still remains the case that input might be between 2^255-19 and 2^255.
|
||||
* In this case, input[1..9] must take their maximum value and input[0] must
|
||||
* be >= (2^255-19) & 0x3ffffff, which is 0x3ffffed. */
|
||||
mask = s32_gte(input[0], 0x3ffffed);
|
||||
for (i = 1; i < 10; i++) {
|
||||
if ((i & 1) == 1) {
|
||||
mask &= s32_eq(input[i], 0x1ffffff);
|
||||
} else {
|
||||
mask &= s32_eq(input[i], 0x3ffffff);
|
||||
}
|
||||
}
|
||||
|
||||
/* mask is either 0xffffffff (if input >= 2^255-19) and zero otherwise. Thus
|
||||
* this conditionally subtracts 2^255-19. */
|
||||
input[0] -= mask & 0x3ffffed;
|
||||
|
||||
for (i = 1; i < 10; i++) {
|
||||
if ((i & 1) == 1) {
|
||||
input[i] -= mask & 0x1ffffff;
|
||||
} else {
|
||||
input[i] -= mask & 0x3ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
input[1] <<= 2;
|
||||
input[2] <<= 3;
|
||||
@@ -516,7 +619,9 @@ fcontract(u8 *output, limb *input) {
|
||||
* x z: short form, destroyed
|
||||
* xprime zprime: short form, destroyed
|
||||
* qmqp: short form, preserved
|
||||
*/
|
||||
*
|
||||
* On entry and exit, the absolute value of the limbs of all inputs and outputs
|
||||
* are < 2^26. */
|
||||
static void fmonty(limb *x2, limb *z2, /* output 2Q */
|
||||
limb *x3, limb *z3, /* output Q + Q' */
|
||||
limb *x, limb *z, /* input Q */
|
||||
@@ -527,43 +632,69 @@ static void fmonty(limb *x2, limb *z2, /* output 2Q */
|
||||
|
||||
memcpy(origx, x, 10 * sizeof(limb));
|
||||
fsum(x, z);
|
||||
/* |x[i]| < 2^27 */
|
||||
fdifference(z, origx); /* does x - z */
|
||||
/* |z[i]| < 2^27 */
|
||||
|
||||
memcpy(origxprime, xprime, sizeof(limb) * 10);
|
||||
fsum(xprime, zprime);
|
||||
/* |xprime[i]| < 2^27 */
|
||||
fdifference(zprime, origxprime);
|
||||
/* |zprime[i]| < 2^27 */
|
||||
fproduct(xxprime, xprime, z);
|
||||
/* |xxprime[i]| < 14*2^54: the largest product of two limbs will be <
|
||||
* 2^(27+27) and fproduct adds together, at most, 14 of those products.
|
||||
* (Approximating that to 2^58 doesn't work out.) */
|
||||
fproduct(zzprime, x, zprime);
|
||||
/* |zzprime[i]| < 14*2^54 */
|
||||
freduce_degree(xxprime);
|
||||
freduce_coefficients(xxprime);
|
||||
/* |xxprime[i]| < 2^26 */
|
||||
freduce_degree(zzprime);
|
||||
freduce_coefficients(zzprime);
|
||||
/* |zzprime[i]| < 2^26 */
|
||||
memcpy(origxprime, xxprime, sizeof(limb) * 10);
|
||||
fsum(xxprime, zzprime);
|
||||
/* |xxprime[i]| < 2^27 */
|
||||
fdifference(zzprime, origxprime);
|
||||
/* |zzprime[i]| < 2^27 */
|
||||
fsquare(xxxprime, xxprime);
|
||||
/* |xxxprime[i]| < 2^26 */
|
||||
fsquare(zzzprime, zzprime);
|
||||
/* |zzzprime[i]| < 2^26 */
|
||||
fproduct(zzprime, zzzprime, qmqp);
|
||||
/* |zzprime[i]| < 14*2^52 */
|
||||
freduce_degree(zzprime);
|
||||
freduce_coefficients(zzprime);
|
||||
/* |zzprime[i]| < 2^26 */
|
||||
memcpy(x3, xxxprime, sizeof(limb) * 10);
|
||||
memcpy(z3, zzprime, sizeof(limb) * 10);
|
||||
|
||||
fsquare(xx, x);
|
||||
/* |xx[i]| < 2^26 */
|
||||
fsquare(zz, z);
|
||||
/* |zz[i]| < 2^26 */
|
||||
fproduct(x2, xx, zz);
|
||||
/* |x2[i]| < 14*2^52 */
|
||||
freduce_degree(x2);
|
||||
freduce_coefficients(x2);
|
||||
/* |x2[i]| < 2^26 */
|
||||
fdifference(zz, xx); /* does zz = xx - zz */
|
||||
/* |zz[i]| < 2^27 */
|
||||
memset(zzz + 10, 0, sizeof(limb) * 9);
|
||||
fscalar_product(zzz, zz, 121665);
|
||||
/* |zzz[i]| < 2^(27+17) */
|
||||
/* No need to call freduce_degree here:
|
||||
fscalar_product doesn't increase the degree of its input. */
|
||||
freduce_coefficients(zzz);
|
||||
/* |zzz[i]| < 2^26 */
|
||||
fsum(zzz, xx);
|
||||
/* |zzz[i]| < 2^27 */
|
||||
fproduct(z2, zz, zzz);
|
||||
/* |z2[i]| < 14*2^(26+27) */
|
||||
freduce_degree(z2);
|
||||
freduce_coefficients(z2);
|
||||
/* |z2|i| < 2^26 */
|
||||
}
|
||||
|
||||
/* Conditionally swap two reduced-form limb arrays if 'iswap' is 1, but leave
|
||||
@@ -574,8 +705,7 @@ static void fmonty(limb *x2, limb *z2, /* output 2Q */
|
||||
* wrong results. Also, the two limb arrays must be in reduced-coefficient,
|
||||
* reduced-degree form: the values in a[10..19] or b[10..19] aren't swapped,
|
||||
* and all all values in a[0..9],b[0..9] must have magnitude less than
|
||||
* INT32_MAX.
|
||||
*/
|
||||
* INT32_MAX. */
|
||||
static void
|
||||
swap_conditional(limb a[19], limb b[19], limb iswap) {
|
||||
unsigned i;
|
||||
@@ -592,8 +722,7 @@ swap_conditional(limb a[19], limb b[19], limb iswap) {
|
||||
*
|
||||
* resultx/resultz: the x coordinate of the resulting curve point (short form)
|
||||
* n: a little endian, 32-byte number
|
||||
* q: a point of the curve (short form)
|
||||
*/
|
||||
* q: a point of the curve (short form) */
|
||||
static void
|
||||
cmult(limb *resultx, limb *resultz, const u8 *n, const limb *q) {
|
||||
limb a[19] = {0}, b[19] = {1}, c[19] = {1}, d[19] = {0};
|
||||
@@ -711,8 +840,6 @@ crecip(limb *out, const limb *z) {
|
||||
/* 2^255 - 21 */ fmul(out,t1,z11);
|
||||
}
|
||||
|
||||
int curve25519_donna(u8 *, const u8 *, const u8 *);
|
||||
|
||||
int
|
||||
curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint) {
|
||||
limb bp[10], x[10], z[11], zmone[10];
|
||||
@@ -728,7 +855,6 @@ curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint) {
|
||||
cmult(x, z, e, bp);
|
||||
crecip(zmone, z);
|
||||
fmul(z, x, zmone);
|
||||
freduce_coefficients(z);
|
||||
fcontract(mypublic, z);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ PROJECT_NAME = LibTomCrypt
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 1.16
|
||||
PROJECT_NUMBER = 1.17
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
# Modified by Clay Culver
|
||||
|
||||
# The version
|
||||
VERSION=1.16
|
||||
VERSION=1.17
|
||||
|
||||
VPATH=@srcdir@
|
||||
srcdir=@srcdir@
|
||||
PLATFORM := $(shell uname | sed -e 's/_.*//')
|
||||
|
||||
|
||||
srcdir=.
|
||||
|
||||
# Compiler and Linker Names
|
||||
#CC=gcc
|
||||
@@ -17,6 +19,19 @@ srcdir=@srcdir@
|
||||
#AR=ar
|
||||
#ARFLAGS=r
|
||||
|
||||
ifndef MAKE
|
||||
MAKE=make
|
||||
endif
|
||||
|
||||
# ranlib tools
|
||||
ifndef RANLIB
|
||||
ifeq ($(PLATFORM), Darwin)
|
||||
RANLIB=ranlib -c
|
||||
else
|
||||
RANLIB=ranlib
|
||||
endif
|
||||
endif
|
||||
|
||||
# Compilation flags. Note the += does not write over the user's CFLAGS!
|
||||
# The rest of the flags come from the parent Dropbear makefile
|
||||
CFLAGS += -c -Isrc/headers/ -I$(srcdir)/src/headers/ -I../ -I$(srcdir)/../ -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/
|
||||
@@ -99,27 +114,28 @@ endif
|
||||
#START_INS
|
||||
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
|
||||
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o \
|
||||
src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
|
||||
src/ciphers/safer/safer_tab.o src/ciphers/safer/saferp.o src/ciphers/skipjack.o \
|
||||
src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o \
|
||||
src/ciphers/safer/safer.o src/ciphers/safer/saferp.o src/ciphers/safer/safer_tab.o \
|
||||
src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o src/encauth/eax/eax_decrypt.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_init.o \
|
||||
src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o src/encauth/gcm/gcm_add_iv.o \
|
||||
src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o src/encauth/gcm/gcm_init.o \
|
||||
src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o src/encauth/gcm/gcm_process.o \
|
||||
src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o src/encauth/ocb/ocb_decrypt.o \
|
||||
src/encauth/ocb/ocb_decrypt_verify_memory.o src/encauth/ocb/ocb_done_decrypt.o \
|
||||
src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
|
||||
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
|
||||
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
|
||||
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
|
||||
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o \
|
||||
src/hashes/sha1.o src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o \
|
||||
src/hashes/whirl/whirl.o src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o \
|
||||
src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o \
|
||||
src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
|
||||
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
|
||||
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
|
||||
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
|
||||
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
|
||||
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o src/encauth/ocb/ocb_shift_xor.o \
|
||||
src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o src/hashes/chc/chc.o \
|
||||
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
|
||||
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
|
||||
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
|
||||
src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o \
|
||||
src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o \
|
||||
src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o \
|
||||
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
|
||||
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
|
||||
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
|
||||
@@ -131,39 +147,41 @@ src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
|
||||
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
|
||||
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
|
||||
src/math/rand_prime.o src/math/tfm_desc.o src/misc/base64/base64_decode.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
|
||||
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
|
||||
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
|
||||
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
|
||||
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
|
||||
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
|
||||
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
|
||||
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt_argchk.o \
|
||||
src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o src/misc/crypt/crypt_cipher_is_valid.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_ltc_mp_descriptor.o src/misc/crypt/crypt_prng_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_is_valid.o src/misc/crypt/crypt_register_cipher.o \
|
||||
src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o \
|
||||
src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o \
|
||||
src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o \
|
||||
src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o \
|
||||
src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o \
|
||||
src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o \
|
||||
src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o \
|
||||
src/modes/ecb/ecb_encrypt.o src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o \
|
||||
src/modes/f8/f8_encrypt.o src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o \
|
||||
src/modes/f8/f8_test_mode.o src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o \
|
||||
src/modes/lrw/lrw_encrypt.o src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o \
|
||||
src/modes/lrw/lrw_setiv.o src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o \
|
||||
src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o src/modes/ofb/ofb_encrypt.o \
|
||||
src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o src/modes/ofb/ofb_start.o \
|
||||
src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o src/modes/xts/xts_encrypt.o \
|
||||
src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o src/modes/xts/xts_test.o \
|
||||
src/pk/asn1/der/bit/der_decode_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_length_bit_string.o src/pk/asn1/der/boolean/der_decode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_encode_boolean.o src/pk/asn1/der/boolean/der_length_boolean.o \
|
||||
src/pk/asn1/der/choice/der_decode_choice.o src/pk/asn1/der/ia5/der_decode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_encode_ia5_string.o src/pk/asn1/der/ia5/der_length_ia5_string.o \
|
||||
src/pk/asn1/der/integer/der_decode_integer.o src/pk/asn1/der/integer/der_encode_integer.o \
|
||||
src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
|
||||
@@ -186,8 +204,8 @@ src/pk/asn1/der/utf8/der_decode_utf8_string.o src/pk/asn1/der/utf8/der_encode_ut
|
||||
src/pk/asn1/der/utf8/der_length_utf8_string.o src/pk/dsa/dsa_decrypt_key.o \
|
||||
src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_import.o \
|
||||
src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
|
||||
src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc_ansi_x963_export.o \
|
||||
src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o src/pk/ecc/ecc_get_size.o \
|
||||
src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_shared_secret.o \
|
||||
src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o src/pk/ecc/ecc_verify_hash.o \
|
||||
@@ -245,6 +263,8 @@ src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
|
||||
#This rule makes the libtomcrypt library.
|
||||
library: $(LIBNAME)
|
||||
|
||||
$(OBJECTS): $(HEADERS)
|
||||
|
||||
testprof/$(LIBTEST):
|
||||
cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) $(MAKE)
|
||||
|
||||
@@ -263,7 +283,7 @@ crypt: library $(CRYPTOBJECTS)
|
||||
#makes the small program
|
||||
small: library $(SMALLOBJECTS)
|
||||
$(CC) $(SMALLOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(SMALL) $(WARN)
|
||||
|
||||
|
||||
tv_gen: library $(TVS)
|
||||
$(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
|
||||
|
||||
@@ -316,7 +336,7 @@ doxy:
|
||||
doxygen
|
||||
cd doc/doxygen/latex ; ${MAKE} ; mv -f refman.pdf ../../.
|
||||
echo The huge doxygen PDF should be available as doc/refman.pdf
|
||||
|
||||
|
||||
#This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
|
||||
#from the clean command! This is because most people would like to keep the
|
||||
#nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
|
||||
@@ -358,6 +378,6 @@ zipup: no_oops docs
|
||||
mv -fv crypt* ~ ; rm -rf libtomcrypt-$(VERSION)
|
||||
|
||||
|
||||
# $Source: /cvs/libtom/libtomcrypt/makefile,v $
|
||||
# $Revision: 1.145 $
|
||||
# $Date: 2006/12/02 19:23:21 $
|
||||
# $Source$ */
|
||||
# $Revision$ */
|
||||
# $Date$ */
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
stopped at ch12
|
||||
-- needs examples for ecc/dsa!!! (and for asn.1)
|
||||
|
||||
must have for v1.16
|
||||
- document PK build flags
|
||||
- document makefile flags [INSTALL_* for instance]
|
||||
- prepare manual for printing (both soft and hard cover)
|
||||
|
||||
Nice to have [in order of precedence]
|
||||
- add X9.63 IES
|
||||
- add CPP macros like OpenSSL has for ASN1 (e.g. encode/decode functions, etc) shameless ripoff :-)
|
||||
for 1.18
|
||||
- document new ECC functions
|
||||
- add test for new functions
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
May 12th, 2007
|
||||
v1.17 -- Cryptography Research Inc. contributed another small volley of patches, one to fix __WCHAR_DEFINED__ for BSD platforms,
|
||||
another to silence MSVC warnings.
|
||||
-- Added LTC_XCBC_PURE to XCBC mode which lets you use it in three-key mode.
|
||||
-- [CRI] Added libtomcrypt.dsp for Visual C++ users.
|
||||
-- [CRI] Added more functions for manipulating the ECC fixed point cache (including saving and loading)
|
||||
-- [CRI] Modified ecc_make_key() to always produce keys smaller than base point order, for standards-compliance
|
||||
-- Elliptic Semiconductor contributed XTS chaining mode to the cipher suite (subsequently optimized it)
|
||||
-- Fixed xcbc_init() keylen when using single key mode.
|
||||
-- Bruce Fortune pointed out a typo in the hmac_process() description in the manual. Fixed.
|
||||
-- Added variable width counter support to CTR mode
|
||||
-- Fixed CMAC (aka OMAC) when using 64-bit block ciphers and LTC_FAST ... my bad.
|
||||
-- Fixed bug in ecc_is_valid() that would basically always return true
|
||||
-- renamed a lot of macros to add the LTC_ prefix [e.g. RIJNDAEL => LTC_RIJNDAEL]
|
||||
|
||||
December 16th, 2006
|
||||
v1.16 -- Brian Gladman pointed out that a recent change to GCM broke how the IV was handled. Currently the code complies against his test vectors
|
||||
so the code should be considered frozen now.
|
||||
@@ -1551,6 +1566,6 @@ v0.02 -- Changed RC5 to only allow 12 to 24 rounds
|
||||
v0.01 -- We will call this the first version.
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/changes,v $ */
|
||||
/* $Revision: 1.274 $ */
|
||||
/* $Date: 2006/12/16 19:08:17 $ */
|
||||
/* $Revision: 1.288 $ */
|
||||
/* $Date: 2007/05/12 14:37:41 $ */
|
||||
|
||||
|
||||
@@ -6,19 +6,19 @@
|
||||
\contentsline {figure}{\numberline {3.1}{\ignorespaces Built--In Software Ciphers}}{19}{figure.3.1}
|
||||
\contentsline {figure}{\numberline {3.2}{\ignorespaces Twofish Build Options}}{21}{figure.3.2}
|
||||
\addvspace {10\p@ }
|
||||
\contentsline {figure}{\numberline {4.1}{\ignorespaces Built--In Software Hashes}}{57}{figure.4.1}
|
||||
\contentsline {figure}{\numberline {4.1}{\ignorespaces Built--In Software Hashes}}{59}{figure.4.1}
|
||||
\addvspace {10\p@ }
|
||||
\addvspace {10\p@ }
|
||||
\contentsline {figure}{\numberline {6.1}{\ignorespaces List of Provided PRNGs}}{82}{figure.6.1}
|
||||
\contentsline {figure}{\numberline {6.1}{\ignorespaces List of Provided PRNGs}}{84}{figure.6.1}
|
||||
\addvspace {10\p@ }
|
||||
\addvspace {10\p@ }
|
||||
\addvspace {10\p@ }
|
||||
\contentsline {figure}{\numberline {9.1}{\ignorespaces DSA Key Sizes}}{119}{figure.9.1}
|
||||
\contentsline {figure}{\numberline {9.1}{\ignorespaces DSA Key Sizes}}{121}{figure.9.1}
|
||||
\addvspace {10\p@ }
|
||||
\contentsline {figure}{\numberline {10.1}{\ignorespaces List of ASN.1 Supported Types}}{127}{figure.10.1}
|
||||
\contentsline {figure}{\numberline {10.1}{\ignorespaces List of ASN.1 Supported Types}}{129}{figure.10.1}
|
||||
\addvspace {10\p@ }
|
||||
\addvspace {10\p@ }
|
||||
\contentsline {figure}{\numberline {12.1}{\ignorespaces RSA/DH Key Strength}}{149}{figure.12.1}
|
||||
\contentsline {figure}{\numberline {12.2}{\ignorespaces ECC Key Strength}}{149}{figure.12.2}
|
||||
\contentsline {figure}{\numberline {12.1}{\ignorespaces RSA/DH Key Strength}}{151}{figure.12.1}
|
||||
\contentsline {figure}{\numberline {12.2}{\ignorespaces ECC Key Strength}}{151}{figure.12.2}
|
||||
\addvspace {10\p@ }
|
||||
\addvspace {10\p@ }
|
||||
|
||||
@@ -190,7 +190,7 @@ The project is hereby released as public domain.
|
||||
\mysection{Patent Disclosure}
|
||||
|
||||
The author (Tom St Denis) is not a patent lawyer so this section is not to be treated as legal advice. To the best
|
||||
of the authors knowledge the only patent related issues within the library are the RC5 and RC6 symmetric block ciphers.
|
||||
of the author's knowledge the only patent related issues within the library are the RC5 and RC6 symmetric block ciphers.
|
||||
They can be removed from a build by simply commenting out the two appropriate lines in \textit{tomcrypt\_custom.h}. The rest
|
||||
of the ciphers and hashes are patent free or under patents that have since expired.
|
||||
|
||||
@@ -616,8 +616,8 @@ As of this release the current cipher\_descriptors elements are the following:
|
||||
\hline AES & aes\_desc & 16 & 16, 24, 32 & 10, 12, 14 \\
|
||||
& aes\_enc\_desc & 16 & 16, 24, 32 & 10, 12, 14 \\
|
||||
\hline Twofish & twofish\_desc & 16 & 16, 24, 32 & 16 \\
|
||||
\hline DES & des\_desc & 8 & 7 & 16 \\
|
||||
\hline 3DES (EDE mode) & des3\_desc & 8 & 21 & 16 \\
|
||||
\hline DES & des\_desc & 8 & 8 & 16 \\
|
||||
\hline 3DES (EDE mode) & des3\_desc & 8 & 24 & 16 \\
|
||||
\hline CAST5 (CAST-128) & cast5\_desc & 8 & 5 $\ldots$ 16 & 12, 16 \\
|
||||
\hline Noekeon & noekeon\_desc & 16 & 16 & 16 \\
|
||||
\hline Skipjack & skipjack\_desc & 8 & 10 & 32 \\
|
||||
@@ -879,14 +879,37 @@ of the cipher you choose. It is important that the IV be random for each uniqu
|
||||
parameters \textit{key}, \textit{keylen} and \textit{num\_rounds} are the same as in the XXX\_setup() function call. The final parameter
|
||||
is a pointer to the structure you want to hold the information for the mode of operation.
|
||||
|
||||
The routines return {\bf CRYPT\_OK} if the cipher initialized correctly, otherwise, they return an error code.
|
||||
|
||||
\subsubsection{CTR Mode}
|
||||
In the case of CTR mode there is an additional parameter \textit{ctr\_mode} which specifies the mode that the counter is to be used in.
|
||||
If \textbf{CTR\_COUNTER\_ LITTLE\_ENDIAN} was specified then the counter will be treated as a little endian value. Otherwise, if
|
||||
\textbf{CTR\_COUNTER\_BIG\_ENDIAN} was specified the counter will be treated as a big endian value. As of v1.15 the RFC 3686 style of
|
||||
increment then encrypt is also supported. By OR'ing \textbf{LTC\_CTR\_RFC3686} with the CTR \textit{mode} value, ctr\_start() will increment
|
||||
the counter before encrypting it for the first time.
|
||||
|
||||
The routines return {\bf CRYPT\_OK} if the cipher initialized correctly, otherwise, they return an error code.
|
||||
As of V1.17, the library supports variable length counters for CTR mode. The (optional) counter length is specified by OR'ing the octet
|
||||
length of the counter against the \textit{ctr\_mode} parameter. The default, zero, indicates that a full block length counter will be used. This also
|
||||
ensures backwards compatibility with software that uses older versions of the library.
|
||||
|
||||
\begin{small}
|
||||
\begin{verbatim}
|
||||
symmetric_CTR ctr;
|
||||
int err;
|
||||
unsigned char IV[16], key[16];
|
||||
|
||||
/* use a 32-bit little endian counter */
|
||||
if ((err = ctr_start(find_cipher("aes"),
|
||||
IV, key, 16, 0,
|
||||
CTR_COUNTER_LITTLE_ENDIAN | 4,
|
||||
&ctr)) != CRYPT_OK) {
|
||||
handle_error(err);
|
||||
}
|
||||
\end{verbatim}
|
||||
\end{small}
|
||||
|
||||
Changing the counter size has little (really no) effect on the performance of the CTR chaining mode. It is provided for compatibility
|
||||
with other software (and hardware) which have smaller fixed sized counters.
|
||||
|
||||
\subsection{Encryption and Decryption}
|
||||
To actually encrypt or decrypt the following routines are provided:
|
||||
@@ -1093,6 +1116,55 @@ To terminate the LRW state use the following:
|
||||
int lrw_done(symmetric_LRW *lrw);
|
||||
\end{verbatim}
|
||||
|
||||
\subsection{XTS Mode}
|
||||
As of v1.17, LibTomCrypt supports XTS mode with code donated by Elliptic Semiconductor Inc.\footnote{www.ellipticsemi.com}.
|
||||
XTS is a chaining mode for 128--bit block ciphers, recommended by IEEE (P1619)
|
||||
for disk encryption. It is meant to be an encryption mode with random access to the message data without compromising privacy. It requires two private keys (of equal
|
||||
length) to perform the encryption process. Each encryption invocation includes a sector number or unique identifier specified as a 128--bit string.
|
||||
|
||||
To initialize XTS mode use the following function call:
|
||||
|
||||
\index{xts\_start()}
|
||||
\begin{verbatim}
|
||||
int xts_start( int cipher,
|
||||
const unsigned char *key1,
|
||||
const unsigned char *key2,
|
||||
unsigned long keylen,
|
||||
int num_rounds,
|
||||
symmetric_xts *xts)
|
||||
\end{verbatim}
|
||||
This will start the XTS mode with the two keys pointed to by \textit{key1} and \textit{key2} of length \textit{keylen} octets each.
|
||||
|
||||
To encrypt or decrypt a sector use the following calls:
|
||||
|
||||
\index{xts\_encrypt()} \index{xts\_decrypt()}
|
||||
\begin{verbatim}
|
||||
int xts_encrypt(
|
||||
const unsigned char *pt, unsigned long ptlen,
|
||||
unsigned char *ct,
|
||||
const unsigned char *tweak,
|
||||
symmetric_xts *xts);
|
||||
|
||||
int xts_decrypt(
|
||||
const unsigned char *ct, unsigned long ptlen,
|
||||
unsigned char *pt,
|
||||
const unsigned char *tweak,
|
||||
symmetric_xts *xts);
|
||||
\end{verbatim}
|
||||
The first will encrypt the plaintext pointed to by \textit{pt} of length \textit{ptlen} octets, and store the ciphertext in the array pointed to by
|
||||
\textit{ct}. It uses the 128--bit tweak pointed to by \textit{tweak} to encrypt the block. The decrypt function performs the opposite operation. Both
|
||||
functions support ciphertext stealing (blocks that are not multiples of 16 bytes).
|
||||
|
||||
The P1619 specification states the tweak for sector number shall be represented as a 128--bit little endian string.
|
||||
|
||||
To terminate the XTS state call the following function:
|
||||
|
||||
\index{xts\_done()}
|
||||
\begin{verbatim}
|
||||
void xts_done(symmetric_xts *xts);
|
||||
\end{verbatim}
|
||||
|
||||
|
||||
\subsection{F8 Mode}
|
||||
\index{F8 Mode}
|
||||
The F8 Chaining mode (see RFC 3711 for instance) is yet another chaining mode for block ciphers. It behaves much like CTR mode in that it XORs a keystream
|
||||
@@ -2098,8 +2170,8 @@ int hmac_process( hmac_state *hmac,
|
||||
const unsigned char *in,
|
||||
unsigned long inlen);
|
||||
\end{verbatim}
|
||||
\textit{hmac} is the HMAC state you are working with. \textit{buf} is the array of octets to send into the HMAC process. \textit{len} is the
|
||||
number of octets to process. Like the hash process routines you can send the data in arbitrarily sized chunks. When you
|
||||
\textit{hmac} is the HMAC state you are working with. \textit{in} is the array of octets to send into the HMAC process. \textit{inlen} is the
|
||||
number of octets to process. Like the hash process routines, you can send the data in arbitrarily sized chunks. When you
|
||||
are finished with the HMAC process you must call the following function to get the HMAC code:
|
||||
\index{hmac\_done()}
|
||||
\begin{verbatim}
|
||||
@@ -2511,6 +2583,13 @@ int xcbc_init( xcbc_state *xcbc,
|
||||
This will initialize the XCBC--MAC state \textit{xcbc}, with the key specified in \textit{key} of length \textit{keylen} octets. The cipher indicated
|
||||
by the \textit{cipher} index can be either a 64 or 128--bit block cipher. This will return \textbf{CRYPT\_OK} on success.
|
||||
|
||||
\index{LTC\_XCBC\_PURE}
|
||||
It is possible to use XCBC in a three key mode by OR'ing the value \textbf{LTC\_XCBC\_PURE} against the \textit{keylen} parameter. In this mode, the key is
|
||||
interpretted as three keys. If the cipher has a block size of $n$ octets, the first key is then $keylen - 2n$ octets and is the encryption key. The next
|
||||
$2n$ octets are the $K_1$ and $K_2$ padding keys (used on the last block). For example, to use AES--192 \textit{keylen} should be $24 + 2 \cdot 16 = 56$ octets.
|
||||
The three keys are interpretted as if they were concatenated in the \textit{key} buffer.
|
||||
|
||||
|
||||
To process data through XCBC--MAC use the following function:
|
||||
|
||||
\index{xcbc\_process()}
|
||||
@@ -6485,5 +6564,5 @@ Since the function is given the entire RSA key (for private keys only) CRT is po
|
||||
\end{document}
|
||||
|
||||
% $Source: /cvs/libtom/libtomcrypt/crypt.tex,v $
|
||||
% $Revision: 1.123 $
|
||||
% $Date: 2006/12/16 19:08:17 $
|
||||
% $Revision: 1.128 $
|
||||
% $Date: 2007/03/10 23:59:54 $
|
||||
|
||||
@@ -26,58 +26,58 @@ void register_algs(void)
|
||||
{
|
||||
int x;
|
||||
|
||||
#ifdef RIJNDAEL
|
||||
#ifdef LTC_RIJNDAEL
|
||||
register_cipher (&aes_desc);
|
||||
#endif
|
||||
#ifdef BLOWFISH
|
||||
#ifdef LTC_BLOWFISH
|
||||
register_cipher (&blowfish_desc);
|
||||
#endif
|
||||
#ifdef XTEA
|
||||
#ifdef LTC_XTEA
|
||||
register_cipher (&xtea_desc);
|
||||
#endif
|
||||
#ifdef RC5
|
||||
#ifdef LTC_RC5
|
||||
register_cipher (&rc5_desc);
|
||||
#endif
|
||||
#ifdef RC6
|
||||
#ifdef LTC_RC6
|
||||
register_cipher (&rc6_desc);
|
||||
#endif
|
||||
#ifdef SAFERP
|
||||
#ifdef LTC_SAFERP
|
||||
register_cipher (&saferp_desc);
|
||||
#endif
|
||||
#ifdef TWOFISH
|
||||
#ifdef LTC_TWOFISH
|
||||
register_cipher (&twofish_desc);
|
||||
#endif
|
||||
#ifdef SAFER
|
||||
#ifdef LTC_SAFER
|
||||
register_cipher (&safer_k64_desc);
|
||||
register_cipher (&safer_sk64_desc);
|
||||
register_cipher (&safer_k128_desc);
|
||||
register_cipher (&safer_sk128_desc);
|
||||
#endif
|
||||
#ifdef RC2
|
||||
#ifdef LTC_RC2
|
||||
register_cipher (&rc2_desc);
|
||||
#endif
|
||||
#ifdef DES
|
||||
#ifdef LTC_DES
|
||||
register_cipher (&des_desc);
|
||||
register_cipher (&des3_desc);
|
||||
#endif
|
||||
#ifdef CAST5
|
||||
#ifdef LTC_CAST5
|
||||
register_cipher (&cast5_desc);
|
||||
#endif
|
||||
#ifdef NOEKEON
|
||||
#ifdef LTC_NOEKEON
|
||||
register_cipher (&noekeon_desc);
|
||||
#endif
|
||||
#ifdef SKIPJACK
|
||||
#ifdef LTC_SKIPJACK
|
||||
register_cipher (&skipjack_desc);
|
||||
#endif
|
||||
#ifdef KHAZAD
|
||||
#ifdef LTC_KHAZAD
|
||||
register_cipher (&khazad_desc);
|
||||
#endif
|
||||
#ifdef ANUBIS
|
||||
#ifdef LTC_ANUBIS
|
||||
register_cipher (&anubis_desc);
|
||||
#endif
|
||||
|
||||
if (register_hash(&sha256_desc) == -1) {
|
||||
printf("Error registering SHA256\n");
|
||||
printf("Error registering LTC_SHA256\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
hash_idx = find_hash("sha256");
|
||||
if (hash_idx == -1) {
|
||||
printf("SHA256 not found...?\n");
|
||||
printf("LTC_SHA256 not found...?\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@@ -236,6 +236,6 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/encrypt.c,v $ */
|
||||
/* $Revision: 1.3 $ */
|
||||
/* $Date: 2005/08/04 20:43:50 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -68,43 +68,43 @@ void register_algs(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
#ifdef TIGER
|
||||
#ifdef LTC_TIGER
|
||||
register_hash (&tiger_desc);
|
||||
#endif
|
||||
#ifdef MD2
|
||||
#ifdef LTC_MD2
|
||||
register_hash (&md2_desc);
|
||||
#endif
|
||||
#ifdef MD4
|
||||
#ifdef LTC_MD4
|
||||
register_hash (&md4_desc);
|
||||
#endif
|
||||
#ifdef MD5
|
||||
#ifdef LTC_MD5
|
||||
register_hash (&md5_desc);
|
||||
#endif
|
||||
#ifdef SHA1
|
||||
#ifdef LTC_SHA1
|
||||
register_hash (&sha1_desc);
|
||||
#endif
|
||||
#ifdef SHA224
|
||||
#ifdef LTC_SHA224
|
||||
register_hash (&sha224_desc);
|
||||
#endif
|
||||
#ifdef SHA256
|
||||
#ifdef LTC_SHA256
|
||||
register_hash (&sha256_desc);
|
||||
#endif
|
||||
#ifdef SHA384
|
||||
#ifdef LTC_SHA384
|
||||
register_hash (&sha384_desc);
|
||||
#endif
|
||||
#ifdef SHA512
|
||||
#ifdef LTC_SHA512
|
||||
register_hash (&sha512_desc);
|
||||
#endif
|
||||
#ifdef RIPEMD128
|
||||
#ifdef LTC_RIPEMD128
|
||||
register_hash (&rmd128_desc);
|
||||
#endif
|
||||
#ifdef RIPEMD160
|
||||
#ifdef LTC_RIPEMD160
|
||||
register_hash (&rmd160_desc);
|
||||
#endif
|
||||
#ifdef WHIRLPOOL
|
||||
#ifdef LTC_WHIRLPOOL
|
||||
register_hash (&whirlpool_desc);
|
||||
#endif
|
||||
#ifdef CHC_HASH
|
||||
#ifdef LTC_CHC_HASH
|
||||
register_hash(&chc_desc);
|
||||
if ((err = chc_register(register_cipher(&aes_enc_desc))) != CRYPT_OK) {
|
||||
printf("chc_register error: %s\n", error_to_string(err));
|
||||
@@ -114,6 +114,6 @@ void register_algs(void)
|
||||
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/hashsum.c,v $ */
|
||||
/* $Revision: 1.2 $ */
|
||||
/* $Date: 2005/05/05 14:35:56 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -33,7 +33,7 @@ int main(void)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* HMAC */
|
||||
/* LTC_HMAC */
|
||||
len = sizeof(buf[0]);
|
||||
hmac_memory(find_hash("sha256"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
|
||||
len2 = sizeof(buf[0]);
|
||||
@@ -55,7 +55,7 @@ int main(void)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
/* OMAC */
|
||||
/* LTC_OMAC */
|
||||
len = sizeof(buf[0]);
|
||||
omac_memory(find_cipher("aes"), key, 16, (unsigned char*)"hello", 5, buf[0], &len);
|
||||
len2 = sizeof(buf[0]);
|
||||
@@ -105,6 +105,6 @@ int main(void)
|
||||
}
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/multi.c,v $ */
|
||||
/* $Revision: 1.3 $ */
|
||||
/* $Date: 2006/06/07 22:25:09 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -9,6 +9,6 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/small.c,v $ */
|
||||
/* $Revision: 1.3 $ */
|
||||
/* $Date: 2006/06/07 22:25:09 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -31,6 +31,6 @@ int main(void)
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/test.c,v $ */
|
||||
/* $Revision: 1.28 $ */
|
||||
/* $Date: 2006/05/25 10:50:08 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -37,6 +37,6 @@ return EXIT_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/timing.c,v $ */
|
||||
/* $Revision: 1.61 $ */
|
||||
/* $Date: 2006/12/03 03:08:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -4,93 +4,93 @@ void reg_algs(void)
|
||||
{
|
||||
int err;
|
||||
|
||||
#ifdef RIJNDAEL
|
||||
#ifdef LTC_RIJNDAEL
|
||||
register_cipher (&aes_desc);
|
||||
#endif
|
||||
#ifdef BLOWFISH
|
||||
#ifdef LTC_BLOWFISH
|
||||
register_cipher (&blowfish_desc);
|
||||
#endif
|
||||
#ifdef XTEA
|
||||
#ifdef LTC_XTEA
|
||||
register_cipher (&xtea_desc);
|
||||
#endif
|
||||
#ifdef RC5
|
||||
#ifdef LTC_RC5
|
||||
register_cipher (&rc5_desc);
|
||||
#endif
|
||||
#ifdef RC6
|
||||
#ifdef LTC_RC6
|
||||
register_cipher (&rc6_desc);
|
||||
#endif
|
||||
#ifdef SAFERP
|
||||
#ifdef LTC_SAFERP
|
||||
register_cipher (&saferp_desc);
|
||||
#endif
|
||||
#ifdef TWOFISH
|
||||
#ifdef LTC_TWOFISH
|
||||
register_cipher (&twofish_desc);
|
||||
#endif
|
||||
#ifdef SAFER
|
||||
#ifdef LTC_SAFER
|
||||
register_cipher (&safer_k64_desc);
|
||||
register_cipher (&safer_sk64_desc);
|
||||
register_cipher (&safer_k128_desc);
|
||||
register_cipher (&safer_sk128_desc);
|
||||
#endif
|
||||
#ifdef RC2
|
||||
#ifdef LTC_RC2
|
||||
register_cipher (&rc2_desc);
|
||||
#endif
|
||||
#ifdef DES
|
||||
#ifdef LTC_DES
|
||||
register_cipher (&des_desc);
|
||||
register_cipher (&des3_desc);
|
||||
#endif
|
||||
#ifdef CAST5
|
||||
#ifdef LTC_CAST5
|
||||
register_cipher (&cast5_desc);
|
||||
#endif
|
||||
#ifdef NOEKEON
|
||||
#ifdef LTC_NOEKEON
|
||||
register_cipher (&noekeon_desc);
|
||||
#endif
|
||||
#ifdef SKIPJACK
|
||||
#ifdef LTC_SKIPJACK
|
||||
register_cipher (&skipjack_desc);
|
||||
#endif
|
||||
#ifdef ANUBIS
|
||||
#ifdef LTC_ANUBIS
|
||||
register_cipher (&anubis_desc);
|
||||
#endif
|
||||
#ifdef KHAZAD
|
||||
#ifdef LTC_KHAZAD
|
||||
register_cipher (&khazad_desc);
|
||||
#endif
|
||||
|
||||
#ifdef TIGER
|
||||
#ifdef LTC_TIGER
|
||||
register_hash (&tiger_desc);
|
||||
#endif
|
||||
#ifdef MD2
|
||||
#ifdef LTC_MD2
|
||||
register_hash (&md2_desc);
|
||||
#endif
|
||||
#ifdef MD4
|
||||
#ifdef LTC_MD4
|
||||
register_hash (&md4_desc);
|
||||
#endif
|
||||
#ifdef MD5
|
||||
#ifdef LTC_MD5
|
||||
register_hash (&md5_desc);
|
||||
#endif
|
||||
#ifdef SHA1
|
||||
#ifdef LTC_SHA1
|
||||
register_hash (&sha1_desc);
|
||||
#endif
|
||||
#ifdef SHA224
|
||||
#ifdef LTC_SHA224
|
||||
register_hash (&sha224_desc);
|
||||
#endif
|
||||
#ifdef SHA256
|
||||
#ifdef LTC_SHA256
|
||||
register_hash (&sha256_desc);
|
||||
#endif
|
||||
#ifdef SHA384
|
||||
#ifdef LTC_SHA384
|
||||
register_hash (&sha384_desc);
|
||||
#endif
|
||||
#ifdef SHA512
|
||||
#ifdef LTC_SHA512
|
||||
register_hash (&sha512_desc);
|
||||
#endif
|
||||
#ifdef RIPEMD128
|
||||
#ifdef LTC_RIPEMD128
|
||||
register_hash (&rmd128_desc);
|
||||
#endif
|
||||
#ifdef RIPEMD160
|
||||
#ifdef LTC_RIPEMD160
|
||||
register_hash (&rmd160_desc);
|
||||
#endif
|
||||
#ifdef WHIRLPOOL
|
||||
#ifdef LTC_WHIRLPOOL
|
||||
register_hash (&whirlpool_desc);
|
||||
#endif
|
||||
#ifdef CHC_HASH
|
||||
#ifdef LTC_CHC_HASH
|
||||
register_hash(&chc_desc);
|
||||
if ((err = chc_register(register_cipher(&aes_desc))) != CRYPT_OK) {
|
||||
printf("chc_register error: %s\n", error_to_string(err));
|
||||
@@ -238,12 +238,12 @@ void hmac_gen(void)
|
||||
out = fopen("hmac_tv.txt", "w");
|
||||
|
||||
fprintf(out,
|
||||
"HMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are HMACed. The initial key is\n"
|
||||
"of the same format (the same length as the HASH output size). The HMAC key in step N+1 is the HMAC output of\n"
|
||||
"LTC_HMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are LTC_HMACed. The initial key is\n"
|
||||
"of the same format (the same length as the HASH output size). The LTC_HMAC key in step N+1 is the LTC_HMAC output of\n"
|
||||
"step N.\n\n");
|
||||
|
||||
for (x = 0; hash_descriptor[x].name != NULL; x++) {
|
||||
fprintf(out, "HMAC-%s\n", hash_descriptor[x].name);
|
||||
fprintf(out, "LTC_HMAC-%s\n", hash_descriptor[x].name);
|
||||
|
||||
/* initial key */
|
||||
for (y = 0; y < (int)hash_descriptor[x].hashsize; y++) {
|
||||
@@ -290,8 +290,8 @@ void omac_gen(void)
|
||||
out = fopen("omac_tv.txt", "w");
|
||||
|
||||
fprintf(out,
|
||||
"OMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are OMAC'ed. The initial key is\n"
|
||||
"of the same format (length specified per cipher). The OMAC key in step N+1 is the OMAC output of\n"
|
||||
"LTC_OMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are LTC_OMAC'ed. The initial key is\n"
|
||||
"of the same format (length specified per cipher). The LTC_OMAC key in step N+1 is the LTC_OMAC output of\n"
|
||||
"step N (repeated as required to fill the array).\n\n");
|
||||
|
||||
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
|
||||
@@ -303,7 +303,7 @@ void omac_gen(void)
|
||||
if (cipher_descriptor[x].keysize(&kl) != CRYPT_OK) {
|
||||
kl = cipher_descriptor[x].max_key_length;
|
||||
}
|
||||
fprintf(out, "OMAC-%s (%d byte key)\n", cipher_descriptor[x].name, kl);
|
||||
fprintf(out, "LTC_OMAC-%s (%d byte key)\n", cipher_descriptor[x].name, kl);
|
||||
|
||||
/* initial key/block */
|
||||
for (y = 0; y < kl; y++) {
|
||||
@@ -345,8 +345,8 @@ void pmac_gen(void)
|
||||
out = fopen("pmac_tv.txt", "w");
|
||||
|
||||
fprintf(out,
|
||||
"PMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are OMAC'ed. The initial key is\n"
|
||||
"of the same format (length specified per cipher). The OMAC key in step N+1 is the OMAC output of\n"
|
||||
"PMAC Tests. In these tests messages of N bytes long (00,01,02,...,NN-1) are LTC_OMAC'ed. The initial key is\n"
|
||||
"of the same format (length specified per cipher). The LTC_OMAC key in step N+1 is the LTC_OMAC output of\n"
|
||||
"step N (repeated as required to fill the array).\n\n");
|
||||
|
||||
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
|
||||
@@ -767,20 +767,20 @@ int main(void)
|
||||
reg_algs();
|
||||
printf("Generating hash vectors..."); fflush(stdout); hash_gen(); printf("done\n");
|
||||
printf("Generating cipher vectors..."); fflush(stdout); cipher_gen(); printf("done\n");
|
||||
printf("Generating HMAC vectors..."); fflush(stdout); hmac_gen(); printf("done\n");
|
||||
printf("Generating OMAC vectors..."); fflush(stdout); omac_gen(); printf("done\n");
|
||||
printf("Generating LTC_HMAC vectors..."); fflush(stdout); hmac_gen(); printf("done\n");
|
||||
printf("Generating LTC_OMAC vectors..."); fflush(stdout); omac_gen(); printf("done\n");
|
||||
printf("Generating PMAC vectors..."); fflush(stdout); pmac_gen(); printf("done\n");
|
||||
printf("Generating EAX vectors..."); fflush(stdout); eax_gen(); printf("done\n");
|
||||
printf("Generating OCB vectors..."); fflush(stdout); ocb_gen(); printf("done\n");
|
||||
printf("Generating CCM vectors..."); fflush(stdout); ccm_gen(); printf("done\n");
|
||||
printf("Generating GCM vectors..."); fflush(stdout); gcm_gen(); printf("done\n");
|
||||
printf("Generating BASE64 vectors..."); fflush(stdout); base64_gen(); printf("done\n");
|
||||
printf("Generating LTC_BASE64 vectors..."); fflush(stdout); base64_gen(); printf("done\n");
|
||||
printf("Generating MATH vectors..."); fflush(stdout); math_gen(); printf("done\n");
|
||||
printf("Generating ECC vectors..."); fflush(stdout); ecc_gen(); printf("done\n");
|
||||
printf("Generating LRW vectors..."); fflush(stdout); lrw_gen(); printf("done\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/demos/tv_gen.c,v $ */
|
||||
/* $Revision: 1.15 $ */
|
||||
/* $Date: 2006/06/09 22:10:27 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -96,27 +96,28 @@ endif
|
||||
#START_INS
|
||||
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
|
||||
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o \
|
||||
src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
|
||||
src/ciphers/safer/safer_tab.o src/ciphers/safer/saferp.o src/ciphers/skipjack.o \
|
||||
src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o \
|
||||
src/ciphers/safer/safer.o src/ciphers/safer/saferp.o src/ciphers/safer/safer_tab.o \
|
||||
src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o src/encauth/eax/eax_decrypt.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_init.o \
|
||||
src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o src/encauth/gcm/gcm_add_iv.o \
|
||||
src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o src/encauth/gcm/gcm_init.o \
|
||||
src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o src/encauth/gcm/gcm_process.o \
|
||||
src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o src/encauth/ocb/ocb_decrypt.o \
|
||||
src/encauth/ocb/ocb_decrypt_verify_memory.o src/encauth/ocb/ocb_done_decrypt.o \
|
||||
src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
|
||||
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
|
||||
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
|
||||
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
|
||||
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o \
|
||||
src/hashes/sha1.o src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o \
|
||||
src/hashes/whirl/whirl.o src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o \
|
||||
src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o \
|
||||
src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
|
||||
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
|
||||
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
|
||||
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
|
||||
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
|
||||
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o src/encauth/ocb/ocb_shift_xor.o \
|
||||
src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o src/hashes/chc/chc.o \
|
||||
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
|
||||
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
|
||||
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
|
||||
src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o \
|
||||
src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o \
|
||||
src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o \
|
||||
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
|
||||
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
|
||||
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
|
||||
@@ -128,39 +129,41 @@ src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
|
||||
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
|
||||
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
|
||||
src/math/rand_prime.o src/math/tfm_desc.o src/misc/base64/base64_decode.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
|
||||
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
|
||||
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
|
||||
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
|
||||
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
|
||||
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
|
||||
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
|
||||
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt_argchk.o \
|
||||
src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o src/misc/crypt/crypt_cipher_is_valid.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_ltc_mp_descriptor.o src/misc/crypt/crypt_prng_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_is_valid.o src/misc/crypt/crypt_register_cipher.o \
|
||||
src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o \
|
||||
src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o \
|
||||
src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o \
|
||||
src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o \
|
||||
src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o \
|
||||
src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o \
|
||||
src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o \
|
||||
src/modes/ecb/ecb_encrypt.o src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o \
|
||||
src/modes/f8/f8_encrypt.o src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o \
|
||||
src/modes/f8/f8_test_mode.o src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o \
|
||||
src/modes/lrw/lrw_encrypt.o src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o \
|
||||
src/modes/lrw/lrw_setiv.o src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o \
|
||||
src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o src/modes/ofb/ofb_encrypt.o \
|
||||
src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o src/modes/ofb/ofb_start.o \
|
||||
src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o src/modes/xts/xts_encrypt.o \
|
||||
src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o src/modes/xts/xts_test.o \
|
||||
src/pk/asn1/der/bit/der_decode_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_length_bit_string.o src/pk/asn1/der/boolean/der_decode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_encode_boolean.o src/pk/asn1/der/boolean/der_length_boolean.o \
|
||||
src/pk/asn1/der/choice/der_decode_choice.o src/pk/asn1/der/ia5/der_decode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_encode_ia5_string.o src/pk/asn1/der/ia5/der_length_ia5_string.o \
|
||||
src/pk/asn1/der/integer/der_decode_integer.o src/pk/asn1/der/integer/der_encode_integer.o \
|
||||
src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
|
||||
@@ -183,8 +186,8 @@ src/pk/asn1/der/utf8/der_decode_utf8_string.o src/pk/asn1/der/utf8/der_encode_ut
|
||||
src/pk/asn1/der/utf8/der_length_utf8_string.o src/pk/dsa/dsa_decrypt_key.o \
|
||||
src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_import.o \
|
||||
src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
|
||||
src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc_ansi_x963_export.o \
|
||||
src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o src/pk/ecc/ecc_get_size.o \
|
||||
src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_shared_secret.o \
|
||||
src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o src/pk/ecc/ecc_verify_hash.o \
|
||||
@@ -287,6 +290,6 @@ install: library
|
||||
install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
|
||||
|
||||
# $Source: /cvs/libtom/libtomcrypt/makefile.icc,v $
|
||||
# $Revision: 1.73 $
|
||||
# $Date: 2006/12/02 19:23:21 $
|
||||
# $Revision: 1.76 $
|
||||
# $Date: 2007/02/16 16:36:25 $
|
||||
|
||||
|
||||
@@ -6,27 +6,28 @@ CFLAGS = /Isrc/headers/ /Itestprof/ /Ox /DWIN32 /DLTC_SOURCE /W3 /Fo$@ $(CF)
|
||||
#START_INS
|
||||
OBJECTS=src/ciphers/aes/aes_enc.obj src/ciphers/aes/aes.obj src/ciphers/anubis.obj src/ciphers/blowfish.obj \
|
||||
src/ciphers/cast5.obj src/ciphers/des.obj src/ciphers/kasumi.obj src/ciphers/khazad.obj src/ciphers/kseed.obj \
|
||||
src/ciphers/noekeon.obj src/ciphers/rc2.obj src/ciphers/rc5.obj src/ciphers/rc6.obj src/ciphers/safer/safer.obj \
|
||||
src/ciphers/safer/safer_tab.obj src/ciphers/safer/saferp.obj src/ciphers/skipjack.obj \
|
||||
src/ciphers/twofish/twofish.obj src/ciphers/xtea.obj src/encauth/ccm/ccm_memory.obj \
|
||||
src/ciphers/multi2.obj src/ciphers/noekeon.obj src/ciphers/rc2.obj src/ciphers/rc5.obj src/ciphers/rc6.obj \
|
||||
src/ciphers/safer/safer.obj src/ciphers/safer/saferp.obj src/ciphers/safer/safer_tab.obj \
|
||||
src/ciphers/skipjack.obj src/ciphers/twofish/twofish.obj src/ciphers/xtea.obj src/encauth/ccm/ccm_memory.obj \
|
||||
src/encauth/ccm/ccm_test.obj src/encauth/eax/eax_addheader.obj src/encauth/eax/eax_decrypt.obj \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.obj src/encauth/eax/eax_done.obj src/encauth/eax/eax_encrypt.obj \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.obj src/encauth/eax/eax_init.obj \
|
||||
src/encauth/eax/eax_test.obj src/encauth/gcm/gcm_add_aad.obj src/encauth/gcm/gcm_add_iv.obj \
|
||||
src/encauth/gcm/gcm_done.obj src/encauth/gcm/gcm_gf_mult.obj src/encauth/gcm/gcm_init.obj \
|
||||
src/encauth/gcm/gcm_memory.obj src/encauth/gcm/gcm_mult_h.obj src/encauth/gcm/gcm_process.obj \
|
||||
src/encauth/gcm/gcm_reset.obj src/encauth/gcm/gcm_test.obj src/encauth/ocb/ocb_decrypt.obj \
|
||||
src/encauth/ocb/ocb_decrypt_verify_memory.obj src/encauth/ocb/ocb_done_decrypt.obj \
|
||||
src/encauth/ocb/ocb_done_encrypt.obj src/encauth/ocb/ocb_encrypt.obj \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.obj src/encauth/ocb/ocb_init.obj src/encauth/ocb/ocb_ntz.obj \
|
||||
src/encauth/ocb/ocb_shift_xor.obj src/encauth/ocb/ocb_test.obj src/encauth/ocb/s_ocb_done.obj \
|
||||
src/hashes/chc/chc.obj src/hashes/helper/hash_file.obj src/hashes/helper/hash_filehandle.obj \
|
||||
src/hashes/helper/hash_memory.obj src/hashes/helper/hash_memory_multi.obj src/hashes/md2.obj src/hashes/md4.obj \
|
||||
src/hashes/md5.obj src/hashes/rmd128.obj src/hashes/rmd160.obj src/hashes/rmd256.obj src/hashes/rmd320.obj \
|
||||
src/hashes/sha1.obj src/hashes/sha2/sha256.obj src/hashes/sha2/sha512.obj src/hashes/tiger.obj \
|
||||
src/hashes/whirl/whirl.obj src/mac/f9/f9_done.obj src/mac/f9/f9_file.obj src/mac/f9/f9_init.obj \
|
||||
src/mac/f9/f9_memory.obj src/mac/f9/f9_memory_multi.obj src/mac/f9/f9_process.obj src/mac/f9/f9_test.obj \
|
||||
src/mac/hmac/hmac_done.obj src/mac/hmac/hmac_file.obj src/mac/hmac/hmac_init.obj src/mac/hmac/hmac_memory.obj \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.obj src/encauth/eax/eax_done.obj \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.obj src/encauth/eax/eax_encrypt.obj \
|
||||
src/encauth/eax/eax_init.obj src/encauth/eax/eax_test.obj src/encauth/gcm/gcm_add_aad.obj \
|
||||
src/encauth/gcm/gcm_add_iv.obj src/encauth/gcm/gcm_done.obj src/encauth/gcm/gcm_gf_mult.obj \
|
||||
src/encauth/gcm/gcm_init.obj src/encauth/gcm/gcm_memory.obj src/encauth/gcm/gcm_mult_h.obj \
|
||||
src/encauth/gcm/gcm_process.obj src/encauth/gcm/gcm_reset.obj src/encauth/gcm/gcm_test.obj \
|
||||
src/encauth/ocb/ocb_decrypt.obj src/encauth/ocb/ocb_decrypt_verify_memory.obj \
|
||||
src/encauth/ocb/ocb_done_decrypt.obj src/encauth/ocb/ocb_done_encrypt.obj \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.obj src/encauth/ocb/ocb_encrypt.obj \
|
||||
src/encauth/ocb/ocb_init.obj src/encauth/ocb/ocb_ntz.obj src/encauth/ocb/ocb_shift_xor.obj \
|
||||
src/encauth/ocb/ocb_test.obj src/encauth/ocb/s_ocb_done.obj src/hashes/chc/chc.obj \
|
||||
src/hashes/helper/hash_file.obj src/hashes/helper/hash_filehandle.obj src/hashes/helper/hash_memory.obj \
|
||||
src/hashes/helper/hash_memory_multi.obj src/hashes/md2.obj src/hashes/md4.obj src/hashes/md5.obj \
|
||||
src/hashes/rmd128.obj src/hashes/rmd160.obj src/hashes/rmd256.obj src/hashes/rmd320.obj src/hashes/sha1.obj \
|
||||
src/hashes/sha2/sha256.obj src/hashes/sha2/sha512.obj src/hashes/tiger.obj src/hashes/whirl/whirl.obj \
|
||||
src/mac/f9/f9_done.obj src/mac/f9/f9_file.obj src/mac/f9/f9_init.obj src/mac/f9/f9_memory.obj \
|
||||
src/mac/f9/f9_memory_multi.obj src/mac/f9/f9_process.obj src/mac/f9/f9_test.obj src/mac/hmac/hmac_done.obj \
|
||||
src/mac/hmac/hmac_file.obj src/mac/hmac/hmac_init.obj src/mac/hmac/hmac_memory.obj \
|
||||
src/mac/hmac/hmac_memory_multi.obj src/mac/hmac/hmac_process.obj src/mac/hmac/hmac_test.obj \
|
||||
src/mac/omac/omac_done.obj src/mac/omac/omac_file.obj src/mac/omac/omac_init.obj src/mac/omac/omac_memory.obj \
|
||||
src/mac/omac/omac_memory_multi.obj src/mac/omac/omac_process.obj src/mac/omac/omac_test.obj \
|
||||
@@ -38,39 +39,41 @@ src/mac/xcbc/xcbc_file.obj src/mac/xcbc/xcbc_init.obj src/mac/xcbc/xcbc_memory.o
|
||||
src/mac/xcbc/xcbc_memory_multi.obj src/mac/xcbc/xcbc_process.obj src/mac/xcbc/xcbc_test.obj \
|
||||
src/math/fp/ltc_ecc_fp_mulmod.obj src/math/gmp_desc.obj src/math/ltm_desc.obj src/math/multi.obj \
|
||||
src/math/rand_prime.obj src/math/tfm_desc.obj src/misc/base64/base64_decode.obj \
|
||||
src/misc/base64/base64_encode.obj src/misc/burn_stack.obj src/misc/crypt/crypt.obj \
|
||||
src/misc/crypt/crypt_argchk.obj src/misc/crypt/crypt_cipher_descriptor.obj \
|
||||
src/misc/crypt/crypt_cipher_is_valid.obj src/misc/crypt/crypt_find_cipher.obj \
|
||||
src/misc/crypt/crypt_find_cipher_any.obj src/misc/crypt/crypt_find_cipher_id.obj \
|
||||
src/misc/crypt/crypt_find_hash.obj src/misc/crypt/crypt_find_hash_any.obj \
|
||||
src/misc/crypt/crypt_find_hash_id.obj src/misc/crypt/crypt_find_hash_oid.obj \
|
||||
src/misc/crypt/crypt_find_prng.obj src/misc/crypt/crypt_fsa.obj src/misc/crypt/crypt_hash_descriptor.obj \
|
||||
src/misc/crypt/crypt_hash_is_valid.obj src/misc/crypt/crypt_ltc_mp_descriptor.obj \
|
||||
src/misc/crypt/crypt_prng_descriptor.obj src/misc/crypt/crypt_prng_is_valid.obj \
|
||||
src/misc/crypt/crypt_register_cipher.obj src/misc/crypt/crypt_register_hash.obj \
|
||||
src/misc/crypt/crypt_register_prng.obj src/misc/crypt/crypt_unregister_cipher.obj \
|
||||
src/misc/crypt/crypt_unregister_hash.obj src/misc/crypt/crypt_unregister_prng.obj \
|
||||
src/misc/error_to_string.obj src/misc/pkcs5/pkcs_5_1.obj src/misc/pkcs5/pkcs_5_2.obj src/misc/zeromem.obj \
|
||||
src/modes/cbc/cbc_decrypt.obj src/modes/cbc/cbc_done.obj src/modes/cbc/cbc_encrypt.obj \
|
||||
src/modes/cbc/cbc_getiv.obj src/modes/cbc/cbc_setiv.obj src/modes/cbc/cbc_start.obj \
|
||||
src/modes/cfb/cfb_decrypt.obj src/modes/cfb/cfb_done.obj src/modes/cfb/cfb_encrypt.obj \
|
||||
src/modes/cfb/cfb_getiv.obj src/modes/cfb/cfb_setiv.obj src/modes/cfb/cfb_start.obj \
|
||||
src/modes/ctr/ctr_decrypt.obj src/modes/ctr/ctr_done.obj src/modes/ctr/ctr_encrypt.obj \
|
||||
src/modes/ctr/ctr_getiv.obj src/modes/ctr/ctr_setiv.obj src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj \
|
||||
src/modes/ecb/ecb_decrypt.obj src/modes/ecb/ecb_done.obj src/modes/ecb/ecb_encrypt.obj \
|
||||
src/modes/ecb/ecb_start.obj src/modes/f8/f8_decrypt.obj src/modes/f8/f8_done.obj src/modes/f8/f8_encrypt.obj \
|
||||
src/modes/f8/f8_getiv.obj src/modes/f8/f8_setiv.obj src/modes/f8/f8_start.obj src/modes/f8/f8_test_mode.obj \
|
||||
src/modes/lrw/lrw_decrypt.obj src/modes/lrw/lrw_done.obj src/modes/lrw/lrw_encrypt.obj \
|
||||
src/modes/lrw/lrw_getiv.obj src/modes/lrw/lrw_process.obj src/modes/lrw/lrw_setiv.obj \
|
||||
src/modes/lrw/lrw_start.obj src/modes/lrw/lrw_test.obj src/modes/ofb/ofb_decrypt.obj src/modes/ofb/ofb_done.obj \
|
||||
src/modes/ofb/ofb_encrypt.obj src/modes/ofb/ofb_getiv.obj src/modes/ofb/ofb_setiv.obj \
|
||||
src/modes/ofb/ofb_start.obj src/pk/asn1/der/bit/der_decode_bit_string.obj \
|
||||
src/pk/asn1/der/bit/der_encode_bit_string.obj src/pk/asn1/der/bit/der_length_bit_string.obj \
|
||||
src/pk/asn1/der/boolean/der_decode_boolean.obj src/pk/asn1/der/boolean/der_encode_boolean.obj \
|
||||
src/pk/asn1/der/boolean/der_length_boolean.obj src/pk/asn1/der/choice/der_decode_choice.obj \
|
||||
src/pk/asn1/der/ia5/der_decode_ia5_string.obj src/pk/asn1/der/ia5/der_encode_ia5_string.obj \
|
||||
src/pk/asn1/der/ia5/der_length_ia5_string.obj src/pk/asn1/der/integer/der_decode_integer.obj \
|
||||
src/pk/asn1/der/integer/der_encode_integer.obj src/pk/asn1/der/integer/der_length_integer.obj \
|
||||
src/misc/base64/base64_encode.obj src/misc/burn_stack.obj src/misc/crypt/crypt_argchk.obj \
|
||||
src/misc/crypt/crypt.obj src/misc/crypt/crypt_cipher_descriptor.obj src/misc/crypt/crypt_cipher_is_valid.obj \
|
||||
src/misc/crypt/crypt_find_cipher_any.obj src/misc/crypt/crypt_find_cipher.obj \
|
||||
src/misc/crypt/crypt_find_cipher_id.obj src/misc/crypt/crypt_find_hash_any.obj \
|
||||
src/misc/crypt/crypt_find_hash.obj src/misc/crypt/crypt_find_hash_id.obj \
|
||||
src/misc/crypt/crypt_find_hash_oid.obj src/misc/crypt/crypt_find_prng.obj src/misc/crypt/crypt_fsa.obj \
|
||||
src/misc/crypt/crypt_hash_descriptor.obj src/misc/crypt/crypt_hash_is_valid.obj \
|
||||
src/misc/crypt/crypt_ltc_mp_descriptor.obj src/misc/crypt/crypt_prng_descriptor.obj \
|
||||
src/misc/crypt/crypt_prng_is_valid.obj src/misc/crypt/crypt_register_cipher.obj \
|
||||
src/misc/crypt/crypt_register_hash.obj src/misc/crypt/crypt_register_prng.obj \
|
||||
src/misc/crypt/crypt_unregister_cipher.obj src/misc/crypt/crypt_unregister_hash.obj \
|
||||
src/misc/crypt/crypt_unregister_prng.obj src/misc/error_to_string.obj src/misc/pkcs5/pkcs_5_1.obj \
|
||||
src/misc/pkcs5/pkcs_5_2.obj src/misc/zeromem.obj src/modes/cbc/cbc_decrypt.obj src/modes/cbc/cbc_done.obj \
|
||||
src/modes/cbc/cbc_encrypt.obj src/modes/cbc/cbc_getiv.obj src/modes/cbc/cbc_setiv.obj \
|
||||
src/modes/cbc/cbc_start.obj src/modes/cfb/cfb_decrypt.obj src/modes/cfb/cfb_done.obj \
|
||||
src/modes/cfb/cfb_encrypt.obj src/modes/cfb/cfb_getiv.obj src/modes/cfb/cfb_setiv.obj \
|
||||
src/modes/cfb/cfb_start.obj src/modes/ctr/ctr_decrypt.obj src/modes/ctr/ctr_done.obj \
|
||||
src/modes/ctr/ctr_encrypt.obj src/modes/ctr/ctr_getiv.obj src/modes/ctr/ctr_setiv.obj \
|
||||
src/modes/ctr/ctr_start.obj src/modes/ctr/ctr_test.obj src/modes/ecb/ecb_decrypt.obj src/modes/ecb/ecb_done.obj \
|
||||
src/modes/ecb/ecb_encrypt.obj src/modes/ecb/ecb_start.obj src/modes/f8/f8_decrypt.obj src/modes/f8/f8_done.obj \
|
||||
src/modes/f8/f8_encrypt.obj src/modes/f8/f8_getiv.obj src/modes/f8/f8_setiv.obj src/modes/f8/f8_start.obj \
|
||||
src/modes/f8/f8_test_mode.obj src/modes/lrw/lrw_decrypt.obj src/modes/lrw/lrw_done.obj \
|
||||
src/modes/lrw/lrw_encrypt.obj src/modes/lrw/lrw_getiv.obj src/modes/lrw/lrw_process.obj \
|
||||
src/modes/lrw/lrw_setiv.obj src/modes/lrw/lrw_start.obj src/modes/lrw/lrw_test.obj \
|
||||
src/modes/ofb/ofb_decrypt.obj src/modes/ofb/ofb_done.obj src/modes/ofb/ofb_encrypt.obj \
|
||||
src/modes/ofb/ofb_getiv.obj src/modes/ofb/ofb_setiv.obj src/modes/ofb/ofb_start.obj \
|
||||
src/modes/xts/xts_decrypt.obj src/modes/xts/xts_done.obj src/modes/xts/xts_encrypt.obj \
|
||||
src/modes/xts/xts_init.obj src/modes/xts/xts_mult_x.obj src/modes/xts/xts_test.obj \
|
||||
src/pk/asn1/der/bit/der_decode_bit_string.obj src/pk/asn1/der/bit/der_encode_bit_string.obj \
|
||||
src/pk/asn1/der/bit/der_length_bit_string.obj src/pk/asn1/der/boolean/der_decode_boolean.obj \
|
||||
src/pk/asn1/der/boolean/der_encode_boolean.obj src/pk/asn1/der/boolean/der_length_boolean.obj \
|
||||
src/pk/asn1/der/choice/der_decode_choice.obj src/pk/asn1/der/ia5/der_decode_ia5_string.obj \
|
||||
src/pk/asn1/der/ia5/der_encode_ia5_string.obj src/pk/asn1/der/ia5/der_length_ia5_string.obj \
|
||||
src/pk/asn1/der/integer/der_decode_integer.obj src/pk/asn1/der/integer/der_encode_integer.obj \
|
||||
src/pk/asn1/der/integer/der_length_integer.obj \
|
||||
src/pk/asn1/der/object_identifier/der_decode_object_identifier.obj \
|
||||
src/pk/asn1/der/object_identifier/der_encode_object_identifier.obj \
|
||||
src/pk/asn1/der/object_identifier/der_length_object_identifier.obj \
|
||||
@@ -93,8 +96,8 @@ src/pk/asn1/der/utf8/der_decode_utf8_string.obj src/pk/asn1/der/utf8/der_encode_
|
||||
src/pk/asn1/der/utf8/der_length_utf8_string.obj src/pk/dsa/dsa_decrypt_key.obj \
|
||||
src/pk/dsa/dsa_encrypt_key.obj src/pk/dsa/dsa_export.obj src/pk/dsa/dsa_free.obj src/pk/dsa/dsa_import.obj \
|
||||
src/pk/dsa/dsa_make_key.obj src/pk/dsa/dsa_shared_secret.obj src/pk/dsa/dsa_sign_hash.obj \
|
||||
src/pk/dsa/dsa_verify_hash.obj src/pk/dsa/dsa_verify_key.obj src/pk/ecc/ecc.obj \
|
||||
src/pk/ecc/ecc_ansi_x963_export.obj src/pk/ecc/ecc_ansi_x963_import.obj src/pk/ecc/ecc_decrypt_key.obj \
|
||||
src/pk/dsa/dsa_verify_hash.obj src/pk/dsa/dsa_verify_key.obj src/pk/ecc/ecc_ansi_x963_export.obj \
|
||||
src/pk/ecc/ecc_ansi_x963_import.obj src/pk/ecc/ecc.obj src/pk/ecc/ecc_decrypt_key.obj \
|
||||
src/pk/ecc/ecc_encrypt_key.obj src/pk/ecc/ecc_export.obj src/pk/ecc/ecc_free.obj src/pk/ecc/ecc_get_size.obj \
|
||||
src/pk/ecc/ecc_import.obj src/pk/ecc/ecc_make_key.obj src/pk/ecc/ecc_shared_secret.obj \
|
||||
src/pk/ecc/ecc_sign_hash.obj src/pk/ecc/ecc_sizes.obj src/pk/ecc/ecc_test.obj src/pk/ecc/ecc_verify_hash.obj \
|
||||
@@ -145,5 +148,5 @@ timing: demos/timing.c library
|
||||
cl $(CFLAGS) demos/timing.c testprof/tomcrypt_prof.lib tomcrypt.lib advapi32.lib $(EXTRALIBS)
|
||||
|
||||
# $Source: /cvs/libtom/libtomcrypt/makefile.msvc,v $
|
||||
# $Revision: 1.51 $
|
||||
# $Date: 2006/12/02 19:23:21 $
|
||||
# $Revision: 1.54 $
|
||||
# $Date: 2007/02/16 16:36:25 $
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Tom St Denis
|
||||
|
||||
# The version
|
||||
VERSION=0:116
|
||||
VERSION=0:117
|
||||
|
||||
# Compiler and Linker Names
|
||||
CC=libtool --mode=compile --tag=CC gcc
|
||||
@@ -101,27 +101,28 @@ endif
|
||||
#START_INS
|
||||
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
|
||||
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o \
|
||||
src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
|
||||
src/ciphers/safer/safer_tab.o src/ciphers/safer/saferp.o src/ciphers/skipjack.o \
|
||||
src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o \
|
||||
src/ciphers/safer/safer.o src/ciphers/safer/saferp.o src/ciphers/safer/safer_tab.o \
|
||||
src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o src/encauth/eax/eax_decrypt.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_init.o \
|
||||
src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o src/encauth/gcm/gcm_add_iv.o \
|
||||
src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o src/encauth/gcm/gcm_init.o \
|
||||
src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o src/encauth/gcm/gcm_process.o \
|
||||
src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o src/encauth/ocb/ocb_decrypt.o \
|
||||
src/encauth/ocb/ocb_decrypt_verify_memory.o src/encauth/ocb/ocb_done_decrypt.o \
|
||||
src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
|
||||
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
|
||||
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
|
||||
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
|
||||
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o \
|
||||
src/hashes/sha1.o src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o \
|
||||
src/hashes/whirl/whirl.o src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o \
|
||||
src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o \
|
||||
src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
|
||||
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
|
||||
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
|
||||
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
|
||||
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
|
||||
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o src/encauth/ocb/ocb_shift_xor.o \
|
||||
src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o src/hashes/chc/chc.o \
|
||||
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
|
||||
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
|
||||
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
|
||||
src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o \
|
||||
src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o \
|
||||
src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o \
|
||||
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
|
||||
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
|
||||
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
|
||||
@@ -133,39 +134,41 @@ src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
|
||||
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
|
||||
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
|
||||
src/math/rand_prime.o src/math/tfm_desc.o src/misc/base64/base64_decode.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
|
||||
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
|
||||
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
|
||||
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
|
||||
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
|
||||
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
|
||||
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
|
||||
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt_argchk.o \
|
||||
src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o src/misc/crypt/crypt_cipher_is_valid.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_ltc_mp_descriptor.o src/misc/crypt/crypt_prng_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_is_valid.o src/misc/crypt/crypt_register_cipher.o \
|
||||
src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o \
|
||||
src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o \
|
||||
src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o \
|
||||
src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o \
|
||||
src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o \
|
||||
src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o \
|
||||
src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o \
|
||||
src/modes/ecb/ecb_encrypt.o src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o \
|
||||
src/modes/f8/f8_encrypt.o src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o \
|
||||
src/modes/f8/f8_test_mode.o src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o \
|
||||
src/modes/lrw/lrw_encrypt.o src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o \
|
||||
src/modes/lrw/lrw_setiv.o src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o \
|
||||
src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o src/modes/ofb/ofb_encrypt.o \
|
||||
src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o src/modes/ofb/ofb_start.o \
|
||||
src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o src/modes/xts/xts_encrypt.o \
|
||||
src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o src/modes/xts/xts_test.o \
|
||||
src/pk/asn1/der/bit/der_decode_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_length_bit_string.o src/pk/asn1/der/boolean/der_decode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_encode_boolean.o src/pk/asn1/der/boolean/der_length_boolean.o \
|
||||
src/pk/asn1/der/choice/der_decode_choice.o src/pk/asn1/der/ia5/der_decode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_encode_ia5_string.o src/pk/asn1/der/ia5/der_length_ia5_string.o \
|
||||
src/pk/asn1/der/integer/der_decode_integer.o src/pk/asn1/der/integer/der_encode_integer.o \
|
||||
src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
|
||||
@@ -188,8 +191,8 @@ src/pk/asn1/der/utf8/der_decode_utf8_string.o src/pk/asn1/der/utf8/der_encode_ut
|
||||
src/pk/asn1/der/utf8/der_length_utf8_string.o src/pk/dsa/dsa_decrypt_key.o \
|
||||
src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_import.o \
|
||||
src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
|
||||
src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc_ansi_x963_export.o \
|
||||
src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o src/pk/ecc/ecc_get_size.o \
|
||||
src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_shared_secret.o \
|
||||
src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o src/pk/ecc/ecc_verify_hash.o \
|
||||
@@ -275,5 +278,5 @@ timing: library testprof/$(LIBTEST) $(TIMINGS)
|
||||
gcc -o $(TIMING) $(TIMINGS) -ltomcrypt_prof -ltomcrypt $(EXTRALIBS)
|
||||
|
||||
# $Source: /cvs/libtom/libtomcrypt/makefile.shared,v $
|
||||
# $Revision: 1.76 $
|
||||
# $Date: 2006/12/02 19:23:21 $
|
||||
# $Revision: 1.80 $
|
||||
# $Date: 2007/02/16 16:36:25 $
|
||||
|
||||
@@ -42,27 +42,28 @@ GROUP=wheel
|
||||
#START_INS
|
||||
OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
|
||||
src/ciphers/cast5.o src/ciphers/des.o src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o \
|
||||
src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
|
||||
src/ciphers/safer/safer_tab.o src/ciphers/safer/saferp.o src/ciphers/skipjack.o \
|
||||
src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/ciphers/multi2.o src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o \
|
||||
src/ciphers/safer/safer.o src/ciphers/safer/saferp.o src/ciphers/safer/safer_tab.o \
|
||||
src/ciphers/skipjack.o src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
|
||||
src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o src/encauth/eax/eax_decrypt.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_init.o \
|
||||
src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o src/encauth/gcm/gcm_add_iv.o \
|
||||
src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o src/encauth/gcm/gcm_init.o \
|
||||
src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o src/encauth/gcm/gcm_process.o \
|
||||
src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o src/encauth/ocb/ocb_decrypt.o \
|
||||
src/encauth/ocb/ocb_decrypt_verify_memory.o src/encauth/ocb/ocb_done_decrypt.o \
|
||||
src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
|
||||
src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
|
||||
src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
|
||||
src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
|
||||
src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o \
|
||||
src/hashes/sha1.o src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o \
|
||||
src/hashes/whirl/whirl.o src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o \
|
||||
src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o \
|
||||
src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o \
|
||||
src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_encrypt.o \
|
||||
src/encauth/eax/eax_init.o src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o \
|
||||
src/encauth/gcm/gcm_add_iv.o src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o \
|
||||
src/encauth/gcm/gcm_init.o src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o \
|
||||
src/encauth/gcm/gcm_process.o src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o \
|
||||
src/encauth/ocb/ocb_decrypt.o src/encauth/ocb/ocb_decrypt_verify_memory.o \
|
||||
src/encauth/ocb/ocb_done_decrypt.o src/encauth/ocb/ocb_done_encrypt.o \
|
||||
src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_encrypt.o \
|
||||
src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o src/encauth/ocb/ocb_shift_xor.o \
|
||||
src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o src/hashes/chc/chc.o \
|
||||
src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o src/hashes/helper/hash_memory.o \
|
||||
src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o src/hashes/md5.o \
|
||||
src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o src/hashes/sha1.o \
|
||||
src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o src/hashes/whirl/whirl.o \
|
||||
src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o src/mac/f9/f9_memory.o \
|
||||
src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o src/mac/hmac/hmac_done.o \
|
||||
src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
|
||||
src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
|
||||
src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
|
||||
src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
|
||||
@@ -74,39 +75,41 @@ src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
|
||||
src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
|
||||
src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
|
||||
src/math/rand_prime.o src/math/tfm_desc.o src/misc/base64/base64_decode.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt.o \
|
||||
src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
|
||||
src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
|
||||
src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
|
||||
src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
|
||||
src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
|
||||
src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
|
||||
src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
|
||||
src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
|
||||
src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
|
||||
src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
|
||||
src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
|
||||
src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
|
||||
src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
|
||||
src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
|
||||
src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
|
||||
src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
|
||||
src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
|
||||
src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
|
||||
src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
|
||||
src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
|
||||
src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
|
||||
src/modes/ofb/ofb_start.o src/pk/asn1/der/bit/der_decode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_encode_bit_string.o src/pk/asn1/der/bit/der_length_bit_string.o \
|
||||
src/pk/asn1/der/boolean/der_decode_boolean.o src/pk/asn1/der/boolean/der_encode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_length_boolean.o src/pk/asn1/der/choice/der_decode_choice.o \
|
||||
src/pk/asn1/der/ia5/der_decode_ia5_string.o src/pk/asn1/der/ia5/der_encode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_length_ia5_string.o src/pk/asn1/der/integer/der_decode_integer.o \
|
||||
src/pk/asn1/der/integer/der_encode_integer.o src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt_argchk.o \
|
||||
src/misc/crypt/crypt.o src/misc/crypt/crypt_cipher_descriptor.o src/misc/crypt/crypt_cipher_is_valid.o \
|
||||
src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher.o \
|
||||
src/misc/crypt/crypt_find_cipher_id.o src/misc/crypt/crypt_find_hash_any.o \
|
||||
src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_id.o \
|
||||
src/misc/crypt/crypt_find_hash_oid.o src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o \
|
||||
src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
|
||||
src/misc/crypt/crypt_ltc_mp_descriptor.o src/misc/crypt/crypt_prng_descriptor.o \
|
||||
src/misc/crypt/crypt_prng_is_valid.o src/misc/crypt/crypt_register_cipher.o \
|
||||
src/misc/crypt/crypt_register_hash.o src/misc/crypt/crypt_register_prng.o \
|
||||
src/misc/crypt/crypt_unregister_cipher.o src/misc/crypt/crypt_unregister_hash.o \
|
||||
src/misc/crypt/crypt_unregister_prng.o src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o \
|
||||
src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o \
|
||||
src/modes/cbc/cbc_encrypt.o src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o \
|
||||
src/modes/cbc/cbc_start.o src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o \
|
||||
src/modes/cfb/cfb_encrypt.o src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o \
|
||||
src/modes/cfb/cfb_start.o src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o \
|
||||
src/modes/ctr/ctr_encrypt.o src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o \
|
||||
src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o \
|
||||
src/modes/ecb/ecb_encrypt.o src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o \
|
||||
src/modes/f8/f8_encrypt.o src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o \
|
||||
src/modes/f8/f8_test_mode.o src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o \
|
||||
src/modes/lrw/lrw_encrypt.o src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o \
|
||||
src/modes/lrw/lrw_setiv.o src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o \
|
||||
src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o src/modes/ofb/ofb_encrypt.o \
|
||||
src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o src/modes/ofb/ofb_start.o \
|
||||
src/modes/xts/xts_decrypt.o src/modes/xts/xts_done.o src/modes/xts/xts_encrypt.o \
|
||||
src/modes/xts/xts_init.o src/modes/xts/xts_mult_x.o src/modes/xts/xts_test.o \
|
||||
src/pk/asn1/der/bit/der_decode_bit_string.o src/pk/asn1/der/bit/der_encode_bit_string.o \
|
||||
src/pk/asn1/der/bit/der_length_bit_string.o src/pk/asn1/der/boolean/der_decode_boolean.o \
|
||||
src/pk/asn1/der/boolean/der_encode_boolean.o src/pk/asn1/der/boolean/der_length_boolean.o \
|
||||
src/pk/asn1/der/choice/der_decode_choice.o src/pk/asn1/der/ia5/der_decode_ia5_string.o \
|
||||
src/pk/asn1/der/ia5/der_encode_ia5_string.o src/pk/asn1/der/ia5/der_length_ia5_string.o \
|
||||
src/pk/asn1/der/integer/der_decode_integer.o src/pk/asn1/der/integer/der_encode_integer.o \
|
||||
src/pk/asn1/der/integer/der_length_integer.o \
|
||||
src/pk/asn1/der/object_identifier/der_decode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_encode_object_identifier.o \
|
||||
src/pk/asn1/der/object_identifier/der_length_object_identifier.o \
|
||||
@@ -129,8 +132,8 @@ src/pk/asn1/der/utf8/der_decode_utf8_string.o src/pk/asn1/der/utf8/der_encode_ut
|
||||
src/pk/asn1/der/utf8/der_length_utf8_string.o src/pk/dsa/dsa_decrypt_key.o \
|
||||
src/pk/dsa/dsa_encrypt_key.o src/pk/dsa/dsa_export.o src/pk/dsa/dsa_free.o src/pk/dsa/dsa_import.o \
|
||||
src/pk/dsa/dsa_make_key.o src/pk/dsa/dsa_shared_secret.o src/pk/dsa/dsa_sign_hash.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc.o \
|
||||
src/pk/ecc/ecc_ansi_x963_export.o src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/dsa/dsa_verify_hash.o src/pk/dsa/dsa_verify_key.o src/pk/ecc/ecc_ansi_x963_export.o \
|
||||
src/pk/ecc/ecc_ansi_x963_import.o src/pk/ecc/ecc.o src/pk/ecc/ecc_decrypt_key.o \
|
||||
src/pk/ecc/ecc_encrypt_key.o src/pk/ecc/ecc_export.o src/pk/ecc/ecc_free.o src/pk/ecc/ecc_get_size.o \
|
||||
src/pk/ecc/ecc_import.o src/pk/ecc/ecc_make_key.o src/pk/ecc/ecc_shared_secret.o \
|
||||
src/pk/ecc/ecc_sign_hash.o src/pk/ecc/ecc_sizes.o src/pk/ecc/ecc_test.o src/pk/ecc/ecc_verify_hash.o \
|
||||
@@ -235,5 +238,5 @@ install_test: testprof/$(LIBTEST)
|
||||
install -g $(GROUP) -o $(USER) testprof/$(LIBTEST) $(DESTDIR)$(LIBPATH)
|
||||
|
||||
# $Source: /cvs/libtom/libtomcrypt/makefile.unix,v $
|
||||
# $Revision: 1.4 $
|
||||
# $Date: 2006/12/02 19:23:21 $
|
||||
# $Revision: 1.7 $
|
||||
# $Date: 2007/02/16 16:36:25 $
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* emits an optimized version of SAFER+ ... only does encrypt so far... */
|
||||
/* emits an optimized version of LTC_SAFER+ ... only does encrypt so far... */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -172,6 +172,6 @@ printf(" }\n}\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/notes/etc/saferp_optimizer.c,v $ */
|
||||
/* $Revision: 1.2 $ */
|
||||
/* $Date: 2005/05/05 14:35:58 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -90,6 +90,6 @@ int main(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/notes/etc/whirlgen.c,v $ */
|
||||
/* $Revision: 1.2 $ */
|
||||
/* $Date: 2005/05/05 14:35:58 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -14,6 +14,6 @@ int main(void)
|
||||
}
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/notes/etc/whirltest.c,v $ */
|
||||
/* $Revision: 1.2 $ */
|
||||
/* $Date: 2005/05/05 14:35:58 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -12,7 +12,7 @@ You can disable whole classes of algorithms on the command line with the LTC_NO_
|
||||
The following build with GCC 3.4.4 on an AMD64 box gets you AES, CTR mode, SHA-256, HMAC, Yarrow, full RSA PKCS #1, PKCS #5 and ASN.1 DER in
|
||||
roughly 40KB of code (49KB on the ARMv4) (both excluding the math library).
|
||||
|
||||
CFLAGS="-DLTC_NO_CIPHERS -DLTC_NO_HASHES -DLTC_NO_PRNGS -DLTC_NO_MACS -DLTC_NO_MODES -DLTC_NO_PK -DRIJNDAEL -DLTC_CTR_MODE -DSHA256 \
|
||||
CFLAGS="-DLTC_NO_CIPHERS -DLTC_NO_HASHES -DLTC_NO_PRNGS -DLTC_NO_MACS -DLTC_NO_MODES -DLTC_NO_PK -DLTC_RIJNDAEL -DLTC_CTR_MODE -DSHA256 \
|
||||
-DLTC_HMAC -DYARROW -DMRSA -DMPI -DTFM_DESC -DARGTYPE=3 -Os -DLTC_SMALL_CODE -fomit-frame-pointer" make IGNORE_SPEED=1
|
||||
|
||||
Obviously this won't get you performance but if you need to pack a crypto lib in a device with limited means it's more than enough...
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/* AES implementation by Tom St Denis
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef RIJNDAEL
|
||||
#ifdef LTC_RIJNDAEL
|
||||
|
||||
#ifndef ENCRYPT_ONLY
|
||||
|
||||
@@ -765,6 +765,6 @@ int ECB_KS(int *keysize)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/aes/aes.c,v $ */
|
||||
/* $Revision: 1.14 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/* The precomputed tables for AES */
|
||||
/*
|
||||
@@ -1023,6 +1023,6 @@ static const ulong32 rcon[] = {
|
||||
0x1B000000UL, 0x36000000UL, /* for 128-bit blocks, Rijndael never uses more than 10 rcon values */
|
||||
};
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/aes/aes_tab.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/04/02 13:19:09 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef ANUBIS
|
||||
#ifdef LTC_ANUBIS
|
||||
|
||||
const struct ltc_cipher_descriptor anubis_desc = {
|
||||
"anubis",
|
||||
@@ -48,7 +48,7 @@ const struct ltc_cipher_descriptor anubis_desc = {
|
||||
* (but little-endian notation would be equally suitable if consistently
|
||||
* employed).
|
||||
*/
|
||||
#if defined(ANUBIS_TWEAK)
|
||||
#if defined(LTC_ANUBIS_TWEAK)
|
||||
|
||||
static const ulong32 T0[256] = {
|
||||
0xba69d2bbU, 0x54a84de5U, 0x2f5ebce2U, 0x74e8cd25U,
|
||||
@@ -1174,8 +1174,8 @@ int anubis_test(void)
|
||||
int keylen;
|
||||
unsigned char pt[16], ct[16], key[40];
|
||||
} tests[] = {
|
||||
#ifndef ANUBIS_TWEAK
|
||||
/**** ORIGINAL ANUBIS ****/
|
||||
#ifndef LTC_ANUBIS_TWEAK
|
||||
/**** ORIGINAL LTC_ANUBIS ****/
|
||||
/* 128 bit keys */
|
||||
{
|
||||
16,
|
||||
@@ -1333,7 +1333,7 @@ int anubis_test(void)
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }
|
||||
}
|
||||
#else
|
||||
/**** Tweaked ANUBIS ****/
|
||||
/**** Tweaked LTC_ANUBIS ****/
|
||||
/* 128 bit keys */
|
||||
{
|
||||
16,
|
||||
@@ -1553,6 +1553,6 @@ int anubis_keysize(int *keysize)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/anubis.c,v $ */
|
||||
/* $Revision: 1.15 $ */
|
||||
/* $Date: 2006/11/15 12:41:28 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/**
|
||||
@file blowfish.c
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef BLOWFISH
|
||||
#ifdef LTC_BLOWFISH
|
||||
|
||||
const struct ltc_cipher_descriptor blowfish_desc =
|
||||
{
|
||||
@@ -589,6 +589,6 @@ int blowfish_keysize(int *keysize)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/blowfish.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file cast5.c
|
||||
Implementation of CAST5 (RFC 2144) by Tom St Denis
|
||||
Implementation of LTC_CAST5 (RFC 2144) by Tom St Denis
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef CAST5
|
||||
#ifdef LTC_CAST5
|
||||
|
||||
const struct ltc_cipher_descriptor cast5_desc = {
|
||||
"cast5",
|
||||
@@ -398,7 +398,7 @@ static const ulong32 S8[256] = {
|
||||
#endif
|
||||
|
||||
/**
|
||||
Initialize the CAST5 block cipher
|
||||
Initialize the LTC_CAST5 block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -530,7 +530,7 @@ INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
|
||||
}
|
||||
|
||||
/**
|
||||
Encrypts a block of text with CAST5
|
||||
Encrypts a block of text with LTC_CAST5
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -583,7 +583,7 @@ int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key
|
||||
#endif
|
||||
|
||||
/**
|
||||
Decrypts a block of text with CAST5
|
||||
Decrypts a block of text with LTC_CAST5
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -636,7 +636,7 @@ int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key
|
||||
#endif
|
||||
|
||||
/**
|
||||
Performs a self-test of the CAST5 block cipher
|
||||
Performs a self-test of the LTC_CAST5 block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int cast5_test(void)
|
||||
@@ -715,6 +715,6 @@ int cast5_keysize(int *keysize)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/cast5.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file des.c
|
||||
DES code submitted by Dobes Vandermeer
|
||||
LTC_DES code submitted by Dobes Vandermeer
|
||||
*/
|
||||
|
||||
#ifdef DES
|
||||
#ifdef LTC_DES
|
||||
|
||||
#define EN0 0
|
||||
#define DE1 1
|
||||
@@ -1522,7 +1522,7 @@ static void desfunc(ulong32 *block, const ulong32 *keys)
|
||||
|
||||
#if 0
|
||||
/**
|
||||
Initialize the DES block cipher
|
||||
Initialize the LTC_DES block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -1550,7 +1550,7 @@ int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
|
||||
#endif
|
||||
|
||||
/**
|
||||
Initialize the 3DES-EDE block cipher
|
||||
Initialize the 3LTC_DES-EDE block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -1583,7 +1583,7 @@ int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k
|
||||
|
||||
#if 0
|
||||
/**
|
||||
Encrypts a block of text with DES
|
||||
Encrypts a block of text with LTC_DES
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -1604,7 +1604,7 @@ int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s
|
||||
}
|
||||
|
||||
/**
|
||||
Decrypts a block of text with DES
|
||||
Decrypts a block of text with LTC_DES
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -1626,7 +1626,7 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s
|
||||
#endif
|
||||
|
||||
/**
|
||||
Encrypts a block of text with 3DES-EDE
|
||||
Encrypts a block of text with 3LTC_DES-EDE
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -1650,7 +1650,7 @@ int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *
|
||||
}
|
||||
|
||||
/**
|
||||
Decrypts a block of text with 3DES-EDE
|
||||
Decrypts a block of text with 3LTC_DES-EDE
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -1674,7 +1674,7 @@ int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *
|
||||
|
||||
#if 0
|
||||
/**
|
||||
Performs a self-test of the DES block cipher
|
||||
Performs a self-test of the LTC_DES block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int des_test(void)
|
||||
@@ -1910,6 +1910,6 @@ int des3_keysize(int *keysize)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/des.c,v $ */
|
||||
/* $Revision: 1.13 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -313,6 +313,6 @@ int kasumi_test(void)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/kasumi.c,v $ */
|
||||
/* $Revision: 1.7 $ */
|
||||
/* $Date: 2006/11/09 03:05:44 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
Authors: Paulo S.L.M. Barreto and Vincent Rijmen.
|
||||
*/
|
||||
|
||||
#ifdef KHAZAD
|
||||
#ifdef LTC_KHAZAD
|
||||
|
||||
const struct ltc_cipher_descriptor khazad_desc = {
|
||||
"khazad",
|
||||
@@ -850,6 +850,6 @@ int khazad_keysize(int *keysize)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/khazad.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef KSEED
|
||||
#ifdef LTC_KSEED
|
||||
|
||||
const struct ltc_cipher_descriptor kseed_desc = {
|
||||
"seed",
|
||||
@@ -371,6 +371,6 @@ int kseed_keysize(int *keysize)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/kseed.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
303
libtomcrypt/src/ciphers/multi2.c
Normal file
303
libtomcrypt/src/ciphers/multi2.c
Normal file
@@ -0,0 +1,303 @@
|
||||
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
||||
*
|
||||
* LibTomCrypt is a library that provides various cryptographic
|
||||
* algorithms in a highly modular and flexible manner.
|
||||
*
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file multi2.c
|
||||
Multi-2 implementation (not public domain, hence the default disable)
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef LTC_MULTI2
|
||||
|
||||
static void pi1(ulong32 *p)
|
||||
{
|
||||
p[1] ^= p[0];
|
||||
}
|
||||
|
||||
static void pi2(ulong32 *p, ulong32 *k)
|
||||
{
|
||||
ulong32 t;
|
||||
t = (p[1] + k[0]) & 0xFFFFFFFFUL;
|
||||
t = (ROL(t, 1) + t - 1) & 0xFFFFFFFFUL;
|
||||
t = (ROL(t, 4) ^ t) & 0xFFFFFFFFUL;
|
||||
p[0] ^= t;
|
||||
}
|
||||
|
||||
static void pi3(ulong32 *p, ulong32 *k)
|
||||
{
|
||||
ulong32 t;
|
||||
t = p[0] + k[1];
|
||||
t = (ROL(t, 2) + t + 1) & 0xFFFFFFFFUL;
|
||||
t = (ROL(t, 8) ^ t) & 0xFFFFFFFFUL;
|
||||
t = (t + k[2]) & 0xFFFFFFFFUL;
|
||||
t = (ROL(t, 1) - t) & 0xFFFFFFFFUL;
|
||||
t = ROL(t, 16) ^ (p[0] | t);
|
||||
p[1] ^= t;
|
||||
}
|
||||
|
||||
static void pi4(ulong32 *p, ulong32 *k)
|
||||
{
|
||||
ulong32 t;
|
||||
t = (p[1] + k[3]) & 0xFFFFFFFFUL;
|
||||
t = (ROL(t, 2) + t + 1) & 0xFFFFFFFFUL;
|
||||
p[0] ^= t;
|
||||
}
|
||||
|
||||
static void setup(ulong32 *dk, ulong32 *k, ulong32 *uk)
|
||||
{
|
||||
int n, t;
|
||||
ulong32 p[2];
|
||||
|
||||
p[0] = dk[0]; p[1] = dk[1];
|
||||
|
||||
t = 4;
|
||||
n = 0;
|
||||
pi1(p);
|
||||
pi2(p, k);
|
||||
uk[n++] = p[0];
|
||||
pi3(p, k);
|
||||
uk[n++] = p[1];
|
||||
pi4(p, k);
|
||||
uk[n++] = p[0];
|
||||
pi1(p);
|
||||
uk[n++] = p[1];
|
||||
pi2(p, k+t);
|
||||
uk[n++] = p[0];
|
||||
pi3(p, k+t);
|
||||
uk[n++] = p[1];
|
||||
pi4(p, k+t);
|
||||
uk[n++] = p[0];
|
||||
pi1(p);
|
||||
uk[n++] = p[1];
|
||||
}
|
||||
|
||||
static void encrypt(ulong32 *p, int N, ulong32 *uk)
|
||||
{
|
||||
int n, t;
|
||||
for (t = n = 0; ; ) {
|
||||
pi1(p); if (++n == N) break;
|
||||
pi2(p, uk+t); if (++n == N) break;
|
||||
pi3(p, uk+t); if (++n == N) break;
|
||||
pi4(p, uk+t); if (++n == N) break;
|
||||
t ^= 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void decrypt(ulong32 *p, int N, ulong32 *uk)
|
||||
{
|
||||
int n, t;
|
||||
for (t = 4*((N&1)^1), n = N; ; ) {
|
||||
switch (n >= 4 ? 4 : 0) {
|
||||
case 4: pi4(p, uk+t); --n;
|
||||
case 3: pi3(p, uk+t); --n;
|
||||
case 2: pi2(p, uk+t); --n;
|
||||
case 1: pi1(p); --n; break;
|
||||
case 0: return;
|
||||
}
|
||||
t ^= 4;
|
||||
}
|
||||
}
|
||||
|
||||
const struct ltc_cipher_descriptor multi2_desc = {
|
||||
"multi2",
|
||||
22,
|
||||
40, 40, 8, 128,
|
||||
&multi2_setup,
|
||||
&multi2_ecb_encrypt,
|
||||
&multi2_ecb_decrypt,
|
||||
&multi2_test,
|
||||
&multi2_done,
|
||||
&multi2_keysize,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
int multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
|
||||
{
|
||||
ulong32 sk[8], dk[2];
|
||||
int x;
|
||||
|
||||
LTC_ARGCHK(key != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
if (keylen != 40) return CRYPT_INVALID_KEYSIZE;
|
||||
if (num_rounds == 0) num_rounds = 128;
|
||||
|
||||
skey->multi2.N = num_rounds;
|
||||
for (x = 0; x < 8; x++) {
|
||||
LOAD32H(sk[x], key + x*4);
|
||||
}
|
||||
LOAD32H(dk[0], key + 32);
|
||||
LOAD32H(dk[1], key + 36);
|
||||
setup(dk, sk, skey->multi2.uk);
|
||||
|
||||
zeromem(sk, sizeof(sk));
|
||||
zeromem(dk, sizeof(dk));
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
Encrypts a block of text with multi2
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
|
||||
{
|
||||
ulong32 p[2];
|
||||
LTC_ARGCHK(pt != NULL);
|
||||
LTC_ARGCHK(ct != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
LOAD32H(p[0], pt);
|
||||
LOAD32H(p[1], pt+4);
|
||||
encrypt(p, skey->multi2.N, skey->multi2.uk);
|
||||
STORE32H(p[0], ct);
|
||||
STORE32H(p[1], ct+4);
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
Decrypts a block of text with multi2
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
|
||||
{
|
||||
ulong32 p[2];
|
||||
LTC_ARGCHK(pt != NULL);
|
||||
LTC_ARGCHK(ct != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
LOAD32H(p[0], ct);
|
||||
LOAD32H(p[1], ct+4);
|
||||
decrypt(p, skey->multi2.N, skey->multi2.uk);
|
||||
STORE32H(p[0], pt);
|
||||
STORE32H(p[1], pt+4);
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs a self-test of the multi2 block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int multi2_test(void)
|
||||
{
|
||||
static const struct {
|
||||
unsigned char key[40];
|
||||
unsigned char pt[8], ct[8];
|
||||
int rounds;
|
||||
} tests[] = {
|
||||
{
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
|
||||
0x01, 0x23, 0x45, 0x67,
|
||||
0x89, 0xAB, 0xCD, 0xEF
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01,
|
||||
},
|
||||
{
|
||||
0xf8, 0x94, 0x40, 0x84,
|
||||
0x5e, 0x11, 0xcf, 0x89
|
||||
},
|
||||
128,
|
||||
},
|
||||
{
|
||||
{
|
||||
0x35, 0x91, 0x9d, 0x96,
|
||||
0x07, 0x02, 0xe2, 0xce,
|
||||
0x8d, 0x0b, 0x58, 0x3c,
|
||||
0xc9, 0xc8, 0x9d, 0x59,
|
||||
0xa2, 0xae, 0x96, 0x4e,
|
||||
0x87, 0x82, 0x45, 0xed,
|
||||
0x3f, 0x2e, 0x62, 0xd6,
|
||||
0x36, 0x35, 0xd0, 0x67,
|
||||
|
||||
0xb1, 0x27, 0xb9, 0x06,
|
||||
0xe7, 0x56, 0x22, 0x38,
|
||||
},
|
||||
{
|
||||
0x1f, 0xb4, 0x60, 0x60,
|
||||
0xd0, 0xb3, 0x4f, 0xa5
|
||||
},
|
||||
{
|
||||
0xca, 0x84, 0xa9, 0x34,
|
||||
0x75, 0xc8, 0x60, 0xe5
|
||||
},
|
||||
216,
|
||||
}
|
||||
};
|
||||
unsigned char buf[8];
|
||||
symmetric_key skey;
|
||||
int err, x;
|
||||
|
||||
for (x = 1; x < (int)(sizeof(tests)/sizeof(tests[0])); x++) {
|
||||
if ((err = multi2_setup(tests[x].key, 40, tests[x].rounds, &skey)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
if ((err = multi2_ecb_encrypt(tests[x].pt, buf, &skey)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (XMEMCMP(buf, tests[x].ct, 8)) {
|
||||
return CRYPT_FAIL_TESTVECTOR;
|
||||
}
|
||||
|
||||
if ((err = multi2_ecb_decrypt(buf, buf, &skey)) != CRYPT_OK) {
|
||||
return err;
|
||||
}
|
||||
if (XMEMCMP(buf, tests[x].pt, 8)) {
|
||||
return CRYPT_FAIL_TESTVECTOR;
|
||||
}
|
||||
}
|
||||
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/** Terminate the context
|
||||
@param skey The scheduled key
|
||||
*/
|
||||
void multi2_done(symmetric_key *skey)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Gets suitable key size
|
||||
@param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable.
|
||||
@return CRYPT_OK if the input key size is acceptable.
|
||||
*/
|
||||
int multi2_keysize(int *keysize)
|
||||
{
|
||||
LTC_ARGCHK(keysize != NULL);
|
||||
if (*keysize >= 40) {
|
||||
*keysize = 40;
|
||||
} else {
|
||||
return CRYPT_INVALID_KEYSIZE;
|
||||
}
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/**
|
||||
@file noekeon.c
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef NOEKEON
|
||||
#ifdef LTC_NOEKEON
|
||||
|
||||
const struct ltc_cipher_descriptor noekeon_desc =
|
||||
{
|
||||
@@ -298,6 +298,6 @@ int noekeon_keysize(int *keysize)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/noekeon.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/**********************************************************************\
|
||||
* To commemorate the 1996 RSA Data Security Conference, the following *
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
/**
|
||||
@file rc2.c
|
||||
Implementation of RC2
|
||||
Implementation of LTC_RC2
|
||||
*/
|
||||
|
||||
#ifdef RC2
|
||||
#ifdef LTC_RC2
|
||||
|
||||
const struct ltc_cipher_descriptor rc2_desc = {
|
||||
"rc2",
|
||||
@@ -60,7 +60,7 @@ static const unsigned char permute[256] = {
|
||||
};
|
||||
|
||||
/**
|
||||
Initialize the RC2 block cipher
|
||||
Initialize the LTC_RC2 block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -121,7 +121,7 @@ int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
|
||||
* Encrypt an 8-byte block of plaintext using the given key. *
|
||||
\**********************************************************************/
|
||||
/**
|
||||
Encrypts a block of text with RC2
|
||||
Encrypts a block of text with LTC_RC2
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -199,7 +199,7 @@ int rc2_ecb_encrypt( const unsigned char *pt,
|
||||
* Decrypt an 8-byte block of ciphertext using the given key. *
|
||||
\**********************************************************************/
|
||||
/**
|
||||
Decrypts a block of text with RC2
|
||||
Decrypts a block of text with LTC_RC2
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -275,7 +275,7 @@ int rc2_ecb_decrypt( const unsigned char *ct,
|
||||
#endif
|
||||
|
||||
/**
|
||||
Performs a self-test of the RC2 block cipher
|
||||
Performs a self-test of the LTC_RC2 block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int rc2_test(void)
|
||||
@@ -357,6 +357,6 @@ int rc2_keysize(int *keysize)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc2.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file rc5.c
|
||||
RC5 code by Tom St Denis
|
||||
LTC_RC5 code by Tom St Denis
|
||||
*/
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef RC5
|
||||
#ifdef LTC_RC5
|
||||
|
||||
const struct ltc_cipher_descriptor rc5_desc =
|
||||
{
|
||||
@@ -43,7 +43,7 @@ static const ulong32 stab[50] = {
|
||||
};
|
||||
|
||||
/**
|
||||
Initialize the RC5 block cipher
|
||||
Initialize the LTC_RC5 block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -119,7 +119,7 @@ int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
|
||||
#endif
|
||||
|
||||
/**
|
||||
Encrypts a block of text with RC5
|
||||
Encrypts a block of text with LTC_RC5
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -174,7 +174,7 @@ int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s
|
||||
#endif
|
||||
|
||||
/**
|
||||
Decrypts a block of text with RC5
|
||||
Decrypts a block of text with LTC_RC5
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -230,7 +230,7 @@ int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s
|
||||
#endif
|
||||
|
||||
/**
|
||||
Performs a self-test of the RC5 block cipher
|
||||
Performs a self-test of the LTC_RC5 block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int rc5_test(void)
|
||||
@@ -317,6 +317,6 @@ int rc5_keysize(int *keysize)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc5.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file rc6.c
|
||||
RC6 code by Tom St Denis
|
||||
LTC_RC6 code by Tom St Denis
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef RC6
|
||||
#ifdef LTC_RC6
|
||||
|
||||
const struct ltc_cipher_descriptor rc6_desc =
|
||||
{
|
||||
@@ -40,7 +40,7 @@ static const ulong32 stab[44] = {
|
||||
0x708c564bUL, 0x0ec3d004UL, 0xacfb49bdUL, 0x4b32c376UL };
|
||||
|
||||
/**
|
||||
Initialize the RC6 block cipher
|
||||
Initialize the LTC_RC6 block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -114,7 +114,7 @@ int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
|
||||
#endif
|
||||
|
||||
/**
|
||||
Encrypts a block of text with RC6
|
||||
Encrypts a block of text with LTC_RC6
|
||||
@param pt The input plaintext (16 bytes)
|
||||
@param ct The output ciphertext (16 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -168,7 +168,7 @@ int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s
|
||||
#endif
|
||||
|
||||
/**
|
||||
Decrypts a block of text with RC6
|
||||
Decrypts a block of text with LTC_RC6
|
||||
@param ct The input ciphertext (16 bytes)
|
||||
@param pt The output plaintext (16 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -224,7 +224,7 @@ int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s
|
||||
#endif
|
||||
|
||||
/**
|
||||
Performs a self-test of the RC6 block cipher
|
||||
Performs a self-test of the LTC_RC6 block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int rc6_test(void)
|
||||
@@ -339,10 +339,10 @@ int rc6_keysize(int *keysize)
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
#endif /*RC6*/
|
||||
#endif /*LTC_RC6*/
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/rc6.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FILE: safer.c
|
||||
*
|
||||
* DESCRIPTION: block-cipher algorithm SAFER (Secure And Fast Encryption
|
||||
* Routine) in its four versions: SAFER K-64, SAFER K-128,
|
||||
* SAFER SK-64 and SAFER SK-128.
|
||||
* LTC_DESCRIPTION: block-cipher algorithm LTC_SAFER (Secure And Fast Encryption
|
||||
* Routine) in its four versions: LTC_SAFER K-64, LTC_SAFER K-128,
|
||||
* LTC_SAFER SK-64 and LTC_SAFER SK-128.
|
||||
*
|
||||
* AUTHOR: Richard De Moliner (demoliner@isi.ee.ethz.ch)
|
||||
* Signal and Information Processing Laboratory
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
#include <tomcrypt.h>
|
||||
|
||||
#ifdef SAFER
|
||||
#ifdef LTC_SAFER
|
||||
|
||||
const struct ltc_cipher_descriptor
|
||||
safer_k64_desc = {
|
||||
"safer-k64",
|
||||
8, 8, 8, 8, SAFER_K64_DEFAULT_NOF_ROUNDS,
|
||||
8, 8, 8, 8, LTC_SAFER_K64_DEFAULT_NOF_ROUNDS,
|
||||
&safer_k64_setup,
|
||||
&safer_ecb_encrypt,
|
||||
&safer_ecb_decrypt,
|
||||
@@ -47,7 +47,7 @@ const struct ltc_cipher_descriptor
|
||||
|
||||
safer_sk64_desc = {
|
||||
"safer-sk64",
|
||||
9, 8, 8, 8, SAFER_SK64_DEFAULT_NOF_ROUNDS,
|
||||
9, 8, 8, 8, LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS,
|
||||
&safer_sk64_setup,
|
||||
&safer_ecb_encrypt,
|
||||
&safer_ecb_decrypt,
|
||||
@@ -59,7 +59,7 @@ const struct ltc_cipher_descriptor
|
||||
|
||||
safer_k128_desc = {
|
||||
"safer-k128",
|
||||
10, 16, 16, 8, SAFER_K128_DEFAULT_NOF_ROUNDS,
|
||||
10, 16, 16, 8, LTC_SAFER_K128_DEFAULT_NOF_ROUNDS,
|
||||
&safer_k128_setup,
|
||||
&safer_ecb_encrypt,
|
||||
&safer_ecb_decrypt,
|
||||
@@ -71,7 +71,7 @@ const struct ltc_cipher_descriptor
|
||||
|
||||
safer_sk128_desc = {
|
||||
"safer-sk128",
|
||||
11, 16, 16, 8, SAFER_SK128_DEFAULT_NOF_ROUNDS,
|
||||
11, 16, 16, 8, LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS,
|
||||
&safer_sk128_setup,
|
||||
&safer_ecb_encrypt,
|
||||
&safer_ecb_decrypt,
|
||||
@@ -111,48 +111,48 @@ static void Safer_Expand_Userkey(const unsigned char *userkey_1,
|
||||
safer_key_t key)
|
||||
#endif
|
||||
{ unsigned int i, j, k;
|
||||
unsigned char ka[SAFER_BLOCK_LEN + 1];
|
||||
unsigned char kb[SAFER_BLOCK_LEN + 1];
|
||||
unsigned char ka[LTC_SAFER_BLOCK_LEN + 1];
|
||||
unsigned char kb[LTC_SAFER_BLOCK_LEN + 1];
|
||||
|
||||
if (SAFER_MAX_NOF_ROUNDS < nof_rounds)
|
||||
nof_rounds = SAFER_MAX_NOF_ROUNDS;
|
||||
if (LTC_SAFER_MAX_NOF_ROUNDS < nof_rounds)
|
||||
nof_rounds = LTC_SAFER_MAX_NOF_ROUNDS;
|
||||
*key++ = (unsigned char)nof_rounds;
|
||||
ka[SAFER_BLOCK_LEN] = (unsigned char)0;
|
||||
kb[SAFER_BLOCK_LEN] = (unsigned char)0;
|
||||
ka[LTC_SAFER_BLOCK_LEN] = (unsigned char)0;
|
||||
kb[LTC_SAFER_BLOCK_LEN] = (unsigned char)0;
|
||||
k = 0;
|
||||
for (j = 0; j < SAFER_BLOCK_LEN; j++) {
|
||||
for (j = 0; j < LTC_SAFER_BLOCK_LEN; j++) {
|
||||
ka[j] = ROL8(userkey_1[j], 5);
|
||||
ka[SAFER_BLOCK_LEN] ^= ka[j];
|
||||
ka[LTC_SAFER_BLOCK_LEN] ^= ka[j];
|
||||
kb[j] = *key++ = userkey_2[j];
|
||||
kb[SAFER_BLOCK_LEN] ^= kb[j];
|
||||
kb[LTC_SAFER_BLOCK_LEN] ^= kb[j];
|
||||
}
|
||||
for (i = 1; i <= nof_rounds; i++) {
|
||||
for (j = 0; j < SAFER_BLOCK_LEN + 1; j++) {
|
||||
for (j = 0; j < LTC_SAFER_BLOCK_LEN + 1; j++) {
|
||||
ka[j] = ROL8(ka[j], 6);
|
||||
kb[j] = ROL8(kb[j], 6);
|
||||
}
|
||||
if (strengthened) {
|
||||
k = 2 * i - 1;
|
||||
while (k >= (SAFER_BLOCK_LEN + 1)) { k -= SAFER_BLOCK_LEN + 1; }
|
||||
while (k >= (LTC_SAFER_BLOCK_LEN + 1)) { k -= LTC_SAFER_BLOCK_LEN + 1; }
|
||||
}
|
||||
for (j = 0; j < SAFER_BLOCK_LEN; j++) {
|
||||
for (j = 0; j < LTC_SAFER_BLOCK_LEN; j++) {
|
||||
if (strengthened) {
|
||||
*key++ = (ka[k]
|
||||
+ safer_ebox[(int)safer_ebox[(int)((18 * i + j + 1)&0xFF)]]) & 0xFF;
|
||||
if (++k == (SAFER_BLOCK_LEN + 1)) { k = 0; }
|
||||
if (++k == (LTC_SAFER_BLOCK_LEN + 1)) { k = 0; }
|
||||
} else {
|
||||
*key++ = (ka[j] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 1)&0xFF)]]) & 0xFF;
|
||||
}
|
||||
}
|
||||
if (strengthened) {
|
||||
k = 2 * i;
|
||||
while (k >= (SAFER_BLOCK_LEN + 1)) { k -= SAFER_BLOCK_LEN + 1; }
|
||||
while (k >= (LTC_SAFER_BLOCK_LEN + 1)) { k -= LTC_SAFER_BLOCK_LEN + 1; }
|
||||
}
|
||||
for (j = 0; j < SAFER_BLOCK_LEN; j++) {
|
||||
for (j = 0; j < LTC_SAFER_BLOCK_LEN; j++) {
|
||||
if (strengthened) {
|
||||
*key++ = (kb[k]
|
||||
+ safer_ebox[(int)safer_ebox[(int)((18 * i + j + 10)&0xFF)]]) & 0xFF;
|
||||
if (++k == (SAFER_BLOCK_LEN + 1)) { k = 0; }
|
||||
if (++k == (LTC_SAFER_BLOCK_LEN + 1)) { k = 0; }
|
||||
} else {
|
||||
*key++ = (kb[j] + safer_ebox[(int)safer_ebox[(int)((18 * i + j + 10)&0xFF)]]) & 0xFF;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ static void Safer_Expand_Userkey(const unsigned char *userkey_1,
|
||||
safer_key_t key)
|
||||
{
|
||||
_Safer_Expand_Userkey(userkey_1, userkey_2, nof_rounds, strengthened, key);
|
||||
burn_stack(sizeof(unsigned char) * (2 * (SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2);
|
||||
burn_stack(sizeof(unsigned char) * (2 * (LTC_SAFER_BLOCK_LEN + 1)) + sizeof(unsigned int)*2);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -182,7 +182,7 @@ int safer_k64_setup(const unsigned char *key, int keylen, int numrounds, symmetr
|
||||
LTC_ARGCHK(key != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) {
|
||||
return CRYPT_INVALID_ROUNDS;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ int safer_k64_setup(const unsigned char *key, int keylen, int numrounds, symmetr
|
||||
return CRYPT_INVALID_KEYSIZE;
|
||||
}
|
||||
|
||||
Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
|
||||
Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:LTC_SAFER_K64_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ int safer_sk64_setup(const unsigned char *key, int keylen, int numrounds, symmet
|
||||
LTC_ARGCHK(key != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) {
|
||||
return CRYPT_INVALID_ROUNDS;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ int safer_sk64_setup(const unsigned char *key, int keylen, int numrounds, symmet
|
||||
return CRYPT_INVALID_KEYSIZE;
|
||||
}
|
||||
|
||||
Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
|
||||
Safer_Expand_Userkey(key, key, (unsigned int)(numrounds != 0 ?numrounds:LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ int safer_k128_setup(const unsigned char *key, int keylen, int numrounds, symmet
|
||||
LTC_ARGCHK(key != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) {
|
||||
return CRYPT_INVALID_ROUNDS;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ int safer_k128_setup(const unsigned char *key, int keylen, int numrounds, symmet
|
||||
return CRYPT_INVALID_KEYSIZE;
|
||||
}
|
||||
|
||||
Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0 ?numrounds:SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
|
||||
Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0 ?numrounds:LTC_SAFER_K128_DEFAULT_NOF_ROUNDS), 0, skey->safer.key);
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ int safer_sk128_setup(const unsigned char *key, int keylen, int numrounds, symme
|
||||
LTC_ARGCHK(key != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > SAFER_MAX_NOF_ROUNDS)) {
|
||||
if (numrounds != 0 && (numrounds < 6 || numrounds > LTC_SAFER_MAX_NOF_ROUNDS)) {
|
||||
return CRYPT_INVALID_ROUNDS;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ int safer_sk128_setup(const unsigned char *key, int keylen, int numrounds, symme
|
||||
return CRYPT_INVALID_KEYSIZE;
|
||||
}
|
||||
|
||||
Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0?numrounds:SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
|
||||
Safer_Expand_Userkey(key, key+8, (unsigned int)(numrounds != 0?numrounds:LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS), 1, skey->safer.key);
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ int safer_ecb_encrypt(const unsigned char *block_in,
|
||||
key = skey->safer.key;
|
||||
a = block_in[0]; b = block_in[1]; c = block_in[2]; d = block_in[3];
|
||||
e = block_in[4]; f = block_in[5]; g = block_in[6]; h = block_in[7];
|
||||
if (SAFER_MAX_NOF_ROUNDS < (round = *key)) round = SAFER_MAX_NOF_ROUNDS;
|
||||
if (LTC_SAFER_MAX_NOF_ROUNDS < (round = *key)) round = LTC_SAFER_MAX_NOF_ROUNDS;
|
||||
while(round-- > 0)
|
||||
{
|
||||
a ^= *++key; b += *++key; c += *++key; d ^= *++key;
|
||||
@@ -319,8 +319,8 @@ int safer_ecb_decrypt(const unsigned char *block_in,
|
||||
key = skey->safer.key;
|
||||
a = block_in[0]; b = block_in[1]; c = block_in[2]; d = block_in[3];
|
||||
e = block_in[4]; f = block_in[5]; g = block_in[6]; h = block_in[7];
|
||||
if (SAFER_MAX_NOF_ROUNDS < (round = *key)) round = SAFER_MAX_NOF_ROUNDS;
|
||||
key += SAFER_BLOCK_LEN * (1 + 2 * round);
|
||||
if (LTC_SAFER_MAX_NOF_ROUNDS < (round = *key)) round = LTC_SAFER_MAX_NOF_ROUNDS;
|
||||
key += LTC_SAFER_BLOCK_LEN * (1 + 2 * round);
|
||||
h ^= *key; g -= *--key; f -= *--key; e ^= *--key;
|
||||
d ^= *--key; c -= *--key; b -= *--key; a ^= *--key;
|
||||
while (round--)
|
||||
@@ -486,6 +486,6 @@ int safer_sk128_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/safer.c,v $ */
|
||||
/* $Revision: 1.13 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file safer_tab.c
|
||||
Tables for SAFER block ciphers
|
||||
Tables for LTC_SAFER block ciphers
|
||||
*/
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#if defined(SAFERP) || defined(SAFER)
|
||||
#if defined(LTC_SAFERP) || defined(LTC_SAFER)
|
||||
|
||||
/* This is the box defined by ebox[x] = 45^x mod 257.
|
||||
* Its assumed that the value "256" corresponds to zero. */
|
||||
@@ -63,6 +63,6 @@ const unsigned char safer_lbox[256] = {
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/safer_tab.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file saferp.c
|
||||
SAFER+ Implementation by Tom St Denis
|
||||
LTC_SAFER+ Implementation by Tom St Denis
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef SAFERP
|
||||
#ifdef LTC_SAFERP
|
||||
|
||||
const struct ltc_cipher_descriptor saferp_desc =
|
||||
{
|
||||
@@ -37,7 +37,7 @@ const struct ltc_cipher_descriptor saferp_desc =
|
||||
* key addition, substitution, key addition. The safer_ebox and safer_lbox
|
||||
* are the exponentiation box and logarithm boxes respectively.
|
||||
* The value of 'i' is the current round number which allows this
|
||||
* function to be unrolled massively. Most of SAFER+'s speed
|
||||
* function to be unrolled massively. Most of LTC_SAFER+'s speed
|
||||
* comes from not having to compute indirect accesses into the
|
||||
* array of 16 bytes b[0..15] which is the block of data
|
||||
*/
|
||||
@@ -206,7 +206,7 @@ static const unsigned char safer_bias[33][16] = {
|
||||
{ 62, 220, 134, 119, 215, 166, 17, 251, 244, 186, 146, 145, 100, 131, 241, 51}};
|
||||
|
||||
/**
|
||||
Initialize the SAFER+ block cipher
|
||||
Initialize the LTC_SAFER+ block cipher
|
||||
@param key The symmetric key you wish to pass
|
||||
@param keylen The key length in bytes
|
||||
@param num_rounds The number of rounds desired (0 for default)
|
||||
@@ -325,7 +325,7 @@ int saferp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric
|
||||
}
|
||||
|
||||
/**
|
||||
Encrypts a block of text with SAFER+
|
||||
Encrypts a block of text with LTC_SAFER+
|
||||
@param pt The input plaintext (16 bytes)
|
||||
@param ct The output ciphertext (16 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -389,7 +389,7 @@ int saferp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key
|
||||
}
|
||||
|
||||
/**
|
||||
Decrypts a block of text with SAFER+
|
||||
Decrypts a block of text with LTC_SAFER+
|
||||
@param ct The input ciphertext (16 bytes)
|
||||
@param pt The output plaintext (16 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -453,7 +453,7 @@ int saferp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key
|
||||
}
|
||||
|
||||
/**
|
||||
Performs a self-test of the SAFER+ block cipher
|
||||
Performs a self-test of the LTC_SAFER+ block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int saferp_test(void)
|
||||
@@ -554,6 +554,6 @@ int saferp_keysize(int *keysize)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/safer/saferp.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef SKIPJACK
|
||||
#ifdef LTC_SKIPJACK
|
||||
|
||||
const struct ltc_cipher_descriptor skipjack_desc =
|
||||
{
|
||||
@@ -338,6 +338,6 @@ int skipjack_keysize(int *keysize)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/skipjack.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef TWOFISH
|
||||
#ifdef LTC_TWOFISH
|
||||
|
||||
/* first TWOFISH_ALL_TABLES must ensure TWOFISH_TABLES is defined */
|
||||
#ifdef TWOFISH_ALL_TABLES
|
||||
#ifndef TWOFISH_TABLES
|
||||
#define TWOFISH_TABLES
|
||||
/* first LTC_TWOFISH_ALL_TABLES must ensure LTC_TWOFISH_TABLES is defined */
|
||||
#ifdef LTC_TWOFISH_ALL_TABLES
|
||||
#ifndef LTC_TWOFISH_TABLES
|
||||
#define LTC_TWOFISH_TABLES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -68,7 +68,7 @@ static const unsigned char qord[4][5] = {
|
||||
{ 1, 0, 1, 1, 0 }
|
||||
};
|
||||
|
||||
#ifdef TWOFISH_TABLES
|
||||
#ifdef LTC_TWOFISH_TABLES
|
||||
|
||||
#include "twofish_tab.c"
|
||||
|
||||
@@ -142,7 +142,7 @@ static ulong32 sbox(int i, ulong32 x)
|
||||
}
|
||||
#endif /* LTC_CLEAN_STACK */
|
||||
|
||||
#endif /* TWOFISH_TABLES */
|
||||
#endif /* LTC_TWOFISH_TABLES */
|
||||
|
||||
/* computes ab mod p */
|
||||
static ulong32 gf_mult(ulong32 a, ulong32 b, ulong32 p)
|
||||
@@ -167,7 +167,7 @@ static ulong32 gf_mult(ulong32 a, ulong32 b, ulong32 p)
|
||||
}
|
||||
|
||||
/* computes [y0 y1 y2 y3] = MDS . [x0] */
|
||||
#ifndef TWOFISH_TABLES
|
||||
#ifndef LTC_TWOFISH_TABLES
|
||||
static ulong32 mds_column_mult(unsigned char in, int col)
|
||||
{
|
||||
ulong32 x01, x5B, xEF;
|
||||
@@ -202,11 +202,11 @@ static ulong32 mds_column_mult(unsigned char in, int col)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !TWOFISH_TABLES */
|
||||
#else /* !LTC_TWOFISH_TABLES */
|
||||
|
||||
#define mds_column_mult(x, i) mds_tab[i][x]
|
||||
|
||||
#endif /* TWOFISH_TABLES */
|
||||
#endif /* LTC_TWOFISH_TABLES */
|
||||
|
||||
/* Computes [y0 y1 y2 y3] = MDS . [x0 x1 x2 x3] */
|
||||
static void mds_mult(const unsigned char *in, unsigned char *out)
|
||||
@@ -219,7 +219,7 @@ static void mds_mult(const unsigned char *in, unsigned char *out)
|
||||
STORE32L(tmp, out);
|
||||
}
|
||||
|
||||
#ifdef TWOFISH_ALL_TABLES
|
||||
#ifdef LTC_TWOFISH_ALL_TABLES
|
||||
/* computes [y0 y1 y2 y3] = RS . [x0 x1 x2 x3 x4 x5 x6 x7] */
|
||||
static void rs_mult(const unsigned char *in, unsigned char *out)
|
||||
{
|
||||
@@ -229,7 +229,7 @@ static void rs_mult(const unsigned char *in, unsigned char *out)
|
||||
STORE32L(tmp, out);
|
||||
}
|
||||
|
||||
#else /* !TWOFISH_ALL_TABLES */
|
||||
#else /* !LTC_TWOFISH_ALL_TABLES */
|
||||
|
||||
/* computes [y0 y1 y2 y3] = RS . [x0 x1 x2 x3 x4 x5 x6 x7] */
|
||||
static void rs_mult(const unsigned char *in, unsigned char *out)
|
||||
@@ -273,7 +273,7 @@ static void h_func(const unsigned char *in, unsigned char *out, unsigned char *M
|
||||
mds_mult(y, out);
|
||||
}
|
||||
|
||||
#ifndef TWOFISH_SMALL
|
||||
#ifndef LTC_TWOFISH_SMALL
|
||||
|
||||
/* for GCC we don't use pointer aliases */
|
||||
#if defined(__GNUC__)
|
||||
@@ -332,7 +332,7 @@ static ulong32 g_func(ulong32 x, symmetric_key *key)
|
||||
}
|
||||
#endif /* LTC_CLEAN_STACK */
|
||||
|
||||
#endif /* TWOFISH_SMALL */
|
||||
#endif /* LTC_TWOFISH_SMALL */
|
||||
|
||||
/**
|
||||
Initialize the Twofish block cipher
|
||||
@@ -348,7 +348,7 @@ static int _twofish_setup(const unsigned char *key, int keylen, int num_rounds,
|
||||
int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
|
||||
#endif
|
||||
{
|
||||
#ifndef TWOFISH_SMALL
|
||||
#ifndef LTC_TWOFISH_SMALL
|
||||
unsigned char S[4*4], tmpx0, tmpx1;
|
||||
#endif
|
||||
int k, x, y;
|
||||
@@ -376,7 +376,7 @@ int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
|
||||
}
|
||||
|
||||
/* create the S[..] words */
|
||||
#ifndef TWOFISH_SMALL
|
||||
#ifndef LTC_TWOFISH_SMALL
|
||||
for (x = 0; x < k; x++) {
|
||||
rs_mult(M+(x*8), S+(x*4));
|
||||
}
|
||||
@@ -410,7 +410,7 @@ int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetri
|
||||
skey->twofish.K[x+x+1] = ROLc(B + B + A, 9);
|
||||
}
|
||||
|
||||
#ifndef TWOFISH_SMALL
|
||||
#ifndef LTC_TWOFISH_SMALL
|
||||
/* make the sboxes (large ram variant) */
|
||||
if (k == 2) {
|
||||
for (x = 0; x < 256; x++) {
|
||||
@@ -477,7 +477,7 @@ int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_ke
|
||||
{
|
||||
ulong32 a,b,c,d,ta,tb,tc,td,t1,t2, *k;
|
||||
int r;
|
||||
#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
ulong32 *S1, *S2, *S3, *S4;
|
||||
#endif
|
||||
|
||||
@@ -485,7 +485,7 @@ int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_ke
|
||||
LTC_ARGCHK(ct != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
S1 = skey->twofish.S[0];
|
||||
S2 = skey->twofish.S[1];
|
||||
S3 = skey->twofish.S[2];
|
||||
@@ -550,7 +550,7 @@ int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_ke
|
||||
{
|
||||
ulong32 a,b,c,d,ta,tb,tc,td,t1,t2, *k;
|
||||
int r;
|
||||
#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
ulong32 *S1, *S2, *S3, *S4;
|
||||
#endif
|
||||
|
||||
@@ -558,7 +558,7 @@ int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_ke
|
||||
LTC_ARGCHK(ct != NULL);
|
||||
LTC_ARGCHK(skey != NULL);
|
||||
|
||||
#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
|
||||
S1 = skey->twofish.S[0];
|
||||
S2 = skey->twofish.S[1];
|
||||
S3 = skey->twofish.S[2];
|
||||
@@ -714,6 +714,6 @@ int twofish_keysize(int *keysize)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/twofish/twofish.c,v $ */
|
||||
/* $Revision: 1.14 $ */
|
||||
/* $Date: 2006/12/04 21:34:03 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file twofish_tab.c
|
||||
Twofish tables, Tom St Denis
|
||||
*/
|
||||
#ifdef TWOFISH_TABLES
|
||||
#ifdef LTC_TWOFISH_TABLES
|
||||
|
||||
/* pre generated 8x8 tables from the four 4x4s */
|
||||
static const unsigned char SBOX[2][256] = {
|
||||
@@ -212,7 +212,7 @@ static const ulong32 mds_tab[4][256] = {
|
||||
0xc6baf8c6UL, 0x9d55f99dUL, 0x700dfa70UL, 0x2be2fb2bUL, 0xc3bdfcc3UL, 0x9852fd98UL, 0x750afe75UL, 0x2ee5ff2eUL
|
||||
}};
|
||||
|
||||
#ifdef TWOFISH_ALL_TABLES
|
||||
#ifdef LTC_TWOFISH_ALL_TABLES
|
||||
|
||||
/* the 4x8 RS transform */
|
||||
static const ulong32 rs_tab0[256] = {
|
||||
@@ -487,10 +487,10 @@ static const ulong32 rs_tab7[256] = {
|
||||
0x5d8218b2LU, 0x5e9bfd2cLU, 0x5bb09fc3LU, 0x58a97a5dLU, 0x51e65b50LU, 0x52ffbeceLU, 0x57d4dc21LU, 0x54cd39bfLU,
|
||||
0x454a9e3bLU, 0x46537ba5LU, 0x4378194aLU, 0x4061fcd4LU, 0x492eddd9LU, 0x4a373847LU, 0x4f1c5aa8LU, 0x4c05bf36LU };
|
||||
|
||||
#endif /* TWOFISH_ALL_TABLES */
|
||||
#endif /* LTC_TWOFISH_ALL_TABLES */
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/twofish/twofish_tab.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file xtea.c
|
||||
Implementation of XTEA, Tom St Denis
|
||||
Implementation of LTC_XTEA, Tom St Denis
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef XTEA
|
||||
#ifdef LTC_XTEA
|
||||
|
||||
const struct ltc_cipher_descriptor xtea_desc =
|
||||
{
|
||||
@@ -67,7 +67,7 @@ int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k
|
||||
}
|
||||
|
||||
/**
|
||||
Encrypts a block of text with XTEA
|
||||
Encrypts a block of text with LTC_XTEA
|
||||
@param pt The input plaintext (8 bytes)
|
||||
@param ct The output ciphertext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -103,7 +103,7 @@ int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *
|
||||
}
|
||||
|
||||
/**
|
||||
Decrypts a block of text with XTEA
|
||||
Decrypts a block of text with LTC_XTEA
|
||||
@param ct The input ciphertext (8 bytes)
|
||||
@param pt The output plaintext (8 bytes)
|
||||
@param skey The key as scheduled
|
||||
@@ -139,7 +139,7 @@ int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *
|
||||
}
|
||||
|
||||
/**
|
||||
Performs a self-test of the XTEA block cipher
|
||||
Performs a self-test of the LTC_XTEA block cipher
|
||||
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
|
||||
*/
|
||||
int xtea_test(void)
|
||||
@@ -206,6 +206,6 @@ int xtea_keysize(int *keysize)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/xtea.c,v $ */
|
||||
/* $Revision: 1.12 $ */
|
||||
/* $Date: 2006/11/08 23:01:06 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
CCM support, process a block of memory, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef CCM_MODE
|
||||
#ifdef LTC_CCM_MODE
|
||||
|
||||
/**
|
||||
CCM encrypt/decrypt and produce an authentication tag
|
||||
@@ -346,6 +346,6 @@ error:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ccm/ccm_memory.c,v $ */
|
||||
/* $Revision: 1.18 $ */
|
||||
/* $Date: 2006/12/04 21:34:03 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
CCM support, process a block of memory, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef CCM_MODE
|
||||
#ifdef LTC_CCM_MODE
|
||||
|
||||
int ccm_test(void)
|
||||
{
|
||||
@@ -175,6 +175,6 @@ int ccm_test(void)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ccm/ccm_test.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/21 00:18:23 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/**
|
||||
@file eax_addheader.c
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
add header (metadata) to the stream
|
||||
@@ -33,6 +33,6 @@ int eax_addheader(eax_state *eax, const unsigned char *header,
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_addheader.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
Decrypt data with the EAX protocol
|
||||
@@ -45,6 +45,6 @@ int eax_decrypt(eax_state *eax, const unsigned char *ct, unsigned char *pt,
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_decrypt.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
Decrypt a block of memory and verify the provided MAC tag with EAX
|
||||
@@ -103,6 +103,6 @@ LBL_ERR:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_decrypt_verify_memory.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
Terminate an EAX session and get the tag.
|
||||
@@ -89,6 +89,6 @@ LBL_ERR:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_done.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
Encrypt with EAX a block of data.
|
||||
@@ -46,6 +46,6 @@ int eax_encrypt(eax_state *eax, const unsigned char *pt, unsigned char *ct,
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_encrypt.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
EAX encrypt and produce an authentication tag
|
||||
@@ -77,6 +77,6 @@ LBL_ERR:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_encrypt_authenticate_memory.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
Initialized an EAX state
|
||||
@@ -66,7 +66,7 @@ int eax_init(eax_state *eax, int cipher,
|
||||
return CRYPT_MEM;
|
||||
}
|
||||
|
||||
/* N = OMAC_0K(nonce) */
|
||||
/* N = LTC_OMAC_0K(nonce) */
|
||||
zeromem(buf, MAXBLOCKSIZE);
|
||||
if ((err = omac_init(omac, cipher, key, keylen)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
@@ -86,7 +86,7 @@ int eax_init(eax_state *eax, int cipher,
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* H = OMAC_1K(header) */
|
||||
/* H = LTC_OMAC_1K(header) */
|
||||
zeromem(buf, MAXBLOCKSIZE);
|
||||
buf[blklen - 1] = 1;
|
||||
|
||||
@@ -112,7 +112,7 @@ int eax_init(eax_state *eax, int cipher,
|
||||
goto LBL_ERR;
|
||||
}
|
||||
|
||||
/* setup the OMAC for the ciphertext */
|
||||
/* setup the LTC_OMAC for the ciphertext */
|
||||
if ((err = omac_init(&eax->ctomac, cipher, key, keylen)) != CRYPT_OK) {
|
||||
goto LBL_ERR;
|
||||
}
|
||||
@@ -139,6 +139,6 @@ LBL_ERR:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_init.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef EAX_MODE
|
||||
#ifdef LTC_EAX_MODE
|
||||
|
||||
/**
|
||||
Test the EAX implementation
|
||||
@@ -275,8 +275,8 @@ int eax_test(void)
|
||||
#endif /* LTC_TEST */
|
||||
}
|
||||
|
||||
#endif /* EAX_MODE */
|
||||
#endif /* LTC_EAX_MODE */
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/eax/eax_test.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Add AAD to the GCM state
|
||||
@@ -47,7 +47,7 @@ int gcm_add_aad(gcm_state *gcm,
|
||||
}
|
||||
|
||||
/* in IV mode? */
|
||||
if (gcm->mode == GCM_MODE_IV) {
|
||||
if (gcm->mode == LTC_GCM_MODE_IV) {
|
||||
/* let's process the IV */
|
||||
if (gcm->ivmode || gcm->buflen != 12) {
|
||||
for (x = 0; x < (unsigned long)gcm->buflen; x++) {
|
||||
@@ -80,10 +80,10 @@ int gcm_add_aad(gcm_state *gcm,
|
||||
zeromem(gcm->buf, 16);
|
||||
gcm->buflen = 0;
|
||||
gcm->totlen = 0;
|
||||
gcm->mode = GCM_MODE_AAD;
|
||||
gcm->mode = LTC_GCM_MODE_AAD;
|
||||
}
|
||||
|
||||
if (gcm->mode != GCM_MODE_AAD || gcm->buflen >= 16) {
|
||||
if (gcm->mode != LTC_GCM_MODE_AAD || gcm->buflen >= 16) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
@@ -119,6 +119,6 @@ int gcm_add_aad(gcm_state *gcm,
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_add_aad.c,v $ */
|
||||
/* $Revision: 1.16 $ */
|
||||
/* $Date: 2006/09/23 19:24:21 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Add IV data to the GCM state
|
||||
@@ -36,7 +36,7 @@ int gcm_add_iv(gcm_state *gcm,
|
||||
}
|
||||
|
||||
/* must be in IV mode */
|
||||
if (gcm->mode != GCM_MODE_IV) {
|
||||
if (gcm->mode != LTC_GCM_MODE_IV) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,6 @@ int gcm_add_iv(gcm_state *gcm,
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_add_iv.c,v $ */
|
||||
/* $Revision: 1.7 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Terminate a GCM stream
|
||||
@@ -43,7 +43,7 @@ int gcm_done(gcm_state *gcm,
|
||||
}
|
||||
|
||||
|
||||
if (gcm->mode != GCM_MODE_TEXT) {
|
||||
if (gcm->mode != LTC_GCM_MODE_TEXT) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ int gcm_done(gcm_state *gcm,
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_done.c,v $ */
|
||||
/* $Revision: 1.9 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#if defined(GCM_TABLES) || defined(LRW_TABLES) || ((defined(GCM_MODE) || defined(GCM_MODE)) && defined(LTC_FAST))
|
||||
#if defined(LTC_GCM_TABLES) || defined(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 */
|
||||
@@ -56,7 +56,7 @@ const unsigned char gcm_shift_table[256*2] = {
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(GCM_MODE) || defined(LRW_MODE)
|
||||
#if defined(LTC_GCM_MODE) || defined(LRW_MODE)
|
||||
|
||||
#ifndef LTC_FAST
|
||||
/* right shift */
|
||||
@@ -215,7 +215,7 @@ void gcm_gf_mult(const unsigned char *a, const unsigned char *b, unsigned char *
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_gf_mult.c,v $ */
|
||||
/* $Revision: 1.23 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Initialize a GCM state
|
||||
@@ -30,7 +30,7 @@ int gcm_init(gcm_state *gcm, int cipher,
|
||||
{
|
||||
int err;
|
||||
unsigned char B[16];
|
||||
#ifdef GCM_TABLES
|
||||
#ifdef LTC_GCM_TABLES
|
||||
int x, y, z, t;
|
||||
#endif
|
||||
|
||||
@@ -66,13 +66,13 @@ int gcm_init(gcm_state *gcm, int cipher,
|
||||
zeromem(gcm->buf, sizeof(gcm->buf));
|
||||
zeromem(gcm->X, sizeof(gcm->X));
|
||||
gcm->cipher = cipher;
|
||||
gcm->mode = GCM_MODE_IV;
|
||||
gcm->mode = LTC_GCM_MODE_IV;
|
||||
gcm->ivmode = 0;
|
||||
gcm->buflen = 0;
|
||||
gcm->totlen = 0;
|
||||
gcm->pttotlen = 0;
|
||||
|
||||
#ifdef GCM_TABLES
|
||||
#ifdef LTC_GCM_TABLES
|
||||
/* setup tables */
|
||||
|
||||
/* generate the first table as it has no shifting (from which we make the other tables) */
|
||||
@@ -102,6 +102,6 @@ int gcm_init(gcm_state *gcm, int cipher,
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_init.c,v $ */
|
||||
/* $Revision: 1.18 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Process an entire GCM packet in one call.
|
||||
@@ -65,7 +65,7 @@ int gcm_memory( int cipher,
|
||||
|
||||
|
||||
|
||||
#ifndef GCM_TABLES_SSE2
|
||||
#ifndef LTC_GCM_TABLES_SSE2
|
||||
orig = gcm = XMALLOC(sizeof(*gcm));
|
||||
#else
|
||||
orig = gcm = XMALLOC(sizeof(*gcm) + 16);
|
||||
@@ -78,7 +78,7 @@ int gcm_memory( int cipher,
|
||||
* note that we only modify gcm and keep orig intact. This code is not portable
|
||||
* but again it's only for SSE2 anyways, so who cares?
|
||||
*/
|
||||
#ifdef GCM_TABLES_SSE2
|
||||
#ifdef LTC_GCM_TABLES_SSE2
|
||||
if ((unsigned long)gcm & 15) {
|
||||
gcm = (gcm_state *)((unsigned long)gcm + (16 - ((unsigned long)gcm & 15)));
|
||||
}
|
||||
@@ -104,6 +104,6 @@ LTC_ERR:
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_memory.c,v $ */
|
||||
/* $Revision: 1.23 $ */
|
||||
/* $Date: 2006/09/07 10:00:57 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#if defined(GCM_MODE)
|
||||
#if defined(LTC_GCM_MODE)
|
||||
/**
|
||||
GCM multiply by H
|
||||
@param gcm The GCM state which holds the H value
|
||||
@@ -24,9 +24,9 @@
|
||||
void gcm_mult_h(gcm_state *gcm, unsigned char *I)
|
||||
{
|
||||
unsigned char T[16];
|
||||
#ifdef GCM_TABLES
|
||||
#ifdef LTC_GCM_TABLES
|
||||
int x, y;
|
||||
#ifdef GCM_TABLES_SSE2
|
||||
#ifdef LTC_GCM_TABLES_SSE2
|
||||
asm("movdqa (%0),%%xmm0"::"r"(&gcm->PC[0][I[0]][0]));
|
||||
for (x = 1; x < 16; x++) {
|
||||
asm("pxor (%0),%%xmm0"::"r"(&gcm->PC[x][I[x]][0]));
|
||||
@@ -45,7 +45,7 @@ void gcm_mult_h(gcm_state *gcm, unsigned char *I)
|
||||
}
|
||||
#endif /* LTC_FAST */
|
||||
}
|
||||
#endif /* GCM_TABLES_SSE2 */
|
||||
#endif /* LTC_GCM_TABLES_SSE2 */
|
||||
#else
|
||||
gcm_gf_mult(gcm->H, I, T);
|
||||
#endif
|
||||
@@ -53,6 +53,6 @@ void gcm_mult_h(gcm_state *gcm, unsigned char *I)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_mult_h.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/08/23 20:40:23 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Process plaintext/ciphertext through GCM
|
||||
@@ -50,7 +50,7 @@ int gcm_process(gcm_state *gcm,
|
||||
}
|
||||
|
||||
/* in AAD mode? */
|
||||
if (gcm->mode == GCM_MODE_AAD) {
|
||||
if (gcm->mode == LTC_GCM_MODE_AAD) {
|
||||
/* let's process the AAD */
|
||||
if (gcm->buflen) {
|
||||
gcm->totlen += gcm->buflen * CONST64(8);
|
||||
@@ -67,10 +67,10 @@ int gcm_process(gcm_state *gcm,
|
||||
}
|
||||
|
||||
gcm->buflen = 0;
|
||||
gcm->mode = GCM_MODE_TEXT;
|
||||
gcm->mode = LTC_GCM_MODE_TEXT;
|
||||
}
|
||||
|
||||
if (gcm->mode != GCM_MODE_TEXT) {
|
||||
if (gcm->mode != LTC_GCM_MODE_TEXT) {
|
||||
return CRYPT_INVALID_ARG;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,6 @@ int gcm_process(gcm_state *gcm,
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_process.c,v $ */
|
||||
/* $Revision: 1.14 $ */
|
||||
/* $Date: 2006/11/19 19:33:36 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Reset a GCM state to as if you just called gcm_init(). This saves the initialization time.
|
||||
@@ -28,7 +28,7 @@ int gcm_reset(gcm_state *gcm)
|
||||
|
||||
zeromem(gcm->buf, sizeof(gcm->buf));
|
||||
zeromem(gcm->X, sizeof(gcm->X));
|
||||
gcm->mode = GCM_MODE_IV;
|
||||
gcm->mode = LTC_GCM_MODE_IV;
|
||||
gcm->ivmode = 0;
|
||||
gcm->buflen = 0;
|
||||
gcm->totlen = 0;
|
||||
@@ -39,6 +39,6 @@ int gcm_reset(gcm_state *gcm)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_reset.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef GCM_MODE
|
||||
#ifdef LTC_GCM_MODE
|
||||
|
||||
/**
|
||||
Test the GCM code
|
||||
@@ -408,6 +408,6 @@ int gcm_test(void)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/gcm/gcm_test.c,v $ */
|
||||
/* $Revision: 1.20 $ */
|
||||
/* $Date: 2006/12/03 17:25:44 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Decrypt a block with OCB.
|
||||
@@ -74,6 +74,6 @@ int ocb_decrypt(ocb_state *ocb, const unsigned char *ct, unsigned char *pt)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_decrypt.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Decrypt and compare the tag with OCB.
|
||||
@@ -81,6 +81,6 @@ LBL_ERR:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_decrypt_verify_memory.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Terminate a decrypting OCB state
|
||||
@@ -75,6 +75,6 @@ LBL_ERR:
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_done_decrypt.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Terminate an encryption OCB state
|
||||
@@ -41,6 +41,6 @@ int ocb_done_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned long ptle
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_done_encrypt.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Encrypt a block of data with OCB.
|
||||
@@ -67,6 +67,6 @@ int ocb_encrypt(ocb_state *ocb, const unsigned char *pt, unsigned char *ct)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_encrypt.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Encrypt and generate an authentication code for a buffer of memory
|
||||
@@ -79,6 +79,6 @@ LBL_ERR:
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_encrypt_authenticate_memory.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
static const struct {
|
||||
int len;
|
||||
@@ -132,6 +132,6 @@ int ocb_init(ocb_state *ocb, int cipher,
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_init.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Returns the number of leading zero bits [from lsb up]
|
||||
@@ -37,6 +37,6 @@ int ocb_ntz(unsigned long x)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_ntz.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Compute the shift/xor for OCB (internal function)
|
||||
@@ -34,6 +34,6 @@ void ocb_shift_xor(ocb_state *ocb, unsigned char *Z)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_shift_xor.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/**
|
||||
Test the OCB protocol
|
||||
@@ -222,7 +222,7 @@ int ocb_test(void)
|
||||
#endif /* LTC_TEST */
|
||||
}
|
||||
|
||||
#endif /* OCB_MODE */
|
||||
#endif /* LTC_OCB_MODE */
|
||||
|
||||
|
||||
/* some comments
|
||||
@@ -232,6 +232,6 @@ int ocb_test(void)
|
||||
-- The setup is somewhat complicated...
|
||||
*/
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/ocb_test.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef OCB_MODE
|
||||
#ifdef LTC_OCB_MODE
|
||||
|
||||
/* Since the last block is encrypted in CTR mode the same code can
|
||||
* be used to finish a decrypt or encrypt stream. The only difference
|
||||
@@ -143,6 +143,6 @@ error:
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/encauth/ocb/s_ocb_done.c,v $ */
|
||||
/* $Revision: 1.6 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
#include "tomcrypt.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
CHC support. (Tom St Denis)
|
||||
*/
|
||||
|
||||
#ifdef CHC_HASH
|
||||
#ifdef LTC_CHC_HASH
|
||||
|
||||
#define UNDEFED_HASH -17
|
||||
|
||||
@@ -293,6 +293,6 @@ int chc_test(void)
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/chc/chc.c,v $ */
|
||||
/* $Revision: 1.6 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -53,6 +53,6 @@ int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *ou
|
||||
}
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_file.c,v $ */
|
||||
/* $Revision: 1.4 $ */
|
||||
/* $Date: 2006/03/31 14:15:35 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -67,6 +67,6 @@ int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outle
|
||||
}
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_filehandle.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/06/16 21:53:41 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -64,6 +64,6 @@ LBL_ERR:
|
||||
return err;
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/06/16 21:53:41 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
#include <stdarg.h>
|
||||
@@ -82,6 +82,6 @@ LBL_ERR:
|
||||
return err;
|
||||
}
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/helper/hash_memory_multi.c,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/06/16 21:53:41 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@param md2.c
|
||||
MD2 (RFC 1319) hash function implementation by Tom St Denis
|
||||
LTC_MD2 (RFC 1319) hash function implementation by Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef MD2
|
||||
#ifdef LTC_MD2
|
||||
|
||||
const struct ltc_hash_descriptor md2_desc =
|
||||
{
|
||||
@@ -102,7 +102,7 @@ int md2_init(hash_state *md)
|
||||
{
|
||||
LTC_ARGCHK(md != NULL);
|
||||
|
||||
/* MD2 uses a zero'ed state... */
|
||||
/* LTC_MD2 uses a zero'ed state... */
|
||||
zeromem(md->md2.X, sizeof(md->md2.X));
|
||||
zeromem(md->md2.chksum, sizeof(md->md2.chksum));
|
||||
zeromem(md->md2.buf, sizeof(md->md2.buf));
|
||||
@@ -246,6 +246,6 @@ int md2_test(void)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md2.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
Submitted by Dobes Vandermeer (dobes@smartt.com)
|
||||
*/
|
||||
|
||||
#ifdef MD4
|
||||
#ifdef LTC_MD4
|
||||
|
||||
const struct ltc_hash_descriptor md4_desc =
|
||||
{
|
||||
@@ -48,7 +48,7 @@ const struct ltc_hash_descriptor md4_desc =
|
||||
#define S33 11
|
||||
#define S34 15
|
||||
|
||||
/* F, G and H are basic MD4 functions. */
|
||||
/* F, G and H are basic LTC_MD4 functions. */
|
||||
#define F(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define G(x, y, z) ((x & y) | (z & (x | y)))
|
||||
#define H(x, y, z) ((x) ^ (y) ^ (z))
|
||||
@@ -302,6 +302,6 @@ int md4_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md4.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
|
||||
/**
|
||||
@file md5.c
|
||||
MD5 hash function by Tom St Denis
|
||||
LTC_MD5 hash function by Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef MD5
|
||||
#ifdef LTC_MD5
|
||||
|
||||
const struct ltc_hash_descriptor md5_desc =
|
||||
{
|
||||
@@ -363,6 +363,6 @@ int md5_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/md5.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
RMD128 Hash function
|
||||
*/
|
||||
|
||||
/* Implementation of RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC
|
||||
/* Implementation of LTC_RIPEMD-128 based on the source by Antoon Bosselaers, ESAT-COSIC
|
||||
*
|
||||
* This source has been radically overhauled to be portable and work within
|
||||
* the LibTomCrypt API by Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef RIPEMD128
|
||||
#ifdef LTC_RIPEMD128
|
||||
|
||||
const struct ltc_hash_descriptor rmd128_desc =
|
||||
{
|
||||
@@ -405,6 +405,6 @@ int rmd128_test(void)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd128.c,v $ */
|
||||
/* $Revision: 1.9 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
RMD160 hash function
|
||||
*/
|
||||
|
||||
/* Implementation of RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC
|
||||
/* Implementation of LTC_RIPEMD-160 based on the source by Antoon Bosselaers, ESAT-COSIC
|
||||
*
|
||||
* This source has been radically overhauled to be portable and work within
|
||||
* the LibTomCrypt API by Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef RIPEMD160
|
||||
#ifdef LTC_RIPEMD160
|
||||
|
||||
const struct ltc_hash_descriptor rmd160_desc =
|
||||
{
|
||||
@@ -464,6 +464,6 @@ int rmd160_test(void)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/rmd160.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@param rmd256.c
|
||||
RMD256 Hash function
|
||||
RLTC_MD256 Hash function
|
||||
*/
|
||||
|
||||
#ifdef RIPEMD256
|
||||
#ifdef LTC_RIPEMD256
|
||||
|
||||
const struct ltc_hash_descriptor rmd256_desc =
|
||||
{
|
||||
"rmd256",
|
||||
8,
|
||||
16,
|
||||
32,
|
||||
64,
|
||||
|
||||
/* OID */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
RMD320 hash function
|
||||
*/
|
||||
|
||||
#ifdef RIPEMD320
|
||||
#ifdef LTC_RIPEMD320
|
||||
|
||||
const struct ltc_hash_descriptor rmd320_desc =
|
||||
{
|
||||
"rmd320",
|
||||
9,
|
||||
20,
|
||||
40,
|
||||
64,
|
||||
|
||||
/* OID */
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file sha1.c
|
||||
SHA1 code by Tom St Denis
|
||||
LTC_SHA1 code by Tom St Denis
|
||||
*/
|
||||
|
||||
|
||||
#ifdef SHA1
|
||||
#ifdef LTC_SHA1
|
||||
|
||||
const struct ltc_hash_descriptor sha1_desc =
|
||||
{
|
||||
@@ -283,6 +283,6 @@ int sha1_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha1.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/**
|
||||
@param sha224.c
|
||||
SHA-224 new NIST standard based off of SHA-256 truncated to 224 bits (Tom St Denis)
|
||||
LTC_SHA-224 new NIST standard based off of LTC_SHA-256 truncated to 224 bits (Tom St Denis)
|
||||
*/
|
||||
|
||||
const struct ltc_hash_descriptor sha224_desc =
|
||||
@@ -120,6 +120,6 @@ int sha224_test(void)
|
||||
}
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha224.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@file sha256.c
|
||||
SHA256 by Tom St Denis
|
||||
LTC_SHA256 by Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef SHA256
|
||||
#ifdef LTC_SHA256
|
||||
|
||||
const struct ltc_hash_descriptor sha256_desc =
|
||||
{
|
||||
@@ -327,7 +327,7 @@ int sha256_test(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SHA224
|
||||
#ifdef LTC_SHA224
|
||||
#include "sha224.c"
|
||||
#endif
|
||||
|
||||
@@ -335,6 +335,6 @@ int sha256_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha256.c,v $ */
|
||||
/* $Revision: 1.9 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
/**
|
||||
@param sha384.c
|
||||
SHA384 hash included in sha512.c, Tom St Denis
|
||||
LTC_SHA384 hash included in sha512.c, Tom St Denis
|
||||
*/
|
||||
|
||||
const struct ltc_hash_descriptor sha384_desc =
|
||||
@@ -130,6 +130,6 @@ int sha384_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha384.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
/**
|
||||
@param sha512.c
|
||||
SHA512 by Tom St Denis
|
||||
LTC_SHA512 by Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef SHA512
|
||||
#ifdef LTC_SHA512
|
||||
|
||||
const struct ltc_hash_descriptor sha512_desc =
|
||||
{
|
||||
@@ -305,7 +305,7 @@ int sha512_test(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SHA384
|
||||
#ifdef LTC_SHA384
|
||||
#include "sha384.c"
|
||||
#endif
|
||||
|
||||
@@ -314,6 +314,6 @@ int sha512_test(void)
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/sha2/sha512.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
#include "tomcrypt.h"
|
||||
@@ -16,7 +16,7 @@
|
||||
Tiger hash function, Tom St Denis
|
||||
*/
|
||||
|
||||
#ifdef TIGER
|
||||
#ifdef LTC_TIGER
|
||||
|
||||
const struct ltc_hash_descriptor tiger_desc =
|
||||
{
|
||||
@@ -809,6 +809,6 @@ Hash of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-ABCDEFG
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/tiger.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
* The library is free for all purposes without any express
|
||||
* guarantee it works.
|
||||
*
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtomcrypt.com
|
||||
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
/**
|
||||
@file whirl.c
|
||||
WHIRLPOOL (using their new sbox) hash function by Tom St Denis
|
||||
LTC_WHIRLPOOL (using their new sbox) hash function by Tom St Denis
|
||||
*/
|
||||
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifdef WHIRLPOOL
|
||||
#ifdef LTC_WHIRLPOOL
|
||||
|
||||
const struct ltc_hash_descriptor whirlpool_desc =
|
||||
{
|
||||
@@ -309,6 +309,6 @@ int whirlpool_test(void)
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/whirl/whirl.c,v $ */
|
||||
/* $Revision: 1.8 $ */
|
||||
/* $Date: 2006/11/01 09:28:17 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
@file whirltab.c
|
||||
WHIRLPOOL tables, Tom St Denis
|
||||
LTC_WHIRLPOOL tables, Tom St Denis
|
||||
*/
|
||||
static const ulong64 sbox0[] = {
|
||||
CONST64(0x18186018c07830d8), CONST64(0x23238c2305af4626), CONST64(0xc6c63fc67ef991b8), CONST64(0xe8e887e8136fcdfb),
|
||||
@@ -578,6 +578,6 @@ CONST64(0x6302aa71c81949d9),
|
||||
};
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/hashes/whirl/whirltab.c,v $ */
|
||||
/* $Revision: 1.2 $ */
|
||||
/* $Date: 2005/05/05 14:35:58 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -16,8 +16,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* version */
|
||||
#define CRYPT 0x0116
|
||||
#define SCRYPT "1.16"
|
||||
#define CRYPT 0x0117
|
||||
#define SCRYPT "1.17"
|
||||
|
||||
/* max size of either a cipher/hash block or symmetric key [largest of the two] */
|
||||
#define MAXBLOCKSIZE 128
|
||||
@@ -83,6 +83,6 @@ enum {
|
||||
#endif /* TOMCRYPT_H_ */
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt.h,v $ */
|
||||
/* $Revision: 1.20 $ */
|
||||
/* $Date: 2006/11/26 01:45:14 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -41,6 +41,6 @@ void crypt_argchk(char *v, char *s, int d) ATTRIB_NORETURN;
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_argchk.h,v $ */
|
||||
/* $Revision: 1.5 $ */
|
||||
/* $Date: 2006/08/27 20:50:21 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -131,6 +131,6 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cfg.h,v $ */
|
||||
/* $Revision: 1.19 $ */
|
||||
/* $Date: 2006/12/04 02:19:48 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -3,41 +3,41 @@
|
||||
* We put each of the ciphers scheduled keys in their own structs then we put all of
|
||||
* the key formats in one union. This makes the function prototypes easier to use.
|
||||
*/
|
||||
#ifdef BLOWFISH
|
||||
#ifdef LTC_BLOWFISH
|
||||
struct blowfish_key {
|
||||
ulong32 S[4][256];
|
||||
ulong32 K[18];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef RC5
|
||||
#ifdef LTC_RC5
|
||||
struct rc5_key {
|
||||
int rounds;
|
||||
ulong32 K[50];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef RC6
|
||||
#ifdef LTC_RC6
|
||||
struct rc6_key {
|
||||
ulong32 K[44];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SAFERP
|
||||
#ifdef LTC_SAFERP
|
||||
struct saferp_key {
|
||||
unsigned char K[33][16];
|
||||
long rounds;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef RIJNDAEL
|
||||
#ifdef LTC_RIJNDAEL
|
||||
struct rijndael_key {
|
||||
ulong32 eK[60], dK[60];
|
||||
int Nr;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef KSEED
|
||||
#ifdef LTC_KSEED
|
||||
struct kseed_key {
|
||||
ulong32 K[32], dK[32];
|
||||
};
|
||||
@@ -51,14 +51,14 @@ struct kasumi_key {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef XTEA
|
||||
#ifdef LTC_XTEA
|
||||
struct xtea_key {
|
||||
unsigned long A[32], B[32];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef TWOFISH
|
||||
#ifndef TWOFISH_SMALL
|
||||
#ifdef LTC_TWOFISH
|
||||
#ifndef LTC_TWOFISH_SMALL
|
||||
struct twofish_key {
|
||||
ulong32 S[4][256], K[40];
|
||||
};
|
||||
@@ -70,24 +70,24 @@ struct xtea_key {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef SAFER
|
||||
#define SAFER_K64_DEFAULT_NOF_ROUNDS 6
|
||||
#define SAFER_K128_DEFAULT_NOF_ROUNDS 10
|
||||
#define SAFER_SK64_DEFAULT_NOF_ROUNDS 8
|
||||
#define SAFER_SK128_DEFAULT_NOF_ROUNDS 10
|
||||
#define SAFER_MAX_NOF_ROUNDS 13
|
||||
#define SAFER_BLOCK_LEN 8
|
||||
#define SAFER_KEY_LEN (1 + SAFER_BLOCK_LEN * (1 + 2 * SAFER_MAX_NOF_ROUNDS))
|
||||
typedef unsigned char safer_block_t[SAFER_BLOCK_LEN];
|
||||
typedef unsigned char safer_key_t[SAFER_KEY_LEN];
|
||||
#ifdef LTC_SAFER
|
||||
#define LTC_SAFER_K64_DEFAULT_NOF_ROUNDS 6
|
||||
#define LTC_SAFER_K128_DEFAULT_NOF_ROUNDS 10
|
||||
#define LTC_SAFER_SK64_DEFAULT_NOF_ROUNDS 8
|
||||
#define LTC_SAFER_SK128_DEFAULT_NOF_ROUNDS 10
|
||||
#define LTC_SAFER_MAX_NOF_ROUNDS 13
|
||||
#define LTC_SAFER_BLOCK_LEN 8
|
||||
#define LTC_SAFER_KEY_LEN (1 + LTC_SAFER_BLOCK_LEN * (1 + 2 * LTC_SAFER_MAX_NOF_ROUNDS))
|
||||
typedef unsigned char safer_block_t[LTC_SAFER_BLOCK_LEN];
|
||||
typedef unsigned char safer_key_t[LTC_SAFER_KEY_LEN];
|
||||
struct safer_key { safer_key_t key; };
|
||||
#endif
|
||||
|
||||
#ifdef RC2
|
||||
#ifdef LTC_RC2
|
||||
struct rc2_key { unsigned xkey[64]; };
|
||||
#endif
|
||||
|
||||
#ifdef DES
|
||||
#ifdef LTC_DES
|
||||
struct des_key {
|
||||
ulong32 ek[32], dk[32];
|
||||
};
|
||||
@@ -97,32 +97,32 @@ struct des3_key {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CAST5
|
||||
#ifdef LTC_CAST5
|
||||
struct cast5_key {
|
||||
ulong32 K[32], keylen;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef NOEKEON
|
||||
#ifdef LTC_NOEKEON
|
||||
struct noekeon_key {
|
||||
ulong32 K[4], dK[4];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SKIPJACK
|
||||
#ifdef LTC_SKIPJACK
|
||||
struct skipjack_key {
|
||||
unsigned char key[10];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef KHAZAD
|
||||
#ifdef LTC_KHAZAD
|
||||
struct khazad_key {
|
||||
ulong64 roundKeyEnc[8 + 1];
|
||||
ulong64 roundKeyDec[8 + 1];
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef ANUBIS
|
||||
#ifdef LTC_ANUBIS
|
||||
struct anubis_key {
|
||||
int keyBits;
|
||||
int R;
|
||||
@@ -131,59 +131,69 @@ struct anubis_key {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef LTC_MULTI2
|
||||
struct multi2_key {
|
||||
int N;
|
||||
ulong32 uk[8];
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef union Symmetric_key {
|
||||
#ifdef DES
|
||||
#ifdef LTC_DES
|
||||
struct des_key des;
|
||||
struct des3_key des3;
|
||||
#endif
|
||||
#ifdef RC2
|
||||
#ifdef LTC_RC2
|
||||
struct rc2_key rc2;
|
||||
#endif
|
||||
#ifdef SAFER
|
||||
#ifdef LTC_SAFER
|
||||
struct safer_key safer;
|
||||
#endif
|
||||
#ifdef TWOFISH
|
||||
#ifdef LTC_TWOFISH
|
||||
struct twofish_key twofish;
|
||||
#endif
|
||||
#ifdef BLOWFISH
|
||||
#ifdef LTC_BLOWFISH
|
||||
struct blowfish_key blowfish;
|
||||
#endif
|
||||
#ifdef RC5
|
||||
#ifdef LTC_RC5
|
||||
struct rc5_key rc5;
|
||||
#endif
|
||||
#ifdef RC6
|
||||
#ifdef LTC_RC6
|
||||
struct rc6_key rc6;
|
||||
#endif
|
||||
#ifdef SAFERP
|
||||
#ifdef LTC_SAFERP
|
||||
struct saferp_key saferp;
|
||||
#endif
|
||||
#ifdef RIJNDAEL
|
||||
#ifdef LTC_RIJNDAEL
|
||||
struct rijndael_key rijndael;
|
||||
#endif
|
||||
#ifdef XTEA
|
||||
#ifdef LTC_XTEA
|
||||
struct xtea_key xtea;
|
||||
#endif
|
||||
#ifdef CAST5
|
||||
#ifdef LTC_CAST5
|
||||
struct cast5_key cast5;
|
||||
#endif
|
||||
#ifdef NOEKEON
|
||||
#ifdef LTC_NOEKEON
|
||||
struct noekeon_key noekeon;
|
||||
#endif
|
||||
#ifdef SKIPJACK
|
||||
#ifdef LTC_SKIPJACK
|
||||
struct skipjack_key skipjack;
|
||||
#endif
|
||||
#ifdef KHAZAD
|
||||
#ifdef LTC_KHAZAD
|
||||
struct khazad_key khazad;
|
||||
#endif
|
||||
#ifdef ANUBIS
|
||||
#ifdef LTC_ANUBIS
|
||||
struct anubis_key anubis;
|
||||
#endif
|
||||
#ifdef KSEED
|
||||
#ifdef LTC_KSEED
|
||||
struct kseed_key kseed;
|
||||
#endif
|
||||
#ifdef LTC_KASUMI
|
||||
struct kasumi_key kasumi;
|
||||
#endif
|
||||
#ifdef LTC_MULTI2
|
||||
struct multi2_key multi2;
|
||||
#endif
|
||||
void *data;
|
||||
} symmetric_key;
|
||||
|
||||
@@ -257,8 +267,11 @@ typedef struct {
|
||||
blocklen,
|
||||
/** The padding offset */
|
||||
padlen,
|
||||
/** The mode (endianess) of the CTR, 0==little, 1==big */
|
||||
mode;
|
||||
/** The mode (endianess) of the CTR, 0==little, 1==big */
|
||||
mode,
|
||||
/** counter width */
|
||||
ctrlen;
|
||||
|
||||
/** The counter */
|
||||
unsigned char ctr[MAXBLOCKSIZE],
|
||||
/** The pad used to encrypt/decrypt */
|
||||
@@ -488,7 +501,7 @@ extern struct ltc_cipher_descriptor {
|
||||
unsigned char *tag, unsigned long *taglen,
|
||||
int direction);
|
||||
|
||||
/** Accelerated one shot OMAC
|
||||
/** Accelerated one shot LTC_OMAC
|
||||
@param key The secret key
|
||||
@param keylen The key length (octets)
|
||||
@param in The message
|
||||
@@ -532,7 +545,7 @@ extern struct ltc_cipher_descriptor {
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
} cipher_descriptor[];
|
||||
|
||||
#ifdef BLOWFISH
|
||||
#ifdef LTC_BLOWFISH
|
||||
int blowfish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int blowfish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int blowfish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -542,7 +555,7 @@ int blowfish_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor blowfish_desc;
|
||||
#endif
|
||||
|
||||
#ifdef RC5
|
||||
#ifdef LTC_RC5
|
||||
int rc5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int rc5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int rc5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -552,7 +565,7 @@ int rc5_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor rc5_desc;
|
||||
#endif
|
||||
|
||||
#ifdef RC6
|
||||
#ifdef LTC_RC6
|
||||
int rc6_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int rc6_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int rc6_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -562,7 +575,7 @@ int rc6_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor rc6_desc;
|
||||
#endif
|
||||
|
||||
#ifdef RC2
|
||||
#ifdef LTC_RC2
|
||||
int rc2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int rc2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int rc2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -572,7 +585,7 @@ int rc2_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor rc2_desc;
|
||||
#endif
|
||||
|
||||
#ifdef SAFERP
|
||||
#ifdef LTC_SAFERP
|
||||
int saferp_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int saferp_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int saferp_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -582,7 +595,7 @@ int saferp_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor saferp_desc;
|
||||
#endif
|
||||
|
||||
#ifdef SAFER
|
||||
#ifdef LTC_SAFER
|
||||
int safer_k64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int safer_sk64_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int safer_k128_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
@@ -598,7 +611,7 @@ int safer_128_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor safer_k64_desc, safer_k128_desc, safer_sk64_desc, safer_sk128_desc;
|
||||
#endif
|
||||
|
||||
#ifdef RIJNDAEL
|
||||
#ifdef LTC_RIJNDAEL
|
||||
|
||||
/* make aes an alias */
|
||||
#define aes_setup rijndael_setup
|
||||
@@ -626,7 +639,7 @@ extern const struct ltc_cipher_descriptor rijndael_desc, aes_desc;
|
||||
extern const struct ltc_cipher_descriptor rijndael_enc_desc, aes_enc_desc;
|
||||
#endif
|
||||
|
||||
#ifdef XTEA
|
||||
#ifdef LTC_XTEA
|
||||
int xtea_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int xtea_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int xtea_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -636,7 +649,7 @@ int xtea_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor xtea_desc;
|
||||
#endif
|
||||
|
||||
#ifdef TWOFISH
|
||||
#ifdef LTC_TWOFISH
|
||||
int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int twofish_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int twofish_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -646,7 +659,7 @@ int twofish_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor twofish_desc;
|
||||
#endif
|
||||
|
||||
#ifdef DES
|
||||
#ifdef LTC_DES
|
||||
int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -662,7 +675,7 @@ int des3_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor des_desc, des3_desc;
|
||||
#endif
|
||||
|
||||
#ifdef CAST5
|
||||
#ifdef LTC_CAST5
|
||||
int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int cast5_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int cast5_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -672,7 +685,7 @@ int cast5_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor cast5_desc;
|
||||
#endif
|
||||
|
||||
#ifdef NOEKEON
|
||||
#ifdef LTC_NOEKEON
|
||||
int noekeon_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int noekeon_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int noekeon_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -682,7 +695,7 @@ int noekeon_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor noekeon_desc;
|
||||
#endif
|
||||
|
||||
#ifdef SKIPJACK
|
||||
#ifdef LTC_SKIPJACK
|
||||
int skipjack_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int skipjack_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int skipjack_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -692,7 +705,7 @@ int skipjack_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor skipjack_desc;
|
||||
#endif
|
||||
|
||||
#ifdef KHAZAD
|
||||
#ifdef LTC_KHAZAD
|
||||
int khazad_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int khazad_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int khazad_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -702,7 +715,7 @@ int khazad_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor khazad_desc;
|
||||
#endif
|
||||
|
||||
#ifdef ANUBIS
|
||||
#ifdef LTC_ANUBIS
|
||||
int anubis_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int anubis_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int anubis_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -712,7 +725,7 @@ int anubis_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor anubis_desc;
|
||||
#endif
|
||||
|
||||
#ifdef KSEED
|
||||
#ifdef LTC_KSEED
|
||||
int kseed_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int kseed_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int kseed_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
@@ -732,6 +745,17 @@ int kasumi_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor kasumi_desc;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LTC_MULTI2
|
||||
int multi2_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
|
||||
int multi2_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
|
||||
int multi2_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
|
||||
int multi2_test(void);
|
||||
void multi2_done(symmetric_key *skey);
|
||||
int multi2_keysize(int *keysize);
|
||||
extern const struct ltc_cipher_descriptor multi2_desc;
|
||||
#endif
|
||||
|
||||
#ifdef LTC_ECB_MODE
|
||||
int ecb_start(int cipher, const unsigned char *key,
|
||||
int keylen, int num_rounds, symmetric_ECB *ecb);
|
||||
@@ -772,9 +796,9 @@ int cbc_done(symmetric_CBC *cbc);
|
||||
|
||||
#ifdef LTC_CTR_MODE
|
||||
|
||||
#define CTR_COUNTER_LITTLE_ENDIAN 0
|
||||
#define CTR_COUNTER_BIG_ENDIAN 1
|
||||
#define LTC_CTR_RFC3686 2
|
||||
#define CTR_COUNTER_LITTLE_ENDIAN 0x0000
|
||||
#define CTR_COUNTER_BIG_ENDIAN 0x1000
|
||||
#define LTC_CTR_RFC3686 0x2000
|
||||
|
||||
int ctr_start( int cipher,
|
||||
const unsigned char *IV,
|
||||
@@ -824,6 +848,34 @@ int f8_done(symmetric_F8 *f8);
|
||||
int f8_test_mode(void);
|
||||
#endif
|
||||
|
||||
#ifdef LTC_XTS_MODE
|
||||
typedef struct {
|
||||
symmetric_key key1, key2;
|
||||
int cipher;
|
||||
} symmetric_xts;
|
||||
|
||||
int xts_start( int cipher,
|
||||
const unsigned char *key1,
|
||||
const unsigned char *key2,
|
||||
unsigned long keylen,
|
||||
int num_rounds,
|
||||
symmetric_xts *xts);
|
||||
|
||||
int xts_encrypt(
|
||||
const unsigned char *pt, unsigned long ptlen,
|
||||
unsigned char *ct,
|
||||
const unsigned char *tweak,
|
||||
symmetric_xts *xts);
|
||||
int xts_decrypt(
|
||||
const unsigned char *ct, unsigned long ptlen,
|
||||
unsigned char *pt,
|
||||
const unsigned char *tweak,
|
||||
symmetric_xts *xts);
|
||||
|
||||
void xts_done(symmetric_xts *xts);
|
||||
int xts_test(void);
|
||||
void xts_mult_x(unsigned char *I);
|
||||
#endif
|
||||
|
||||
int find_cipher(const char *name);
|
||||
int find_cipher_any(const char *name, int blocklen, int keylen);
|
||||
@@ -834,6 +886,6 @@ int cipher_is_valid(int idx);
|
||||
|
||||
LTC_MUTEX_PROTO(ltc_cipher_mutex)
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cipher.h,v $ */
|
||||
/* $Revision: 1.46 $ */
|
||||
/* $Date: 2006/11/13 23:09:38 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -80,6 +80,13 @@ void m_free_direct(void* ptr);
|
||||
#endif
|
||||
/* These spit out warnings etc */
|
||||
#define LTC_NO_ROLC
|
||||
#ifndef XQSORT
|
||||
#ifdef qsort
|
||||
#define LTC_NO_PROTOTYPES
|
||||
#endif
|
||||
#define XQSORT qsort
|
||||
#endif
|
||||
|
||||
|
||||
/* Enable self-test test vector checking */
|
||||
/* Not for dropbear */
|
||||
@@ -102,25 +109,27 @@ void m_free_direct(void* ptr);
|
||||
|
||||
|
||||
#ifdef DROPBEAR_BLOWFISH
|
||||
#define BLOWFISH
|
||||
#define LTC_BLOWFISH
|
||||
#endif
|
||||
|
||||
#ifdef DROPBEAR_AES
|
||||
#define RIJNDAEL
|
||||
#define LTC_RIJNDAEL
|
||||
#endif
|
||||
|
||||
#ifdef DROPBEAR_TWOFISH
|
||||
#define TWOFISH
|
||||
#define LTC_TWOFISH
|
||||
|
||||
/* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format
|
||||
* (saves 4KB of ram), _ALL_TABLES enables all tables during setup */
|
||||
/* enabling just TWOFISH_SMALL will make the binary ~1kB smaller, turning on
|
||||
* TWOFISH_TABLES will make it a few kB bigger, but perhaps reduces runtime
|
||||
* memory usage? */
|
||||
#define TWOFISH_SMALL
|
||||
/*#define TWOFISH_TABLES*/
|
||||
#define LTC_TWOFISH_SMALL
|
||||
/*#define LTC_TWOFISH_TABLES*/
|
||||
#endif
|
||||
|
||||
#ifdef DROPBEAR_3DES
|
||||
#define DES
|
||||
#define LTC_DES
|
||||
#endif
|
||||
|
||||
#define LTC_CBC_MODE
|
||||
@@ -129,26 +138,26 @@ void m_free_direct(void* ptr);
|
||||
#define LTC_CTR_MODE
|
||||
#endif
|
||||
|
||||
#define SHA1
|
||||
#define LTC_SHA1
|
||||
|
||||
#ifdef DROPBEAR_MD5
|
||||
#define MD5
|
||||
#define LTC_MD5
|
||||
#endif
|
||||
|
||||
#ifdef DROPBEAR_SHA256
|
||||
#define SHA256
|
||||
#define LTC_SHA256
|
||||
#endif
|
||||
#ifdef DROPBEAR_SHA384
|
||||
#define SHA384
|
||||
#define LTC_SHA384
|
||||
#endif
|
||||
#ifdef DROPBEAR_SHA512
|
||||
#define SHA512
|
||||
#define LTC_SHA512
|
||||
#endif
|
||||
|
||||
#define LTC_HMAC
|
||||
|
||||
#ifdef DROPBEAR_ECC
|
||||
#define MECC
|
||||
#define LTC_MECC
|
||||
#define LTC_ECC_SHAMIR
|
||||
#define LTC_ECC_TIMING_RESISTANT
|
||||
#define MPI
|
||||
@@ -165,7 +174,7 @@ void m_free_direct(void* ptr);
|
||||
#endif
|
||||
|
||||
/* Various tidbits of modern neatoness */
|
||||
#define BASE64
|
||||
#define LTC_BASE64
|
||||
|
||||
/* default no pthread functions */
|
||||
#define LTC_MUTEX_GLOBAL(x)
|
||||
@@ -178,13 +187,13 @@ void m_free_direct(void* ptr);
|
||||
|
||||
/* Debuggers */
|
||||
|
||||
/* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and RC4 work (see the code) */
|
||||
/* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */
|
||||
/* #define LTC_VALGRIND */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_custom.h,v $ */
|
||||
/* $Revision: 1.66 $ */
|
||||
/* $Date: 2006/12/04 02:50:11 $ */
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user