[BACK]Return to testdsa.h CVS log [TXT][DIR] Up to [local] / src / usr.bin / openssl

Diff for /src/usr.bin/openssl/testdsa.h between version 1.1 and 1.2

version 1.1, 2014/08/26 17:47:25 version 1.2, 2022/01/10 14:47:09
Line 41 
Line 41 
 get_dsa512()  get_dsa512()
 {  {
         DSA *dsa;          DSA *dsa;
           BIGNUM *priv_key = NULL, *pub_key = NULL;
           BIGNUM *p = NULL, *q = NULL, *g = NULL;
   
         if ((dsa = DSA_new()) == NULL)          if ((dsa = DSA_new()) == NULL)
                 return (NULL);                  goto err;
         dsa->priv_key = BN_bin2bn(dsa512_priv, sizeof(dsa512_priv), NULL);  
         dsa->pub_key = BN_bin2bn(dsa512_pub, sizeof(dsa512_pub), NULL);          priv_key = BN_bin2bn(dsa512_priv, sizeof(dsa512_priv), NULL);
         dsa->p = BN_bin2bn(dsa512_p, sizeof(dsa512_p), NULL);          pub_key = BN_bin2bn(dsa512_pub, sizeof(dsa512_pub), NULL);
         dsa->q = BN_bin2bn(dsa512_q, sizeof(dsa512_q), NULL);          if (priv_key == NULL || pub_key == NULL)
         dsa->g = BN_bin2bn(dsa512_g, sizeof(dsa512_g), NULL);                  goto err;
         if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) ||          if (!DSA_set0_key(dsa, pub_key, priv_key))
             (dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))                  goto err;
                 return (NULL);  
         return (dsa);          p = BN_bin2bn(dsa512_p, sizeof(dsa512_p), NULL);
           q = BN_bin2bn(dsa512_q, sizeof(dsa512_q), NULL);
           g = BN_bin2bn(dsa512_g, sizeof(dsa512_g), NULL);
           if (p == NULL || q == NULL || g == NULL)
                   goto err;
           if (!DSA_set0_pqg(dsa, p, q, g))
                   goto err;
   
           return dsa;
   
    err:
           DSA_free(dsa);
           BN_free(priv_key);
           BN_free(pub_key);
           BN_free(p);
           BN_free(q);
           BN_free(g);
   
           return NULL;
 }  }
   
 static unsigned char dsa1024_priv[] = {  static unsigned char dsa1024_priv[] = {
Line 107 
Line 127 
 get_dsa1024()  get_dsa1024()
 {  {
         DSA *dsa;          DSA *dsa;
           BIGNUM *priv_key = NULL, *pub_key = NULL;
           BIGNUM *p = NULL, *q = NULL, *g = NULL;
   
         if ((dsa = DSA_new()) == NULL)          if ((dsa = DSA_new()) == NULL)
                 return (NULL);                  goto err;
         dsa->priv_key = BN_bin2bn(dsa1024_priv, sizeof(dsa1024_priv), NULL);  
         dsa->pub_key = BN_bin2bn(dsa1024_pub, sizeof(dsa1024_pub), NULL);          priv_key = BN_bin2bn(dsa1024_priv, sizeof(dsa1024_priv), NULL);
         dsa->p = BN_bin2bn(dsa1024_p, sizeof(dsa1024_p), NULL);          pub_key = BN_bin2bn(dsa1024_pub, sizeof(dsa1024_pub), NULL);
         dsa->q = BN_bin2bn(dsa1024_q, sizeof(dsa1024_q), NULL);          if (priv_key == NULL || pub_key == NULL)
         dsa->g = BN_bin2bn(dsa1024_g, sizeof(dsa1024_g), NULL);                  goto err;
         if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) ||          if (!DSA_set0_key(dsa, pub_key, priv_key))
             (dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))                  goto err;
                 return (NULL);  
         return (dsa);          p = BN_bin2bn(dsa1024_p, sizeof(dsa1024_p), NULL);
           q = BN_bin2bn(dsa1024_q, sizeof(dsa1024_q), NULL);
           g = BN_bin2bn(dsa1024_g, sizeof(dsa1024_g), NULL);
           if (p == NULL || q == NULL || g == NULL)
                   goto err;
   
           if (!DSA_set0_pqg(dsa, p, q, g))
                   goto err;
   
           return dsa;
   
    err:
           DSA_free(dsa);
           BN_free(priv_key);
           BN_free(pub_key);
           BN_free(p);
           BN_free(q);
           BN_free(g);
   
           return NULL;
 }  }
   
 static unsigned char dsa2048_priv[] = {  static unsigned char dsa2048_priv[] = {
Line 206 
Line 247 
 get_dsa2048()  get_dsa2048()
 {  {
         DSA *dsa;          DSA *dsa;
           BIGNUM *priv_key = NULL, *pub_key = NULL;
           BIGNUM *p = NULL, *q = NULL, *g = NULL;
   
         if ((dsa = DSA_new()) == NULL)          if ((dsa = DSA_new()) == NULL)
                 return (NULL);                  return (NULL);
         dsa->priv_key = BN_bin2bn(dsa2048_priv, sizeof(dsa2048_priv), NULL);          priv_key = BN_bin2bn(dsa2048_priv, sizeof(dsa2048_priv), NULL);
         dsa->pub_key = BN_bin2bn(dsa2048_pub, sizeof(dsa2048_pub), NULL);          pub_key = BN_bin2bn(dsa2048_pub, sizeof(dsa2048_pub), NULL);
         dsa->p = BN_bin2bn(dsa2048_p, sizeof(dsa2048_p), NULL);          if (priv_key == NULL || pub_key == NULL)
         dsa->q = BN_bin2bn(dsa2048_q, sizeof(dsa2048_q), NULL);                  goto err;
         dsa->g = BN_bin2bn(dsa2048_g, sizeof(dsa2048_g), NULL);          if (!DSA_set0_key(dsa, pub_key, priv_key))
         if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) ||                  goto err;
             (dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))  
                 return (NULL);          p = BN_bin2bn(dsa2048_p, sizeof(dsa2048_p), NULL);
         return (dsa);          q = BN_bin2bn(dsa2048_q, sizeof(dsa2048_q), NULL);
           g = BN_bin2bn(dsa2048_g, sizeof(dsa2048_g), NULL);
           if (p == NULL || q == NULL || g == NULL)
                   goto err;
           if (!DSA_set0_pqg(dsa, p, q, g))
                   goto err;
   
           return dsa;
   
    err:
           DSA_free(dsa);
           BN_free(priv_key);
           BN_free(pub_key);
           BN_free(p);
           BN_free(q);
           BN_free(g);
   
           return NULL;
 }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2