|
| | FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
| | FILE_SECBOOT (PERMITTED) |
| static struct rsa_digestinfo_prefix * | rsa_find_prefix (struct digest_algorithm *digest) |
| | Identify RSA prefix.
|
| static void | rsa_free (struct rsa_context *context) |
| | Free RSA dynamic storage.
|
| static int | rsa_alloc (struct rsa_context *context, size_t modulus_len, size_t exponent_len) |
| | Allocate RSA dynamic storage.
|
| static int | rsa_parse_mod_exp (struct asn1_cursor *modulus, struct asn1_cursor *exponent, const struct asn1_cursor *raw) |
| | Parse RSA modulus and exponent.
|
| static int | rsa_init (struct rsa_context *context, const struct asn1_cursor *key) |
| | Initialise RSA cipher.
|
| static void | rsa_cipher (struct rsa_context *context, const void *in, void *out) |
| | Perform RSA cipher operation.
|
| static int | rsa_pkcs1_encrypt (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext) |
| | Encrypt using RSA PKCS#1.
|
| static int | rsa_pkcs1_decrypt (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext) |
| | Decrypt using RSA PKCS#1.
|
| static int | rsa_pkcs1_encode (struct rsa_context *context, struct digest_algorithm *digest, const void *value, const void *reference __unused, void *encoded) |
| | Encode digest using RSA PKCS#1.
|
| static void | rsa_xor_mask (struct digest_algorithm *digest, void *ctx, void *out, const void *seed, void *xor, size_t len) |
| | Apply RSA PSS mask generation function.
|
| static int | rsa_pss_encode (struct rsa_context *context, struct digest_algorithm *digest, const void *value, const void *reference, void *encoded) |
| | Encode digest using RSA PSS.
|
| static int | rsa_sign (struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature) |
| | Sign digest value using RSA.
|
| static int | rsa_verify (struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature) |
| | Verify signed digest value using RSA.
|
| static int | rsa_match (struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key) |
| | Check for matching RSA public/private key pair.
|
| | REQUIRING_SYMBOL (rsa_algorithm) |
| | REQUIRE_OBJECT (config_crypto) |
RSA public-key cryptography.
RSA is documented in RFC 3447 and updated in RFC 8017.
Definition in file rsa.c.
Allocate RSA dynamic storage.
- Parameters
-
| context | RSA context |
| modulus_len | Modulus length |
| exponent_len | Exponent length |
- Return values
-
Definition at line 130 of file rsa.c.
131 {
136 struct {
138 bigint_t ( exponent_size ) exponent;
143
144
145 dynamic =
malloc (
sizeof ( *dynamic ) );
146 if ( ! dynamic )
148
149
151 context->
modulus0 = &dynamic->modulus.element[0];
153 context->
max_len = modulus_len;
154 context->
exponent0 = &dynamic->exponent.element[0];
156 context->
input0 = &dynamic->input.element[0];
157 context->
output0 = &dynamic->output.element[0];
158 context->
tmp = &dynamic->tmp;
159
160 return 0;
161}
uint16_t size
Buffer size.
#define ENOMEM
Not enough space.
#define bigint_mod_exp_tmp_len(modulus)
Calculate temporary working space required for moduluar exponentiation.
#define bigint_t(size)
Define a big-integer type.
#define bigint_required_size(len)
Determine number of elements required for a big-integer type.
void * malloc(size_t size)
Allocate memory.
bigint_element_t * exponent0
Exponent.
bigint_element_t * input0
Input buffer.
void * tmp
Temporary working space for modular exponentiation.
bigint_element_t * modulus0
Modulus.
unsigned int exponent_size
Exponent size.
bigint_element_t * output0
Output buffer.
size_t max_len
Modulus length.
unsigned int size
Modulus size.
References __attribute__, bigint_mod_exp_tmp_len, bigint_required_size, bigint_t, rsa_context::dynamic, ENOMEM, rsa_context::exponent0, rsa_context::exponent_size, rsa_context::input0, malloc(), rsa_context::max_len, rsa_context::modulus0, rsa_context::output0, rsa_context::size, size, rsa_context::tmp, and tmp.
Referenced by rsa_init().
Parse RSA modulus and exponent.
- Parameters
-
| modulus | Modulus to fill in |
| exponent | Exponent to fill in |
| raw | ASN.1 cursor |
- Return values
-
Definition at line 171 of file rsa.c.
173 {
175 int is_private;
177
178
179 memcpy ( &cursor,
raw,
sizeof ( cursor ) );
181
182
184
185
186 is_private = 1;
187
188
190
191
194
195
197
198
200
201
203
204
206 }
207
208 } else {
209
210
211 is_private = 0;
212
213
215
216
218
219
221 }
222
223
224 memcpy ( modulus, &cursor,
sizeof ( *modulus ) );
228
229
230 if ( is_private )
232
233
234 memcpy ( exponent, &cursor,
sizeof ( *exponent ) );
237
238 return 0;
239}
struct arbelprm_rc_send_wqe rc
int asn1_enter_unsigned(struct asn1_cursor *cursor)
Enter ASN.1 unsigned integer.
int asn1_skip_any(struct asn1_cursor *cursor)
Skip ASN.1 object of any type.
int asn1_check_algorithm(const struct asn1_cursor *cursor, struct asn1_algorithm *expected, struct asn1_cursor *params)
Check ASN.1 OID-identified algorithm.
int asn1_enter(struct asn1_cursor *cursor, unsigned int type)
Enter ASN.1 object.
int asn1_skip(struct asn1_cursor *cursor, unsigned int type)
Skip ASN.1 object.
int asn1_enter_bits(struct asn1_cursor *cursor, unsigned int *unused)
Enter ASN.1 bit string.
#define ASN1_INTEGER
ASN.1 integer.
#define ASN1_SEQUENCE
ASN.1 sequence.
#define ASN1_OCTET_STRING
ASN.1 octet string.
static unsigned int asn1_type(const struct asn1_cursor *cursor)
Extract ASN.1 type.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
References asn1_check_algorithm(), asn1_enter(), asn1_enter_bits(), asn1_enter_unsigned(), ASN1_INTEGER, ASN1_OCTET_STRING, ASN1_SEQUENCE, asn1_skip(), asn1_skip_any(), asn1_type(), memcpy(), NULL, raw, and rc.
Referenced by rsa_init(), and rsa_match().
Initialise RSA cipher.
- Parameters
-
| context | RSA context |
| key | Key |
- Return values
-
Definition at line 248 of file rsa.c.
249 {
254
255
256 memset ( context, 0,
sizeof ( *context ) );
257
258
260 DBGC ( context,
"RSA %p invalid modulus/exponent:\n", context );
262 goto err_parse;
263 }
264
265 DBGC ( context,
"RSA %p modulus:\n", context );
266 DBGC_HDA ( context, 0, modulus.data, modulus.len );
267 DBGC ( context,
"RSA %p exponent:\n", context );
268 DBGC_HDA ( context, 0, exponent.data, exponent.len );
269
270
271 msb = *( (
const uint8_t * ) modulus.data );
272 if ( ! msb ) {
273 DBGC ( context,
"RSA %p invalid modulus MSB\n", context );
275 goto err_msb;
276 }
277 context->
mask = ( ( 1 << (
fls ( msb ) - 1 ) ) - 1 );
278
279
280 if ( (
rc =
rsa_alloc ( context, modulus.len, exponent.len ) ) != 0 )
281 goto err_alloc;
282
283
285 modulus.data, modulus.len );
287 context->
exponent0 ), exponent.data, exponent.len );
288
289 return 0;
290
292 err_alloc:
293 err_msb:
294 err_parse:
296}
union @162305117151260234136356364136041353210355154177 key
#define EINVAL
Invalid argument.
#define bigint_init(value, data, len)
Initialise big integer.
void * memset(void *dest, int character, size_t len) __nonnull
#define fls(x)
Find last (i.e.
static void rsa_free(struct rsa_context *context)
Free RSA dynamic storage.
static int rsa_parse_mod_exp(struct asn1_cursor *modulus, struct asn1_cursor *exponent, const struct asn1_cursor *raw)
Parse RSA modulus and exponent.
static int rsa_alloc(struct rsa_context *context, size_t modulus_len, size_t exponent_len)
Allocate RSA dynamic storage.
uint8_t mask
Modulus MSB mask.
References bigint_init, bigint_t, asn1_cursor::data, DBGC, DBGC_HDA, EINVAL, rsa_context::exponent0, rsa_context::exponent_size, fls, key, asn1_cursor::len, rsa_context::mask, memset(), rsa_context::modulus0, rc, rsa_alloc(), rsa_free(), rsa_parse_mod_exp(), and rsa_context::size.
Referenced by rsa_pkcs1_decrypt(), rsa_pkcs1_encrypt(), rsa_sign(), and rsa_verify().
| void rsa_cipher |
( |
struct rsa_context * | context, |
|
|
const void * | in, |
|
|
void * | out ) |
|
static |
Perform RSA cipher operation.
- Parameters
-
| context | RSA context |
| in | Input buffer |
| out | Output buffer |
Definition at line 305 of file rsa.c.
306 {
312
313
315
316
318
319
321}
#define bigint_mod_exp(base, modulus, exponent, result, tmp)
Perform modular exponentiation of big integers.
#define bigint_done(value, out, len)
Finalise big integer.
References bigint_done, bigint_init, bigint_mod_exp, bigint_t, rsa_context::exponent0, rsa_context::exponent_size, in, rsa_context::input0, rsa_context::max_len, rsa_context::modulus0, out, rsa_context::output0, rsa_context::size, and rsa_context::tmp.
Referenced by rsa_pkcs1_decrypt(), rsa_pkcs1_encrypt(), rsa_sign(), and rsa_verify().
Encrypt using RSA PKCS#1.
- Parameters
-
| pubkey | Public-key algorithm |
| key | Key |
| plaintext | Plaintext |
| ciphertext | Ciphertext |
- Return values
-
| ciphertext_len | Length of ciphertext, or negative error |
Definition at line 332 of file rsa.c.
335 {
337 void *temp;
339 size_t min_len;
340 size_t pad_len;
342
343 DBGC ( &context,
"RSA %p encrypting:\n", &context );
345
346
348 goto err_init;
349
350
351 min_len = ( 1 + 1 + 8
352 + 1 + plaintext->
len );
353 if ( min_len > context.max_len ) {
354 DBGC ( &context,
"RSA %p modulus too small for %zd-byte "
355 "plaintext\n", &context, plaintext->
len );
356 goto err_sanity;
357 }
358 pad_len = ( 8 + context.max_len - min_len );
359
360
361
362
363 temp = context.output0;
364 encoded = temp;
365 encoded[0] = 0x00;
366 encoded[1] = 0x02;
368 DBGC ( &context,
"RSA %p could not generate random data: %s\n",
370 goto err_random;
371 }
372 encoded[ 2 + pad_len ] = 0x00;
373 memcpy ( &encoded[ context.max_len - plaintext->
len ],
374 plaintext->
data, plaintext->
len );
375 DBGC ( &context,
"RSA %p encoded:\n", &context );
376 DBGC_HDA ( &context, 0, encoded, context.max_len );
377
378
379 if ( (
rc =
asn1_grow ( ciphertext, context.max_len ) ) != 0 )
380 goto err_grow;
381
382
384 DBGC ( &context,
"RSA %p encrypted:\n", &context );
385 DBGC_HDA ( &context, 0, ciphertext->
data, context.max_len );
386
387
389
390 return 0;
391
392 err_grow:
393 err_random:
394 err_sanity:
396 err_init:
398}
int asn1_grow(struct asn1_builder *builder, size_t extra)
Grow ASN.1 builder.
int(* rsa_get_random)(void *data, size_t len)
Generate random data.
static int rsa_init(struct rsa_context *context, const struct asn1_cursor *key)
Initialise RSA cipher.
static void rsa_cipher(struct rsa_context *context, const void *in, void *out)
Perform RSA cipher operation.
char * strerror(int errno)
Retrieve string representation of error number.
const void * data
Start of data.
size_t len
Length of data.
References __unused, asn1_grow(), asn1_builder::data, asn1_cursor::data, DBGC, DBGC_HDA, key, asn1_cursor::len, rsa_context::max_len, memcpy(), rsa_context::output0, rc, rsa_cipher(), rsa_free(), rsa_get_random, rsa_init(), and strerror().
Decrypt using RSA PKCS#1.
- Parameters
-
| pubkey | Public-key algorithm |
| key | Key |
| ciphertext | Ciphertext |
| plaintext | Plaintext |
- Return values
-
Definition at line 409 of file rsa.c.
412 {
414 void *temp;
421
422 DBGC ( &context,
"RSA %p decrypting:\n", &context );
424
425
427 goto err_init;
428
429
430 if ( ciphertext->
len != context.max_len ) {
431 DBGC ( &context,
"RSA %p ciphertext incorrect length (%zd "
432 "bytes, should be %zd)\n",
433 &context, ciphertext->
len, context.max_len );
435 goto err_sanity;
436 }
437
438
439
440
441 temp = context.input0;
442 encoded = temp;
444 DBGC ( &context,
"RSA %p encoded:\n", &context );
445 DBGC_HDA ( &context, 0, encoded, context.max_len );
446
447
448 end = ( encoded + context.max_len );
449 if ( ( encoded[0] != 0x00 ) || ( encoded[1] != 0x02 ) ) {
451 goto err_invalid;
452 }
453 zero =
memchr ( &encoded[2], 0, (
end - &encoded[2] ) );
454 if ( ! zero ) {
455 DBGC ( &context,
"RSA %p invalid decrypted message:\n",
456 &context );
457 DBGC_HDA ( &context, 0, encoded, context.max_len );
459 goto err_invalid;
460 }
461 start = ( zero + 1 );
463
464
466 goto err_grow;
467
468
470 DBGC ( &context,
"RSA %p decrypted:\n", &context );
472
473
475
476 return 0;
477
478 err_grow:
479 err_invalid:
480 err_sanity:
482 err_init:
484}
uint32_t start
Starting offset.
#define ERANGE
Result too large.
uint32_t end
Ending offset.
void * memchr(const void *src, int character, size_t len)
Find character within a memory region.
References __unused, asn1_grow(), asn1_builder::data, asn1_cursor::data, DBGC, DBGC_HDA, EINVAL, end, ERANGE, rsa_context::input0, key, asn1_cursor::len, len, rsa_context::max_len, memchr(), memcpy(), rc, rsa_cipher(), rsa_free(), rsa_init(), and start.
| int rsa_pkcs1_encode |
( |
struct rsa_context * | context, |
|
|
struct digest_algorithm * | digest, |
|
|
const void * | value, |
|
|
const void *reference | __unused, |
|
|
void * | encoded ) |
|
static |
Encode digest using RSA PKCS#1.
- Parameters
-
| context | RSA context |
| digest | Digest algorithm |
| value | Digest value |
| reference | Reference encoded digest (or NULL) |
| encoded | Encoded digest |
- Return values
-
Definition at line 496 of file rsa.c.
500 {
504 size_t digestinfo_len;
505 size_t min_len;
506 size_t pad_len;
507
508
511 DBGC ( context,
"RSA %p has no prefix for %s\n",
514 }
515 digestinfo_len = (
prefix->len + digest_len );
516
517
518 min_len = ( 1 + 1 + 8
519 + 1 + digestinfo_len );
520 if ( min_len > context->
max_len ) {
521 DBGC ( context,
"RSA %p modulus too small for %s digest\n",
524 }
525 DBGC ( context,
"RSA %p encoding %s digest using PKCS#1:\n",
528
529
530 *(temp++) = 0x00;
531 *(temp++) = 0x01;
532 pad_len = ( 8 + context->
max_len - min_len );
533 memset ( temp, 0xff, pad_len );
534 temp += pad_len;
535 *(temp++) = 0x00;
539 temp += digest_len;
541 DBGC ( context,
"RSA %p encoded %s digest using PKCS#1:\n",
544
545 return 0;
546}
pseudo_bit_t value[0x00020]
#define assert(condition)
Assert a condition at run-time.
#define ENOTSUP
Operation not supported.
static struct rsa_digestinfo_prefix * rsa_find_prefix(struct digest_algorithm *digest)
Identify RSA prefix.
size_t digestsize
Digest size.
const char * name
Algorithm name.
References __unused, assert, DBGC, DBGC_HDA, rsa_digestinfo_prefix::digest, digest_algorithm::digestsize, ENOTSUP, ERANGE, rsa_context::max_len, memcpy(), memset(), digest_algorithm::name, prefix, rsa_find_prefix(), and value.
| void rsa_xor_mask |
( |
struct digest_algorithm * | digest, |
|
|
void * | ctx, |
|
|
void * | out, |
|
|
const void * | seed, |
|
|
void * | xor, |
|
|
size_t | len ) |
|
static |
Apply RSA PSS mask generation function.
- Parameters
-
| digest | Digest algorithm |
| ctx | Digest context buffer |
| out | Digest output buffer |
| seed | Mask seed |
| xor | XOR buffer |
| len | Length of XOR buffer |
Definition at line 558 of file rsa.c.
560 {
565 unsigned int i;
566
568
569
574
575
576 for ( i = 0 ;
len && ( i < digest_len ) ; i++,
len-- )
577 *(xor_byte++) ^= out_byte[i];
578
579
581 }
582}
struct golan_eq_context ctx
static void digest_init(struct digest_algorithm *digest, void *ctx)
static void digest_final(struct digest_algorithm *digest, void *ctx, void *out)
static void digest_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
static u32 xor(u32 a, u32 b)
References ctx, rsa_digestinfo_prefix::digest, digest_final(), digest_init(), digest_update(), digest_algorithm::digestsize, htonl, len, ntohl, out, and xor().
Referenced by rsa_pss_encode().
| int rsa_pss_encode |
( |
struct rsa_context * | context, |
|
|
struct digest_algorithm * | digest, |
|
|
const void * | value, |
|
|
const void * | reference, |
|
|
void * | encoded ) |
|
static |
Encode digest using RSA PSS.
- Parameters
-
| context | RSA context |
| digest | Digest algorithm |
| value | Digest value |
| reference | Reference encoded digest (or NULL) |
| encoded | Encoded digest |
- Return values
-
Definition at line 594 of file rsa.c.
597 {
602 size_t mask_len;
603 size_t pad_len;
604 size_t min_len;
606 void *salt;
611
612
613 min_len = ( sizeof ( *head ) + digest_len +
614 digest_len + sizeof ( *tail ) );
615 if ( context->
max_len < min_len ) {
616 DBGC ( context,
"RSA %p %s formatted digest value too long "
617 "(%zd bytes, max %zd)\n", context, digest->
name,
620 }
621 DBGC ( context,
"RSA %p encoding %s digest using PSS:\n",
622 context, digest->
name );
624
625
626 pad_len = ( context->
max_len - min_len );
627 msb = encoded;
628 head = ( msb + pad_len );
629 salt = (
head +
sizeof ( *head ) );
630 hash = ( salt + digest_len );
631 tail = (
hash + digest_len );
632 mask_len = ( pad_len + sizeof ( *head ) + digest_len );
634
635
636 if ( reference ) {
639 } else {
641 DBGC ( context,
"RSA %p could not generate random "
644 }
645 }
646 DBGC ( context,
"RSA %p salt:\n", context );
647 DBGC_HDA ( context, 0, salt, digest_len );
648
649
655
656
657 memset ( encoded, 0, pad_len );
660 *msb &= context->
mask;
661 *tail = 0xbc;
662 DBGC ( context,
"RSA %p encoded %s digest using PSS:\n",
663 context, digest->
name );
665
666 return 0;
667}
pseudo_bit_t hash[0x00010]
static void rsa_xor_mask(struct digest_algorithm *digest, void *ctx, void *out, const void *seed, void *xor, size_t len)
Apply RSA PSS mask generation function.
size_t ctxsize
Context size.
References assert, ctx, digest_algorithm::ctxsize, DBGC, DBGC_HDA, rsa_digestinfo_prefix::digest, digest_final(), digest_init(), digest_update(), digest_algorithm::digestsize, ERANGE, hash, head, rsa_context::mask, rsa_context::max_len, memcpy(), memset(), digest_algorithm::name, out, rc, rsa_get_random, rsa_xor_mask(), strerror(), and value.
Sign digest value using RSA.
- Parameters
-
| pubkey | Public-key algorithm |
| key | Key |
| digest | Digest algorithm |
| value | Digest value |
| signature | Signature |
- Return values
-
Definition at line 679 of file rsa.c.
682 {
686
687 DBGC ( &context,
"RSA %p signing %s digest:\n",
688 &context, digest->
name );
690
691
693 goto err_init;
694
695
697 goto err_grow;
698
699
700 if ( (
rc = encode ( &context, digest,
value,
NULL,
702 goto err_encode;
703
704
706 DBGC ( &context,
"RSA %p signed %s digest:\n", &context, digest->
name );
708
709
711
712 return 0;
713
714 err_encode:
715 err_grow:
717 err_init:
719}
u8 signature
CPU signature.
int rsa_encode_t(struct rsa_context *context, struct digest_algorithm *digest, const void *value, const void *reference, void *encoded)
Encode digest.
void * priv
Algorithm private data.
References asn1_grow(), DBGC, DBGC_HDA, digest_algorithm::digestsize, key, rsa_context::max_len, digest_algorithm::name, NULL, pubkey_algorithm::priv, rc, rsa_cipher(), rsa_free(), rsa_init(), signature, and value.
Verify signed digest value using RSA.
- Parameters
-
| pubkey | Public-key algorithm |
| key | Key |
| digest | Digest algorithm |
| value | Digest value |
| signature | Signature |
- Return values
-
Definition at line 731 of file rsa.c.
734 {
737 void *temp;
738 void *expected;
739 void *actual;
741
742 DBGC ( &context,
"RSA %p verifying %s digest:\n",
743 &context, digest->
name );
746
747
749 goto err_init;
750
751
752 if (
signature->len != context.max_len ) {
753 DBGC ( &context,
"RSA %p signature incorrect length (%zd "
754 "bytes, should be %zd)\n",
755 &context,
signature->len, context.max_len );
757 goto err_sanity;
758 }
759
760
761
762
763 temp = context.input0;
764 expected = temp;
766 DBGC ( &context,
"RSA %p deciphered signature:\n", &context );
767 DBGC_HDA ( &context, 0, expected, context.max_len );
768
769
770
771
772 temp = context.output0;
773 actual = temp;
774 if ( (
rc = encode ( &context, digest,
value, expected,
775 actual ) ) != 0 )
776 goto err_encode;
777
778
779 if (
memcmp ( actual, expected, context.max_len ) != 0 ) {
780 DBGC ( &context,
"RSA %p signature verification failed\n",
781 &context );
783 goto err_verify;
784 }
785
786
788
789 DBGC ( &context,
"RSA %p signature verified successfully\n", &context );
790 return 0;
791
792 err_verify:
793 err_encode:
794 err_sanity:
796 err_init:
798}
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
References DBGC, DBGC_HDA, digest_algorithm::digestsize, EACCES_VERIFY, ERANGE, rsa_context::input0, key, rsa_context::max_len, memcmp(), digest_algorithm::name, rsa_context::output0, pubkey_algorithm::priv, rc, rsa_cipher(), rsa_free(), rsa_init(), signature, and value.
Initial value: = {
.name = "rsa",
}
static int rsa_pkcs1_encrypt(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
Encrypt using RSA PKCS#1.
static int rsa_match(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
Check for matching RSA public/private key pair.
static int rsa_pkcs1_decrypt(struct pubkey_algorithm *pubkey __unused, const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
Decrypt using RSA PKCS#1.
static int rsa_sign(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
Sign digest value using RSA.
static int rsa_pkcs1_encode(struct rsa_context *context, struct digest_algorithm *digest, const void *value, const void *reference __unused, void *encoded)
Encode digest using RSA PKCS#1.
static int rsa_verify(struct pubkey_algorithm *pubkey, const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
Verify signed digest value using RSA.
RSA public-key algorithm.
Definition at line 833 of file rsa.c.
833 {
834 .name = "rsa",
841};
Referenced by __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), icert_cert(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_TEST(), PUBKEY_TEST(), and REQUIRING_SYMBOL().