int DSA_bits(const DSA *dsa)
{
- return BN_num_bits(dsa->params.p);
+ if (dsa->params.p != NULL)
+ return BN_num_bits(dsa->params.p);
+ return -1;
}
FFC_PARAMS *dsa_get0_params(DSA *dsa)
int DSA_size(const DSA *dsa)
{
- int ret;
+ int ret = -1;
DSA_SIG sig;
- sig.r = sig.s = dsa->params.q;
- ret = i2d_DSA_SIG(&sig, NULL);
+ if (dsa->params.q != NULL) {
+ sig.r = sig.s = dsa->params.q;
+ ret = i2d_DSA_SIG(&sig, NULL);
- if (ret < 0)
- ret = 0;
+ if (ret < 0)
+ ret = 0;
+ }
return ret;
}
=head1 DESCRIPTION
-DSA_bits() returns the number of bits in key B<dsa>: this is the number
-of bits in the B<p> parameter.
+DSA_bits() returns the number of bits in key I<dsa>: this is the number
+of bits in the I<p> parameter.
The remaining functions described on this page are deprecated.
Applications should instead use L<EVP_PKEY_security_bits(3)> and
L<EVP_PKEY_size(3)>.
DSA_size() returns the maximum size of an ASN.1 encoded DSA signature
-for key B<dsa> in bytes. It can be used to determine how much memory must
+for key I<dsa> in bytes. It can be used to determine how much memory must
be allocated for a DSA signature.
-B<dsa-E<gt>q> must not be B<NULL>.
-
-DSA_security_bits() returns the number of security bits of the given B<dsa>
+DSA_security_bits() returns the number of security bits of the given I<dsa>
key. See L<BN_security_bits(3)>.
=head1 RETURN VALUES
-DSA_bits() returns the number of bits in the key.
+DSA_security_bits() returns the number of security bits in the key, or -1 if
+I<dsa> doesn't hold any key parameters.
+
+DSA_bits() returns the number of bits in the key, or -1 if I<dsa> doesn't
+hold any key parameters.
-DSA_size() returns the signature size in bytes.
+DSA_size() returns the signature size in bytes, or -1 if I<dsa> doesn't
+hold any key parameters.
=head1 SEE ALSO