Various S/MIME DSA related fixes.
*) applies to 0.9.6a (/0.9.6b) and 0.9.7
+) applies to 0.9.7 only
+ +) Fix various bugs related to DSA S/MIME verification. Handle missing
+ parameters in DSA public key structures and return an error in the
+ DSA routines if parameters are absent.
+ [Steve Henson]
+
+ +) Fix ASN1 decoder when decoding type ANY and V_ASN1_OTHER: since this
+ needs to match any other type at all we need to manually clear the
+ tag cache.
+ [Steve Henson]
+
+) Changes to the "openssl engine" utility to include;
- verbosity levels ('-v', '-vv', and '-vvv') that provide information
about an ENGINE's available control commands.
that they do not hold after the first thread unsets add_do_not_lock).
[Bodo Moeller]
+>>>>>>> 1.823
+) Implement binary inversion algorithm for BN_mod_inverse in addition
to the algorithm using long divison. The binary algorithm can be
used only if the modulus is odd. On 32-bit systems, it is faster
} else if(ret == -1) return -1;
/* SEQUENCE, SET and "OTHER" are left in encoded form */
if((utype == V_ASN1_SEQUENCE) || (utype == V_ASN1_SET) || (utype == V_ASN1_OTHER)) {
+ /* Clear context cache for type OTHER because the auto clear when
+ * we have a exact match wont work
+ */
+ if(utype == V_ASN1_OTHER) {
+ asn1_tlc_clear(ctx);
/* SEQUENCE and SET must be constructed */
- if((utype != V_ASN1_OTHER) && !cst) {
+ } else if(!cst) {
ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_TYPE_NOT_CONSTRUCTED);
return 0;
}
}
}
}
-
+
if(i & 0x80) {
ASN1err(ASN1_F_ASN1_CHECK_TLEN, ASN1_R_BAD_OBJECT_HEADER);
asn1_tlc_clear(ctx);
a=key->algor;
if (ret->type == EVP_PKEY_DSA)
{
- if (a->parameter->type == V_ASN1_SEQUENCE)
+ if (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))
{
ret->pkey.dsa->write_params=0;
cp=p=a->parameter->value.sequence->data;
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
+void ERR_load_DSA_strings(void);
/* Error codes for the DSA functions. */
/* Reason codes. */
#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100
+#define DSA_R_MISSING_PARAMETERS 101
#ifdef __cplusplus
}
#endif
#endif
-
static ERR_STRING_DATA DSA_str_reasons[]=
{
{DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE ,"data too large for key size"},
+{DSA_R_MISSING_PARAMETERS ,"missing parameters"},
{0,NULL}
};
int i,reason=ERR_R_BN_LIB;
DSA_SIG *ret=NULL;
+ if (!dsa->p || !dsa->q || !dsa->g)
+ {
+ reason=DSA_R_MISSING_PARAMETERS;
+ goto err;
+ }
BN_init(&m);
BN_init(&xr);
s=BN_new();
BIGNUM k,*kinv=NULL,*r=NULL;
int ret=0;
+ if (!dsa->p || !dsa->q || !dsa->g)
+ {
+ DSAerr(DSA_F_DSA_SIGN_SETUP,DSA_R_MISSING_PARAMETERS);
+ return 0;
+ }
if (ctx_in == NULL)
{
if ((ctx=BN_CTX_new()) == NULL) goto err;
BIGNUM u1,u2,t1;
BN_MONT_CTX *mont=NULL;
int ret = -1;
+ if (!dsa->p || !dsa->q || !dsa->g)
+ {
+ DSAerr(DSA_F_DSA_DO_VERIFY,DSA_R_MISSING_PARAMETERS);
+ return -1;
+ }
if ((ctx=BN_CTX_new()) == NULL) goto err;
BN_init(&u1);