64 #ifndef OPENSSL_NO_CMS
71 const unsigned char *
p, *pm;
113 if (!(public_key=d2i_ASN1_INTEGER(NULL, &p, pklen)))
125 ASN1_INTEGER_free(public_key);
131 ASN1_INTEGER_free(public_key);
143 unsigned char *penc = NULL;
174 ptype, pval, penc, penclen))
192 const unsigned char *
p, *pm;
212 if(!(ndsa = d2i_ASN1_SEQUENCE_ANY(NULL, &p, pklen)))
240 const unsigned char *
q =
p;
241 if (!(privkey=d2i_ASN1_INTEGER(NULL, &p, pklen)))
246 ASN1_INTEGER_free(privkey);
288 ASN1_INTEGER_free(privkey);
297 ASN1_INTEGER_free(privkey);
307 unsigned char *dp = NULL;
335 dplen = i2d_ASN1_INTEGER(prkey, &dp);
337 ASN1_INTEGER_free(prkey);
351 ASN1_INTEGER_free(prkey);
355 static int int_dsa_size(
const EVP_PKEY *pkey)
360 static int dsa_bits(
const EVP_PKEY *pkey)
365 static int dsa_missing_parameters(
const EVP_PKEY *pkey)
369 if ((dsa->
p == NULL) || (dsa->
q == NULL) || (dsa->
g == NULL))
416 static void int_dsa_free(
EVP_PKEY *pkey)
421 static void update_buflen(
const BIGNUM *b,
size_t *pbuflen)
430 static int do_dsa_print(
BIO *
bp,
const DSA *x,
int off,
int ptype)
432 unsigned char *m=NULL;
435 const char *ktype = NULL;
437 const BIGNUM *priv_key, *pub_key;
450 ktype =
"Private-Key";
452 ktype =
"Public-Key";
454 ktype =
"DSA-Parameters";
456 update_buflen(x->
p, &buf_len);
457 update_buflen(x->
q, &buf_len);
458 update_buflen(x->
g, &buf_len);
459 update_buflen(priv_key, &buf_len);
460 update_buflen(pub_key, &buf_len);
490 static int dsa_param_decode(
EVP_PKEY *pkey,
491 const unsigned char **pder,
int derlen)
503 static int dsa_param_encode(
const EVP_PKEY *pkey,
unsigned char **pder)
508 static int dsa_param_print(
BIO *bp,
const EVP_PKEY *pkey,
int indent,
511 return do_dsa_print(bp, pkey->
pkey.
dsa, indent, 0);
514 static int dsa_pub_print(
BIO *bp,
const EVP_PKEY *pkey,
int indent,
517 return do_dsa_print(bp, pkey->
pkey.
dsa, indent, 1);
521 static int dsa_priv_print(
BIO *bp,
const EVP_PKEY *pkey,
int indent,
524 return do_dsa_print(bp, pkey->
pkey.
dsa, indent, 2);
527 static int old_dsa_priv_decode(
EVP_PKEY *pkey,
528 const unsigned char **pder,
int derlen)
540 static int old_dsa_priv_encode(
const EVP_PKEY *pkey,
unsigned char **pder)
550 const unsigned char *
p;
564 unsigned char *m=NULL;
565 update_buflen(dsa_sig->
r, &buf_len);
566 update_buflen(dsa_sig->
s, &buf_len);
591 static int dsa_pkey_ctrl(
EVP_PKEY *pkey,
int op,
long arg1,
void *arg2)
601 if (alg1 == NULL || alg1->
algorithm == NULL)
611 #ifndef OPENSSL_NO_CMS
618 if (alg1 == NULL || alg1->
algorithm == NULL)
676 "OpenSSL DSA method",
692 dsa_missing_parameters,