TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tomcrypt_pkcs.h
Go to the documentation of this file.
1 /* LTC_PKCS Header Info */
2 
3 /* ===> LTC_PKCS #1 -- RSA Cryptography <=== */
4 #ifdef LTC_PKCS_1
5 
6 enum ltc_pkcs_1_v1_5_blocks
7 {
8  LTC_LTC_PKCS_1_EMSA = 1, /* Block type 1 (LTC_PKCS #1 v1.5 signature padding) */
9  LTC_LTC_PKCS_1_EME = 2 /* Block type 2 (LTC_PKCS #1 v1.5 encryption padding) */
10 };
11 
12 enum ltc_pkcs_1_paddings
13 {
14  LTC_LTC_PKCS_1_V1_5 = 1, /* LTC_PKCS #1 v1.5 padding (\sa ltc_pkcs_1_v1_5_blocks) */
15  LTC_LTC_PKCS_1_OAEP = 2, /* LTC_PKCS #1 v2.0 encryption padding */
16  LTC_LTC_PKCS_1_PSS = 3 /* LTC_PKCS #1 v2.1 signature padding */
17 };
18 
19 int pkcs_1_mgf1( int hash_idx,
20  const unsigned char *seed, unsigned long seedlen,
21  unsigned char *mask, unsigned long masklen);
22 
23 int pkcs_1_i2osp(void *n, unsigned long modulus_len, unsigned char *out);
24 int pkcs_1_os2ip(void *n, unsigned char *in, unsigned long inlen);
25 
26 /* *** v1.5 padding */
27 int pkcs_1_v1_5_encode(const unsigned char *msg,
28  unsigned long msglen,
29  int block_type,
30  unsigned long modulus_bitlen,
31  prng_state *prng,
32  int prng_idx,
33  unsigned char *out,
34  unsigned long *outlen);
35 
36 int pkcs_1_v1_5_decode(const unsigned char *msg,
37  unsigned long msglen,
38  int block_type,
39  unsigned long modulus_bitlen,
40  unsigned char *out,
41  unsigned long *outlen,
42  int *is_valid);
43 
44 /* *** v2.1 padding */
45 int pkcs_1_oaep_encode(const unsigned char *msg, unsigned long msglen,
46  const unsigned char *lparam, unsigned long lparamlen,
47  unsigned long modulus_bitlen, prng_state *prng,
48  int prng_idx, int hash_idx,
49  unsigned char *out, unsigned long *outlen);
50 
51 int pkcs_1_oaep_decode(const unsigned char *msg, unsigned long msglen,
52  const unsigned char *lparam, unsigned long lparamlen,
53  unsigned long modulus_bitlen, int hash_idx,
54  unsigned char *out, unsigned long *outlen,
55  int *res);
56 
57 int pkcs_1_pss_encode(const unsigned char *msghash, unsigned long msghashlen,
58  unsigned long saltlen, prng_state *prng,
59  int prng_idx, int hash_idx,
60  unsigned long modulus_bitlen,
61  unsigned char *out, unsigned long *outlen);
62 
63 int pkcs_1_pss_decode(const unsigned char *msghash, unsigned long msghashlen,
64  const unsigned char *sig, unsigned long siglen,
65  unsigned long saltlen, int hash_idx,
66  unsigned long modulus_bitlen, int *res);
67 
68 #endif /* LTC_PKCS_1 */
69 
70 /* ===> LTC_PKCS #5 -- Password Based Cryptography <=== */
71 #ifdef LTC_PKCS_5
72 
73 /* Algorithm #1 (old) */
74 int pkcs_5_alg1(const unsigned char *password, unsigned long password_len,
75  const unsigned char *salt,
76  int iteration_count, int hash_idx,
77  unsigned char *out, unsigned long *outlen);
78 
79 /* Algorithm #2 (new) */
80 int pkcs_5_alg2(const unsigned char *password, unsigned long password_len,
81  const unsigned char *salt, unsigned long salt_len,
82  int iteration_count, int hash_idx,
83  unsigned char *out, unsigned long *outlen);
84 
85 #endif /* LTC_PKCS_5 */
86 
87 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_pkcs.h,v $ */
88 /* $Revision: 1.8 $ */
89 /* $Date: 2007/05/12 14:32:35 $ */
bool is_valid(octet_iterator start, octet_iterator end)
Definition: core.h:300
Definition: tomcrypt_prng.h:50