added libtomcrypt-1.03
This commit is contained in:
committed by
Steffen Jaeckel
parent
65c1317eee
commit
3964a6523a
@@ -575,3 +575,7 @@ extern const char *mp_s_rmap;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -16,8 +16,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* version */
|
||||
#define CRYPT 0x0102
|
||||
#define SCRYPT "1.02"
|
||||
#define CRYPT 0x0103
|
||||
#define SCRYPT "1.03"
|
||||
|
||||
/* max size of either a cipher/hash block or symmetric key [largest of the two] */
|
||||
#define MAXBLOCKSIZE 128
|
||||
@@ -79,3 +79,7 @@ enum {
|
||||
|
||||
#endif /* TOMCRYPT_H_ */
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -19,3 +19,7 @@ void crypt_argchk(char *v, char *s, int d);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -106,3 +106,7 @@ int XMEMCMP(const void *s1, const void *s2, size_t n);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -32,7 +32,7 @@ struct saferp_key {
|
||||
|
||||
#ifdef RIJNDAEL
|
||||
struct rijndael_key {
|
||||
ulong32 eK[64], dK[64];
|
||||
ulong32 eK[60], dK[60];
|
||||
int Nr;
|
||||
};
|
||||
#endif
|
||||
@@ -599,8 +599,15 @@ int cbc_done(symmetric_CBC *cbc);
|
||||
#endif
|
||||
|
||||
#ifdef CTR
|
||||
int ctr_start(int cipher, const unsigned char *IV, const unsigned char *key,
|
||||
int keylen, int num_rounds, symmetric_CTR *ctr);
|
||||
|
||||
#define CTR_COUNTER_LITTLE_ENDIAN 0
|
||||
#define CTR_COUNTER_BIG_ENDIAN 1
|
||||
|
||||
int ctr_start( int cipher,
|
||||
const unsigned char *IV,
|
||||
const unsigned char *key, int keylen,
|
||||
int num_rounds, int ctr_mode,
|
||||
symmetric_CTR *ctr);
|
||||
int ctr_encrypt(const unsigned char *pt, unsigned char *ct, unsigned long len, symmetric_CTR *ctr);
|
||||
int ctr_decrypt(const unsigned char *ct, unsigned char *pt, unsigned long len, symmetric_CTR *ctr);
|
||||
int ctr_getiv(unsigned char *IV, unsigned long *len, symmetric_CTR *ctr);
|
||||
@@ -617,3 +624,7 @@ int unregister_cipher(const struct ltc_cipher_descriptor *cipher);
|
||||
|
||||
int cipher_is_valid(int idx);
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/* This header is meant to be included before mycrypt.h in projects where
|
||||
* you don't want to throw all the defines in a makefile.
|
||||
*/
|
||||
#ifndef TOMCRYPT_CUSTOM_H_
|
||||
#define TOMCRYPT_CUSTOM_H_
|
||||
|
||||
@@ -20,7 +17,9 @@
|
||||
/* #define LTC_SMALL_CODE */
|
||||
|
||||
/* Enable self-test test vector checking */
|
||||
#define LTC_TEST
|
||||
#ifndef LTC_NO_TEST
|
||||
#define LTC_TEST
|
||||
#endif
|
||||
|
||||
/* clean the stack of functions which put private information on stack */
|
||||
/* #define LTC_CLEAN_STACK */
|
||||
@@ -38,6 +37,8 @@
|
||||
/* #define LTC_NO_BSWAP */
|
||||
|
||||
/* ---> Symmetric Block Ciphers <--- */
|
||||
#ifndef LTC_NO_CIPHERS
|
||||
|
||||
#define BLOWFISH
|
||||
#define RC2
|
||||
#define RC5
|
||||
@@ -48,8 +49,12 @@
|
||||
/* _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 */
|
||||
#define TWOFISH
|
||||
#define TWOFISH_TABLES
|
||||
/* #define TWOFISH_ALL_TABLES */
|
||||
#ifndef LTC_NO_TABLES
|
||||
#define TWOFISH_TABLES
|
||||
/* #define TWOFISH_ALL_TABLES */
|
||||
#else
|
||||
#define TWOFISH_SMALL
|
||||
#endif
|
||||
/* #define TWOFISH_SMALL */
|
||||
/* DES includes EDE triple-DES */
|
||||
#define DES
|
||||
@@ -61,15 +66,23 @@
|
||||
#define ANUBIS
|
||||
#define ANUBIS_TWEAK
|
||||
|
||||
#endif /* LTC_NO_CIPHERS */
|
||||
|
||||
|
||||
/* ---> Block Cipher Modes of Operation <--- */
|
||||
#ifndef LTC_NO_MODES
|
||||
|
||||
#define CFB
|
||||
#define OFB
|
||||
#define ECB
|
||||
#define CBC
|
||||
#define CTR
|
||||
|
||||
#endif /* LTC_NO_MODES */
|
||||
|
||||
/* ---> One-Way Hash Functions <--- */
|
||||
#ifndef LTC_NO_HASHES
|
||||
|
||||
#define CHC_HASH
|
||||
#define WHIRLPOOL
|
||||
#define SHA512
|
||||
@@ -84,7 +97,11 @@
|
||||
#define RIPEMD128
|
||||
#define RIPEMD160
|
||||
|
||||
#endif /* LTC_NO_HASHES */
|
||||
|
||||
/* ---> MAC functions <--- */
|
||||
#ifndef LTC_NO_MACS
|
||||
|
||||
#define HMAC
|
||||
#define OMAC
|
||||
#define PMAC
|
||||
@@ -95,6 +112,7 @@
|
||||
#endif
|
||||
|
||||
/* ---> Encrypt + Authenticate Modes <--- */
|
||||
|
||||
#define EAX_MODE
|
||||
#if defined(EAX_MODE) && !(defined(CTR) && defined(OMAC))
|
||||
#error EAX_MODE requires CTR and OMAC mode
|
||||
@@ -104,13 +122,20 @@
|
||||
#define CCM_MODE
|
||||
|
||||
#define GCM_MODE
|
||||
|
||||
/* Use 64KiB tables */
|
||||
#define GCM_TABLES
|
||||
#ifndef LTC_NO_TABLES
|
||||
#define GCM_TABLES
|
||||
#endif
|
||||
|
||||
#endif /* LTC_NO_MACS */
|
||||
|
||||
/* Various tidbits of modern neatoness */
|
||||
#define BASE64
|
||||
|
||||
/* --> Pseudo Random Number Generators <--- */
|
||||
#ifndef LTC_NO_PRNGS
|
||||
|
||||
/* Yarrow */
|
||||
#define YARROW
|
||||
/* which descriptor of AES to use? */
|
||||
@@ -142,7 +167,11 @@
|
||||
/* try /dev/urandom before trying /dev/random */
|
||||
#define TRY_URANDOM_FIRST
|
||||
|
||||
#endif /* LTC_NO_PRNGS */
|
||||
|
||||
/* ---> Public Key Crypto <--- */
|
||||
#ifndef LTC_NO_PK
|
||||
|
||||
#define MRSA
|
||||
|
||||
/* Digital Signature Algorithm */
|
||||
@@ -168,7 +197,6 @@
|
||||
/* ECC */
|
||||
#define MECC
|
||||
/* Supported Key Sizes */
|
||||
#define ECC160
|
||||
#define ECC192
|
||||
#define ECC224
|
||||
#define ECC256
|
||||
@@ -178,7 +206,11 @@
|
||||
/* Include the MPI functionality? (required by the PK algorithms) */
|
||||
#define MPI
|
||||
|
||||
#endif /* LTC_NO_PK */
|
||||
|
||||
/* PKCS #1 (RSA) and #5 (Password Handling) stuff */
|
||||
#ifndef LTC_NO_PKCS
|
||||
|
||||
#define PKCS_1
|
||||
#define PKCS_5
|
||||
|
||||
@@ -192,5 +224,11 @@
|
||||
#error RSA/DSA requires ASN.1 DER functionality, make sure LTC_DER is enabled
|
||||
#endif
|
||||
|
||||
#endif /* LTC_NO_PKCS */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
+24
-19
@@ -132,10 +132,11 @@ extern struct ltc_hash_descriptor {
|
||||
unsigned long hashsize;
|
||||
/** Input block size in octets */
|
||||
unsigned long blocksize;
|
||||
/** ASN.1 DER identifier */
|
||||
unsigned char DER[64];
|
||||
/** ASN.1 OID */
|
||||
unsigned long OID[16];
|
||||
/** Length of DER encoding */
|
||||
unsigned long DERlen;
|
||||
unsigned long OIDlen;
|
||||
|
||||
/** Init a hash state
|
||||
@param hash The hash to initialize
|
||||
@return CRYPT_OK if successful
|
||||
@@ -292,29 +293,29 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
|
||||
{ \
|
||||
unsigned long n; \
|
||||
int err; \
|
||||
LTC_ARGCHK(md != NULL); \
|
||||
LTC_ARGCHK(in != NULL); \
|
||||
LTC_ARGCHK(md != NULL); \
|
||||
LTC_ARGCHK(in != NULL); \
|
||||
if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
|
||||
return CRYPT_INVALID_ARG; \
|
||||
} \
|
||||
while (inlen > 0) { \
|
||||
if (md-> state_var .curlen == 0 && inlen >= block_size) { \
|
||||
if ((err = compress_name (md, (unsigned char *)in)) != CRYPT_OK) { \
|
||||
return err; \
|
||||
} \
|
||||
while (inlen > 0) { \
|
||||
if (md-> state_var .curlen == 0 && inlen >= block_size) { \
|
||||
if ((err = compress_name (md, (unsigned char *)in)) != CRYPT_OK) { \
|
||||
return err; \
|
||||
} \
|
||||
md-> state_var .length += block_size * 8; \
|
||||
in += block_size; \
|
||||
inlen -= block_size; \
|
||||
in += block_size; \
|
||||
inlen -= block_size; \
|
||||
} else { \
|
||||
n = MIN(inlen, (block_size - md-> state_var .curlen)); \
|
||||
memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
|
||||
n = MIN(inlen, (block_size - md-> state_var .curlen)); \
|
||||
memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
|
||||
md-> state_var .curlen += n; \
|
||||
in += n; \
|
||||
inlen -= n; \
|
||||
in += n; \
|
||||
inlen -= n; \
|
||||
if (md-> state_var .curlen == block_size) { \
|
||||
if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) {\
|
||||
return err; \
|
||||
} \
|
||||
if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \
|
||||
return err; \
|
||||
} \
|
||||
md-> state_var .length += 8*block_size; \
|
||||
md-> state_var .curlen = 0; \
|
||||
} \
|
||||
@@ -322,3 +323,7 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
|
||||
} \
|
||||
return CRYPT_OK; \
|
||||
}
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -295,3 +295,7 @@ int pelican_memory(const unsigned char *key, unsigned long keylen,
|
||||
unsigned char *out);
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -132,7 +132,7 @@ asm __volatile__ ( \
|
||||
#ifdef ENDIAN_32BITWORD
|
||||
|
||||
#define STORE32L(x, y) \
|
||||
{ unsigned long __t = (x); memcpy(y, &__t, 4); }
|
||||
{ ulong32 __t = (x); memcpy(y, &__t, 4); }
|
||||
|
||||
#define LOAD32L(x, y) \
|
||||
memcpy(&(x), y, 4);
|
||||
@@ -152,7 +152,7 @@ asm __volatile__ ( \
|
||||
#else /* 64-bit words then */
|
||||
|
||||
#define STORE32L(x, y) \
|
||||
{ unsigned long __t = (x); memcpy(y, &__t, 4); }
|
||||
{ ulong32 __t = (x); memcpy(y, &__t, 4); }
|
||||
|
||||
#define LOAD32L(x, y) \
|
||||
{ memcpy(&(x), y, 4); x &= 0xFFFFFFFF; }
|
||||
@@ -193,7 +193,7 @@ asm __volatile__ ( \
|
||||
#ifdef ENDIAN_32BITWORD
|
||||
|
||||
#define STORE32H(x, y) \
|
||||
{ unsigned long __t = (x); memcpy(y, &__t, 4); }
|
||||
{ ulong32 __t = (x); memcpy(y, &__t, 4); }
|
||||
|
||||
#define LOAD32H(x, y) \
|
||||
memcpy(&(x), y, 4);
|
||||
@@ -213,7 +213,7 @@ asm __volatile__ ( \
|
||||
#else /* 64-bit words then */
|
||||
|
||||
#define STORE32H(x, y) \
|
||||
{ unsigned long __t = (x); memcpy(y, &__t, 4); }
|
||||
{ ulong32 __t = (x); memcpy(y, &__t, 4); }
|
||||
|
||||
#define LOAD32H(x, y) \
|
||||
{ memcpy(&(x), y, 4); x &= 0xFFFFFFFF; }
|
||||
@@ -371,3 +371,7 @@ static inline unsigned long ROR64c(unsigned long word, const int i)
|
||||
#else
|
||||
#define byte(x, n) (((x) >> (8 * (n))) & 255)
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -15,3 +15,7 @@ const char *error_to_string(int err);
|
||||
int mpi_to_ltc_error(int err);
|
||||
|
||||
extern const char *crypt_build_settings;
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
+107
-26
@@ -84,9 +84,6 @@ int packet_valid_header(unsigned char *src, int section, int subsection);
|
||||
#define MIN_RSA_SIZE 1024
|
||||
#define MAX_RSA_SIZE 4096
|
||||
|
||||
/* Stack required for temps (plus padding) */
|
||||
// #define RSA_STACK (8 + (MAX_RSA_SIZE/8))
|
||||
|
||||
typedef struct Rsa_key {
|
||||
int type;
|
||||
mp_int e, d, N, p, q, qP, dP, dQ;
|
||||
@@ -123,26 +120,6 @@ int rsa_verify_hash(const unsigned char *sig, unsigned long siglen,
|
||||
int hash_idx, unsigned long saltlen,
|
||||
int *stat, rsa_key *key);
|
||||
|
||||
/* these use PKCS #1 v1.5 padding */
|
||||
int rsa_v15_encrypt_key(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen,
|
||||
prng_state *prng, int prng_idx,
|
||||
rsa_key *key);
|
||||
|
||||
int rsa_v15_decrypt_key(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long outlen,
|
||||
int *stat, rsa_key *key);
|
||||
|
||||
int rsa_v15_sign_hash(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *siglen,
|
||||
int hash_idx, rsa_key *key);
|
||||
|
||||
int rsa_v15_verify_hash(const unsigned char *sig, unsigned long siglen,
|
||||
const unsigned char *hash, unsigned long hashlen,
|
||||
int hash_idx, int *stat,
|
||||
rsa_key *key);
|
||||
|
||||
|
||||
/* PKCS #1 import/export */
|
||||
int rsa_export(unsigned char *out, unsigned long *outlen, int type, rsa_key *key);
|
||||
int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key);
|
||||
@@ -244,10 +221,19 @@ typedef struct {
|
||||
int dsa_make_key(prng_state *prng, int wprng, int group_size, int modulus_size, dsa_key *key);
|
||||
void dsa_free(dsa_key *key);
|
||||
|
||||
|
||||
int dsa_sign_hash_raw(const unsigned char *in, unsigned long inlen,
|
||||
mp_int *r, mp_int *s,
|
||||
prng_state *prng, int wprng, dsa_key *key);
|
||||
|
||||
int dsa_sign_hash(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen,
|
||||
prng_state *prng, int wprng, dsa_key *key);
|
||||
|
||||
int dsa_verify_hash_raw( mp_int *r, mp_int *s,
|
||||
const unsigned char *hash, unsigned long hashlen,
|
||||
int *stat, dsa_key *key);
|
||||
|
||||
int dsa_verify_hash(const unsigned char *sig, unsigned long siglen,
|
||||
const unsigned char *hash, unsigned long hashlen,
|
||||
int *stat, dsa_key *key);
|
||||
@@ -262,9 +248,104 @@ int dsa_verify_key(dsa_key *key, int *stat);
|
||||
|
||||
#ifdef LTC_DER
|
||||
/* DER handling */
|
||||
|
||||
enum {
|
||||
LTC_ASN1_EOL,
|
||||
LTC_ASN1_INTEGER,
|
||||
LTC_ASN1_SHORT_INTEGER,
|
||||
LTC_ASN1_BIT_STRING,
|
||||
LTC_ASN1_OCTET_STRING,
|
||||
LTC_ASN1_NULL,
|
||||
LTC_ASN1_OBJECT_IDENTIFIER,
|
||||
LTC_ASN1_IA5_STRING,
|
||||
LTC_ASN1_PRINTABLE_STRING,
|
||||
|
||||
LTC_ASN1_SEQUENCE
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
void *data;
|
||||
unsigned long size;
|
||||
} ltc_asn1_list;
|
||||
|
||||
#define LTC_SET_ASN1(list, index, Type, Data, Size) \
|
||||
do { \
|
||||
int LTC_MACRO_temp = (index); \
|
||||
ltc_asn1_list *LTC_MACRO_list = (list); \
|
||||
LTC_MACRO_list[LTC_MACRO_temp].type = (Type); \
|
||||
LTC_MACRO_list[LTC_MACRO_temp].data = (Data); \
|
||||
LTC_MACRO_list[LTC_MACRO_temp].size = (Size); \
|
||||
} while (0);
|
||||
|
||||
/* SEQUENCE */
|
||||
int der_encode_sequence(ltc_asn1_list *list, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
|
||||
int der_decode_sequence(const unsigned char *in, unsigned long inlen,
|
||||
ltc_asn1_list *list, unsigned long outlen);
|
||||
|
||||
int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
|
||||
unsigned long *outlen);
|
||||
|
||||
/* VA list handy helpers */
|
||||
int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...);
|
||||
int der_decode_sequence_multi(const unsigned char *in, unsigned long inlen, ...);
|
||||
|
||||
/* INTEGER */
|
||||
int der_encode_integer(mp_int *num, unsigned char *out, unsigned long *outlen);
|
||||
int der_decode_integer(const unsigned char *in, unsigned long *inlen, mp_int *num);
|
||||
int der_decode_integer(const unsigned char *in, unsigned long inlen, mp_int *num);
|
||||
int der_length_integer(mp_int *num, unsigned long *len);
|
||||
int der_put_multi_integer(unsigned char *dst, unsigned long *outlen, mp_int *num, ...);
|
||||
int der_get_multi_integer(const unsigned char *src, unsigned long *inlen, mp_int *num, ...);
|
||||
|
||||
/* INTEGER -- handy for 0..2^32-1 values */
|
||||
int der_decode_short_integer(const unsigned char *in, unsigned long inlen, unsigned long *num);
|
||||
int der_encode_short_integer(unsigned long num, unsigned char *out, unsigned long *outlen);
|
||||
int der_length_short_integer(unsigned long num, unsigned long *outlen);
|
||||
|
||||
/* BIT STRING */
|
||||
int der_encode_bit_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_decode_bit_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_length_bit_string(unsigned long nbits, unsigned long *outlen);
|
||||
|
||||
/* OCTET STRING */
|
||||
int der_encode_octet_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_decode_octet_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_length_octet_string(unsigned long noctets, unsigned long *outlen);
|
||||
|
||||
/* OBJECT IDENTIFIER */
|
||||
int der_encode_object_identifier(unsigned long *words, unsigned long nwords,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_decode_object_identifier(const unsigned char *in, unsigned long inlen,
|
||||
unsigned long *words, unsigned long *outlen);
|
||||
int der_length_object_identifier(unsigned long *words, unsigned long nwords, unsigned long *outlen);
|
||||
unsigned long der_object_identifier_bits(unsigned long x);
|
||||
|
||||
/* IA5 STRING */
|
||||
int der_encode_ia5_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_decode_ia5_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_length_ia5_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen);
|
||||
|
||||
int der_ia5_char_encode(int c);
|
||||
int der_ia5_value_decode(int v);
|
||||
|
||||
/* Printable STRING */
|
||||
int der_encode_printable_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_decode_printable_string(const unsigned char *in, unsigned long inlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int der_length_printable_string(const unsigned char *octets, unsigned long noctets, unsigned long *outlen);
|
||||
|
||||
int der_printable_char_encode(int c);
|
||||
int der_printable_value_decode(int v);
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -10,7 +10,7 @@ int pkcs_1_mgf1(const unsigned char *seed, unsigned long seedlen,
|
||||
int pkcs_1_i2osp(mp_int *n, unsigned long modulus_len, unsigned char *out);
|
||||
int pkcs_1_os2ip(mp_int *n, unsigned char *in, unsigned long inlen);
|
||||
|
||||
/* *** v2.0 padding */
|
||||
/* *** v2.1 padding */
|
||||
int pkcs_1_oaep_encode(const unsigned char *msg, unsigned long msglen,
|
||||
const unsigned char *lparam, unsigned long lparamlen,
|
||||
unsigned long modulus_bitlen, prng_state *prng,
|
||||
@@ -34,32 +34,6 @@ int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen,
|
||||
unsigned long saltlen, int hash_idx,
|
||||
unsigned long modulus_bitlen, int *res);
|
||||
|
||||
/* *** v1.5 padding */
|
||||
/* encryption padding */
|
||||
int pkcs_1_v15_es_encode(const unsigned char *msg, unsigned long msglen,
|
||||
unsigned long modulus_bitlen,
|
||||
prng_state *prng, int prng_idx,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
|
||||
/* note "outlen" is fixed, you have to tell this decoder how big
|
||||
* the original message was. Unlike the OAEP decoder it cannot auto-detect it.
|
||||
*/
|
||||
int pkcs_1_v15_es_decode(const unsigned char *msg, unsigned long msglen,
|
||||
unsigned long modulus_bitlen,
|
||||
unsigned char *out, unsigned long outlen,
|
||||
int *res);
|
||||
|
||||
/* signature padding */
|
||||
int pkcs_1_v15_sa_encode(const unsigned char *msghash, unsigned long msghashlen,
|
||||
int hash_idx, unsigned long modulus_bitlen,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
|
||||
int pkcs_1_v15_sa_decode(const unsigned char *msghash, unsigned long msghashlen,
|
||||
const unsigned char *sig, unsigned long siglen,
|
||||
int hash_idx, unsigned long modulus_bitlen,
|
||||
int *res);
|
||||
|
||||
|
||||
#endif /* PKCS_1 */
|
||||
|
||||
/* ===> PKCS #5 -- Password Based Cryptography <=== */
|
||||
@@ -78,3 +52,7 @@ int pkcs_5_alg2(const unsigned char *password, unsigned long password_len,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
|
||||
#endif /* PKCS_5 */
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -188,3 +188,7 @@ unsigned long rng_get_bytes(unsigned char *out,
|
||||
|
||||
int rng_make_prng(int bits, int wprng, prng_state *prng, void (*callback)(void));
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -992,3 +992,7 @@
|
||||
#else
|
||||
#define LTM_LAST
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
/* super class file for PK algos */
|
||||
|
||||
/* default ... include all MPI */
|
||||
#ifndef SC_RSA_1
|
||||
|
||||
#define LTM_ALL
|
||||
|
||||
#endif
|
||||
|
||||
/* RSA only (does not support DH/DSA/ECC) */
|
||||
// #define SC_RSA_1
|
||||
/* #define SC_RSA_1 */
|
||||
|
||||
/* For reference.... On an Athlon64 optimizing for speed...
|
||||
|
||||
@@ -70,3 +74,7 @@
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
||||
|
||||
Reference in New Issue
Block a user