Go to the documentation of this file.
27 #ifndef POLARSSL_RSA_H
28 #define POLARSSL_RSA_H
35 #define POLARSSL_ERR_RSA_BAD_INPUT_DATA -0x4080
36 #define POLARSSL_ERR_RSA_INVALID_PADDING -0x4100
37 #define POLARSSL_ERR_RSA_KEY_GEN_FAILED -0x4180
38 #define POLARSSL_ERR_RSA_KEY_CHECK_FAILED -0x4200
39 #define POLARSSL_ERR_RSA_PUBLIC_FAILED -0x4280
40 #define POLARSSL_ERR_RSA_PRIVATE_FAILED -0x4300
41 #define POLARSSL_ERR_RSA_VERIFY_FAILED -0x4380
42 #define POLARSSL_ERR_RSA_OUTPUT_TOO_LARGE -0x4400
43 #define POLARSSL_ERR_RSA_RNG_FAILED -0x4480
52 #define SIG_RSA_SHA1 5
53 #define SIG_RSA_SHA224 14
54 #define SIG_RSA_SHA256 11
55 #define SIG_RSA_SHA384 12
56 #define SIG_RSA_SHA512 13
61 #define RSA_PKCS_V15 0
62 #define RSA_PKCS_V21 1
67 #define ASN1_STR_CONSTRUCTED_SEQUENCE "\x30"
68 #define ASN1_STR_NULL "\x05"
69 #define ASN1_STR_OID "\x06"
70 #define ASN1_STR_OCTET_STRING "\x04"
72 #define OID_DIGEST_ALG_MDX "\x2A\x86\x48\x86\xF7\x0D\x02\x00"
73 #define OID_HASH_ALG_SHA1 "\x2b\x0e\x03\x02\x1a"
74 #define OID_HASH_ALG_SHA2X "\x60\x86\x48\x01\x65\x03\x04\x02\x00"
76 #define OID_ISO_MEMBER_BODIES "\x2a"
77 #define OID_ISO_IDENTIFIED_ORG "\x2b"
82 #define OID_COUNTRY_US "\x86\x48"
83 #define OID_RSA_DATA_SECURITY "\x86\xf7\x0d"
88 #define OID_OIW_SECSIG_SHA1 "\x0e\x03\x02\x1a"
99 #define ASN1_HASH_MDX \
101 ASN1_STR_CONSTRUCTED_SEQUENCE "\x20" \
102 ASN1_STR_CONSTRUCTED_SEQUENCE "\x0C" \
103 ASN1_STR_OID "\x08" \
105 ASN1_STR_NULL "\x00" \
106 ASN1_STR_OCTET_STRING "\x10" \
109 #define ASN1_HASH_SHA1 \
110 ASN1_STR_CONSTRUCTED_SEQUENCE "\x21" \
111 ASN1_STR_CONSTRUCTED_SEQUENCE "\x09" \
112 ASN1_STR_OID "\x05" \
114 ASN1_STR_NULL "\x00" \
115 ASN1_STR_OCTET_STRING "\x14"
117 #define ASN1_HASH_SHA2X \
118 ASN1_STR_CONSTRUCTED_SEQUENCE "\x11" \
119 ASN1_STR_CONSTRUCTED_SEQUENCE "\x0d" \
120 ASN1_STR_OID "\x09" \
122 ASN1_STR_NULL "\x00" \
123 ASN1_STR_OCTET_STRING "\x00"
189 int (*f_rng)(
void *,
unsigned char *,
size_t),
191 unsigned int nbits,
int exponent );
228 const unsigned char *input,
229 unsigned char *output );
244 const unsigned char *input,
245 unsigned char *output );
264 int (*f_rng)(
void *,
unsigned char *,
size_t),
266 int mode,
size_t ilen,
267 const unsigned char *input,
268 unsigned char *output );
287 int mode,
size_t *olen,
288 const unsigned char *input,
289 unsigned char *output,
290 size_t output_max_len );
317 int (*f_rng)(
void *,
unsigned char *,
size_t),
321 unsigned int hashlen,
322 const unsigned char *hash,
323 unsigned char *sig );
350 unsigned int hashlen,
351 const unsigned char *hash,
352 unsigned char *sig );