summaryrefslogtreecommitdiff
path: root/src/ltc/headers/tomcrypt_pk.h
diff options
context:
space:
mode:
authorKarel Miko <miko@dcit.cz>2014-05-12 09:20:41 +0200
committerKarel Miko <miko@dcit.cz>2014-05-12 09:20:41 +0200
commit6546b2a3a26aa8aa8dbab61394c530219d877a19 (patch)
tree9df9185adcc0035a0dffc1739edc60969cf54d7d /src/ltc/headers/tomcrypt_pk.h
parent0547bb02e27962e7db7b5b49257ed9c2b1f0a33a (diff)
parent1261beeaf3da18238d00a0a63a065791b232b1ec (diff)
merge master
Diffstat (limited to 'src/ltc/headers/tomcrypt_pk.h')
-rw-r--r--src/ltc/headers/tomcrypt_pk.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/ltc/headers/tomcrypt_pk.h b/src/ltc/headers/tomcrypt_pk.h
index 68cf34ba..939f1e19 100644
--- a/src/ltc/headers/tomcrypt_pk.h
+++ b/src/ltc/headers/tomcrypt_pk.h
@@ -38,7 +38,7 @@ int pk_get_oid(int pk, oid_st *st);
#define MIN_RSA_SIZE 1024
#define MAX_RSA_SIZE 4096
-/** RSA LTC_PKCS style key */
+/** RSA PKCS style key */
typedef struct Rsa_key {
/** Type of key, PK_PRIVATE or PK_PUBLIC */
int type;
@@ -62,13 +62,15 @@ typedef struct Rsa_key {
int rsa_make_key(prng_state *prng, int wprng, int size, long e, rsa_key *key);
+int rsa_get_size(rsa_key *key);
+
int rsa_exptmod(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen, int which,
rsa_key *key);
void rsa_free(rsa_key *key);
-/* These use LTC_PKCS #1 v2.0 padding */
+/* These use PKCS #1 v2.0 padding */
#define rsa_encrypt_key(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, _key) \
rsa_encrypt_key_ex(_in, _inlen, _out, _outlen, _lparam, _lparamlen, _prng, _prng_idx, _hash_idx, LTC_PKCS_1_OAEP, _key)
@@ -81,7 +83,10 @@ void rsa_free(rsa_key *key);
#define rsa_verify_hash(_sig, _siglen, _hash, _hashlen, _hash_idx, _saltlen, _stat, _key) \
rsa_verify_hash_ex(_sig, _siglen, _hash, _hashlen, LTC_PKCS_1_PSS, _hash_idx, _saltlen, _stat, _key)
-/* These can be switched between LTC_PKCS #1 v2.x and LTC_PKCS #1 v1.5 paddings */
+#define rsa_sign_saltlen_get_max(_hash_idx, _key) \
+ rsa_sign_saltlen_get_max_ex(LTC_PKCS_1_PSS, _hash_idx, _key)
+
+/* These can be switched between PKCS #1 v2.x and PKCS #1 v1.5 paddings */
int rsa_encrypt_key_ex(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
const unsigned char *lparam, unsigned long lparamlen,
@@ -106,7 +111,9 @@ int rsa_verify_hash_ex(const unsigned char *sig, unsigned long siglen,
int hash_idx, unsigned long saltlen,
int *stat, rsa_key *key);
-/* LTC_PKCS #1 import/export */
+int rsa_sign_saltlen_get_max_ex(int padding, int hash_idx, 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);
@@ -119,7 +126,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key);
#define MIN_KAT_SIZE 1024
#define MAX_KAT_SIZE 4096
-/** Katja LTC_PKCS style key */
+/** Katja PKCS style key */
typedef struct KAT_key {
/** Type of key, PK_PRIVATE or PK_PUBLIC */
int type;
@@ -149,7 +156,7 @@ int katja_exptmod(const unsigned char *in, unsigned long inlen,
void katja_free(katja_key *key);
-/* These use LTC_PKCS #1 v2.0 padding */
+/* These use PKCS #1 v2.0 padding */
int katja_encrypt_key(const unsigned char *in, unsigned long inlen,
unsigned char *out, unsigned long *outlen,
const unsigned char *lparam, unsigned long lparamlen,
@@ -161,14 +168,14 @@ int katja_decrypt_key(const unsigned char *in, unsigned long inlen,
int hash_idx, int *stat,
katja_key *key);
-/* LTC_PKCS #1 import/export */
+/* PKCS #1 import/export */
int katja_export(unsigned char *out, unsigned long *outlen, int type, katja_key *key);
int katja_import(const unsigned char *in, unsigned long inlen, katja_key *key);
#endif
/* ---- DH Routines ---- */
-#ifdef MDH
+#ifdef LTC_MDH
typedef struct Dh_key {
int idx, type;
@@ -339,7 +346,7 @@ int ltc_ecc_is_valid_idx(int n);
int ltc_ecc_is_point(const ltc_ecc_set_type *dp, void *x, void *y);
/* point ops (mp == montgomery digit) */
-#if !defined(LTC_MECC_ACCEL) || defined(LTM_LTC_DESC) || defined(GMP_LTC_DESC)
+#if !defined(LTC_MECC_ACCEL) || defined(LTM_DESC) || defined(GMP_DESC)
/* R = 2P */
int ltc_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *a, void *modulus, void *mp);
@@ -520,8 +527,10 @@ int der_decode_sequence_ex(const unsigned char *in, unsigned long inlen,
#define der_decode_sequence(in, inlen, list, outlen) der_decode_sequence_ex(in, inlen, list, outlen, 1)
-int der_length_sequence(ltc_asn1_list *list, unsigned long inlen, unsigned long *outlen);
-int der_length_sequence_ex(ltc_asn1_list *list, unsigned long inlen, unsigned long *outlen, unsigned long *payloadlen);
+int der_length_sequence(ltc_asn1_list *list, unsigned long inlen,
+ unsigned long *outlen);
+int der_length_sequence_ex(ltc_asn1_list *list, unsigned long inlen,
+ unsigned long *outlen, unsigned long *payloadlen);
/* SUBJECT PUBLIC KEY INFO */
int der_encode_subject_public_key_info(unsigned char *out, unsigned long *outlen,