diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_ameth.c')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_ameth.c b/src/lib/libcrypto/dsa/dsa_ameth.c index 6413aae46e..376156ec5e 100644 --- a/src/lib/libcrypto/dsa/dsa_ameth.c +++ b/src/lib/libcrypto/dsa/dsa_ameth.c | |||
| @@ -542,6 +542,52 @@ static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder) | |||
| 542 | return i2d_DSAPrivateKey(pkey->pkey.dsa, pder); | 542 | return i2d_DSAPrivateKey(pkey->pkey.dsa, pder); |
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, | ||
| 546 | const ASN1_STRING *sig, | ||
| 547 | int indent, ASN1_PCTX *pctx) | ||
| 548 | { | ||
| 549 | DSA_SIG *dsa_sig; | ||
| 550 | const unsigned char *p; | ||
| 551 | if (!sig) | ||
| 552 | { | ||
| 553 | if (BIO_puts(bp, "\n") <= 0) | ||
| 554 | return 0; | ||
| 555 | else | ||
| 556 | return 1; | ||
| 557 | } | ||
| 558 | p = sig->data; | ||
| 559 | dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length); | ||
| 560 | if (dsa_sig) | ||
| 561 | { | ||
| 562 | int rv = 0; | ||
| 563 | size_t buf_len = 0; | ||
| 564 | unsigned char *m=NULL; | ||
| 565 | update_buflen(dsa_sig->r, &buf_len); | ||
| 566 | update_buflen(dsa_sig->s, &buf_len); | ||
| 567 | m = OPENSSL_malloc(buf_len+10); | ||
| 568 | if (m == NULL) | ||
| 569 | { | ||
| 570 | DSAerr(DSA_F_DSA_SIG_PRINT,ERR_R_MALLOC_FAILURE); | ||
| 571 | goto err; | ||
| 572 | } | ||
| 573 | |||
| 574 | if (BIO_write(bp, "\n", 1) != 1) | ||
| 575 | goto err; | ||
| 576 | |||
| 577 | if (!ASN1_bn_print(bp,"r: ",dsa_sig->r,m,indent)) | ||
| 578 | goto err; | ||
| 579 | if (!ASN1_bn_print(bp,"s: ",dsa_sig->s,m,indent)) | ||
| 580 | goto err; | ||
| 581 | rv = 1; | ||
| 582 | err: | ||
| 583 | if (m) | ||
| 584 | OPENSSL_free(m); | ||
| 585 | DSA_SIG_free(dsa_sig); | ||
| 586 | return rv; | ||
| 587 | } | ||
| 588 | return X509_signature_dump(bp, sig, indent); | ||
| 589 | } | ||
| 590 | |||
| 545 | static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | 591 | static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) |
| 546 | { | 592 | { |
| 547 | switch (op) | 593 | switch (op) |
| @@ -647,6 +693,7 @@ const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = | |||
| 647 | dsa_copy_parameters, | 693 | dsa_copy_parameters, |
| 648 | dsa_cmp_parameters, | 694 | dsa_cmp_parameters, |
| 649 | dsa_param_print, | 695 | dsa_param_print, |
| 696 | dsa_sig_print, | ||
| 650 | 697 | ||
| 651 | int_dsa_free, | 698 | int_dsa_free, |
| 652 | dsa_pkey_ctrl, | 699 | dsa_pkey_ctrl, |
