diff options
author | djm <> | 2012-10-13 21:23:50 +0000 |
---|---|---|
committer | djm <> | 2012-10-13 21:23:50 +0000 |
commit | e9d65189905c6e99c1062d65e26bf83eebb0a26a (patch) | |
tree | 10ebe51c3542099b0ab8325d8f322372375dc3b4 /src/lib/libcrypto/dsa | |
parent | 59625e84c89bf82e1c6d20c55785b618eb56ea72 (diff) | |
parent | 228cae30b117c2493f69ad3c195341cd6ec8d430 (diff) | |
download | openbsd-e9d65189905c6e99c1062d65e26bf83eebb0a26a.tar.gz openbsd-e9d65189905c6e99c1062d65e26bf83eebb0a26a.tar.bz2 openbsd-e9d65189905c6e99c1062d65e26bf83eebb0a26a.zip |
This commit was generated by cvs2git to track changes on a CVS vendor
branch.
Diffstat (limited to 'src/lib/libcrypto/dsa')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_ameth.c | 47 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_locl.h | 1 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_pmeth.c | 6 |
3 files changed, 52 insertions, 2 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, |
diff --git a/src/lib/libcrypto/dsa/dsa_locl.h b/src/lib/libcrypto/dsa/dsa_locl.h index 2b8cfee3db..21e2e45242 100644 --- a/src/lib/libcrypto/dsa/dsa_locl.h +++ b/src/lib/libcrypto/dsa/dsa_locl.h | |||
@@ -56,4 +56,5 @@ | |||
56 | 56 | ||
57 | int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, | 57 | int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits, |
58 | const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len, | 58 | const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len, |
59 | unsigned char *seed_out, | ||
59 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | 60 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); |
diff --git a/src/lib/libcrypto/dsa/dsa_pmeth.c b/src/lib/libcrypto/dsa/dsa_pmeth.c index e2df54fec6..715d8d675b 100644 --- a/src/lib/libcrypto/dsa/dsa_pmeth.c +++ b/src/lib/libcrypto/dsa/dsa_pmeth.c | |||
@@ -189,7 +189,9 @@ static int pkey_dsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | |||
189 | EVP_MD_type((const EVP_MD *)p2) != NID_dsa && | 189 | EVP_MD_type((const EVP_MD *)p2) != NID_dsa && |
190 | EVP_MD_type((const EVP_MD *)p2) != NID_dsaWithSHA && | 190 | EVP_MD_type((const EVP_MD *)p2) != NID_dsaWithSHA && |
191 | EVP_MD_type((const EVP_MD *)p2) != NID_sha224 && | 191 | EVP_MD_type((const EVP_MD *)p2) != NID_sha224 && |
192 | EVP_MD_type((const EVP_MD *)p2) != NID_sha256) | 192 | EVP_MD_type((const EVP_MD *)p2) != NID_sha256 && |
193 | EVP_MD_type((const EVP_MD *)p2) != NID_sha384 && | ||
194 | EVP_MD_type((const EVP_MD *)p2) != NID_sha512) | ||
193 | { | 195 | { |
194 | DSAerr(DSA_F_PKEY_DSA_CTRL, DSA_R_INVALID_DIGEST_TYPE); | 196 | DSAerr(DSA_F_PKEY_DSA_CTRL, DSA_R_INVALID_DIGEST_TYPE); |
195 | return 0; | 197 | return 0; |
@@ -253,7 +255,7 @@ static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | |||
253 | if (!dsa) | 255 | if (!dsa) |
254 | return 0; | 256 | return 0; |
255 | ret = dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd, | 257 | ret = dsa_builtin_paramgen(dsa, dctx->nbits, dctx->qbits, dctx->pmd, |
256 | NULL, 0, NULL, NULL, pcb); | 258 | NULL, 0, NULL, NULL, NULL, pcb); |
257 | if (ret) | 259 | if (ret) |
258 | EVP_PKEY_assign_DSA(pkey, dsa); | 260 | EVP_PKEY_assign_DSA(pkey, dsa); |
259 | else | 261 | else |