]>
Dogcows Code - chaz/p5-File-KDBX-XS/blob - tomcrypt_pkcs.h
a0aa8920423801cdce092d240164052e821018ce
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
6 /* ===> PKCS #1 -- RSA Cryptography <=== */
9 enum ltc_pkcs_1_v1_5_blocks
11 LTC_PKCS_1_EMSA
= 1, /* Block type 1 (PKCS #1 v1.5 signature padding) */
12 LTC_PKCS_1_EME
= 2 /* Block type 2 (PKCS #1 v1.5 encryption padding) */
15 enum ltc_pkcs_1_paddings
17 LTC_PKCS_1_V1_5
= 1, /* PKCS #1 v1.5 padding (\sa ltc_pkcs_1_v1_5_blocks) */
18 LTC_PKCS_1_OAEP
= 2, /* PKCS #1 v2.0 encryption padding */
19 LTC_PKCS_1_PSS
= 3, /* PKCS #1 v2.1 signature padding */
20 LTC_PKCS_1_V1_5_NA1
= 4 /* PKCS #1 v1.5 padding - No ASN.1 (\sa ltc_pkcs_1_v1_5_blocks) */
23 int pkcs_1_mgf1( int hash_idx
,
24 const unsigned char *seed
, unsigned long seedlen
,
25 unsigned char *mask
, unsigned long masklen
);
27 int pkcs_1_i2osp(void *n
, unsigned long modulus_len
, unsigned char *out
);
28 int pkcs_1_os2ip(void *n
, unsigned char *in
, unsigned long inlen
);
30 /* *** v1.5 padding */
31 int pkcs_1_v1_5_encode(const unsigned char *msg
,
34 unsigned long modulus_bitlen
,
38 unsigned long *outlen
);
40 int pkcs_1_v1_5_decode(const unsigned char *msg
,
43 unsigned long modulus_bitlen
,
45 unsigned long *outlen
,
48 /* *** v2.1 padding */
49 int pkcs_1_oaep_encode(const unsigned char *msg
, unsigned long msglen
,
50 const unsigned char *lparam
, unsigned long lparamlen
,
51 unsigned long modulus_bitlen
, prng_state
*prng
,
52 int prng_idx
, int hash_idx
,
53 unsigned char *out
, unsigned long *outlen
);
55 int pkcs_1_oaep_decode(const unsigned char *msg
, unsigned long msglen
,
56 const unsigned char *lparam
, unsigned long lparamlen
,
57 unsigned long modulus_bitlen
, int hash_idx
,
58 unsigned char *out
, unsigned long *outlen
,
61 int pkcs_1_pss_encode(const unsigned char *msghash
, unsigned long msghashlen
,
62 unsigned long saltlen
, prng_state
*prng
,
63 int prng_idx
, int hash_idx
,
64 unsigned long modulus_bitlen
,
65 unsigned char *out
, unsigned long *outlen
);
67 int pkcs_1_pss_decode(const unsigned char *msghash
, unsigned long msghashlen
,
68 const unsigned char *sig
, unsigned long siglen
,
69 unsigned long saltlen
, int hash_idx
,
70 unsigned long modulus_bitlen
, int *res
);
72 #endif /* LTC_PKCS_1 */
74 /* ===> PKCS #5 -- Password Based Cryptography <=== */
77 /* Algorithm #1 (PBKDF1) */
78 int pkcs_5_alg1(const unsigned char *password
, unsigned long password_len
,
79 const unsigned char *salt
,
80 int iteration_count
, int hash_idx
,
81 unsigned char *out
, unsigned long *outlen
);
83 /* Algorithm #1 (PBKDF1) - OpenSSL-compatible variant for arbitrarily-long keys.
84 Compatible with EVP_BytesToKey() */
85 int pkcs_5_alg1_openssl(const unsigned char *password
,
86 unsigned long password_len
,
87 const unsigned char *salt
,
88 int iteration_count
, int hash_idx
,
89 unsigned char *out
, unsigned long *outlen
);
91 /* Algorithm #2 (PBKDF2) */
92 int pkcs_5_alg2(const unsigned char *password
, unsigned long password_len
,
93 const unsigned char *salt
, unsigned long salt_len
,
94 int iteration_count
, int hash_idx
,
95 unsigned char *out
, unsigned long *outlen
);
97 int pkcs_5_test (void);
98 #endif /* LTC_PKCS_5 */
This page took 0.035112 seconds and 3 git commands to generate.