Remove misleading dead code. Constify. (Coverity ID 142)
authorBen Laurie <ben@openssl.org>
Fri, 26 Dec 2008 17:17:21 +0000 (17:17 +0000)
committerBen Laurie <ben@openssl.org>
Fri, 26 Dec 2008 17:17:21 +0000 (17:17 +0000)
crypto/dsa/dsa.h
crypto/dsa/dsa_gen.c
crypto/dsa/dsa_locl.h

index 27bc5b91ca402d01f665d185ee7ddec758e82a5f..7e6d84a37e84c7306adf63652b4b9aafc51386c6 100644 (file)
@@ -131,7 +131,7 @@ struct dsa_method
        char *app_data;
        /* If this is non-NULL, it is used to generate DSA parameters */
        int (*dsa_paramgen)(DSA *dsa, int bits,
-                       unsigned char *seed, int seed_len,
+                       const unsigned char *seed, int seed_len,
                        int *counter_ret, unsigned long *h_ret,
                        BN_GENCB *cb);
        /* If this is non-NULL, it is used to generate DSA keys */
@@ -220,7 +220,7 @@ DSA *       DSA_generate_parameters(int bits,
 
 /* New version */
 int    DSA_generate_parameters_ex(DSA *dsa, int bits,
-               unsigned char *seed,int seed_len,
+               const unsigned char *seed,int seed_len,
                int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
 
 int    DSA_generate_key(DSA *a);
index 2435fc8bc7c1c67b6d5acddf43251608f563df3c..0fcd25f8b0a3e5e09d7add9b1cd130468a76870a 100644 (file)
@@ -82,7 +82,7 @@
 #include "dsa_locl.h"
 
 int DSA_generate_parameters_ex(DSA *ret, int bits,
-               unsigned char *seed_in, int seed_len,
+               const unsigned char *seed_in, int seed_len,
                int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
        {
        if(ret->meth->dsa_paramgen)
@@ -110,7 +110,7 @@ int DSA_generate_parameters_ex(DSA *ret, int bits,
        }
 
 int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
-       const EVP_MD *evpmd, unsigned char *seed_in, size_t seed_len,
+       const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len,
        int *counter_ret, unsigned long *h_ret, BN_GENCB *cb)
        {
        int ok=0;
@@ -149,11 +149,7 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
                seed_len = qsize;       /* App. 2.2 of FIPS PUB 186 allows larger SEED,
                                         * but our internal buffers are restricted to 160 bits*/
        if (seed_in != NULL)
-               {
                memcpy(seed, seed_in, seed_len);
-               /* set seed_in to NULL to avoid it being copied back */
-               seed_in = NULL;
-               }
 
        if ((ctx=BN_CTX_new()) == NULL)
                goto err;
@@ -335,7 +331,6 @@ err:
                        ok=0;
                        goto err;
                        }
-               if (seed_in != NULL) memcpy(seed_in,seed, qsize);
                if (counter_ret != NULL) *counter_ret=counter;
                if (h_ret != NULL) *h_ret=h;
                }
index f1bbf72fb83ddace28ca590b3af08408b5c29b07..2b8cfee3dbd5e27430e79a274f533d528d6cfbb6 100644 (file)
@@ -55,5 +55,5 @@
 #include <openssl/dsa.h>
 
 int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
-       const EVP_MD *evpmd, unsigned char *seed_in, size_t seed_len,
+       const EVP_MD *evpmd, const unsigned char *seed_in, size_t seed_len,
        int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);