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_SHA1_ALT \
118 ASN1_STR_CONSTRUCTED_SEQUENCE "\x1F" \
119 ASN1_STR_CONSTRUCTED_SEQUENCE "\x07" \
120 ASN1_STR_OID "\x05" \
122 ASN1_STR_OCTET_STRING "\x14"
124 #define ASN1_HASH_SHA2X \
125 ASN1_STR_CONSTRUCTED_SEQUENCE "\x11" \
126 ASN1_STR_CONSTRUCTED_SEQUENCE "\x0d" \
127 ASN1_STR_OID "\x09" \
129 ASN1_STR_NULL "\x00" \
130 ASN1_STR_OCTET_STRING "\x00"
199 int (*f_rng)(
void *,
unsigned char *,
size_t),
201 unsigned int nbits,
int exponent );
238 const unsigned char *input,
239 unsigned char *output );
254 const unsigned char *input,
255 unsigned char *output );
276 int (*f_rng)(
void *,
unsigned char *,
size_t),
278 int mode,
size_t ilen,
279 const unsigned char *input,
280 unsigned char *output );
299 int (*f_rng)(
void *,
unsigned char *,
size_t),
301 int mode,
size_t ilen,
302 const unsigned char *input,
303 unsigned char *output );
324 int (*f_rng)(
void *,
unsigned char *,
size_t),
327 const unsigned char *label,
size_t label_len,
329 const unsigned char *input,
330 unsigned char *output );
351 int mode,
size_t *olen,
352 const unsigned char *input,
353 unsigned char *output,
354 size_t output_max_len );
373 int mode,
size_t *olen,
374 const unsigned char *input,
375 unsigned char *output,
376 size_t output_max_len );
398 const unsigned char *label,
size_t label_len,
400 const unsigned char *input,
401 unsigned char *output,
402 size_t output_max_len );
431 int (*f_rng)(
void *,
unsigned char *,
size_t),
435 unsigned int hashlen,
436 const unsigned char *hash,
437 unsigned char *sig );
458 unsigned int hashlen,
459 const unsigned char *hash,
460 unsigned char *sig );
487 int (*f_rng)(
void *,
unsigned char *,
size_t),
491 unsigned int hashlen,
492 const unsigned char *hash,
493 unsigned char *sig );
522 unsigned int hashlen,
523 const unsigned char *hash,
524 unsigned char *sig );
545 unsigned int hashlen,
546 const unsigned char *hash,
547 unsigned char *sig );
575 unsigned int hashlen,
576 const unsigned char *hash,
577 unsigned char *sig );