Avoid integer overflow in entropy counter.
[openssl.git] / apps / x509.c
index 04cae3148100d31094cdaa49237814b42628653e..c5b163ea7079d38ada5a744df3f5e2ba8e1cdd37 100644 (file)
@@ -557,7 +557,7 @@ bad:
                        }
                }
 
-       if(alias) X509_alias_set(x, (unsigned char *)alias, -1);
+       if(alias) X509_alias_rset(x, (unsigned char *)alias, -1);
 
        if(clrtrust) X509_trust_clear(x);
        if(clrreject) X509_reject_clear(x);
@@ -601,7 +601,7 @@ bad:
                        else if (aliasout == i)
                                {
                                unsigned char *alstr;
-                               alstr = X509_alias_get(x, NULL);
+                               alstr = X509_alias_iget(x, NULL);
                                if(alstr) BIO_printf(STDout,"%s\n", alstr);
                                else BIO_puts(STDout,"<No Alias>\n");
                                }
@@ -943,8 +943,8 @@ static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
                        }
                else
                        {
-                       ASN1_INTEGER_set(bs,0);
-                       BN_zero(serial);
+                       ASN1_INTEGER_set(bs,1);
+                       BN_one(serial);
                        }
                }
        else