Fix error codes.
authorDr. Stephen Henson <steve@openssl.org>
Thu, 20 Oct 2011 13:56:01 +0000 (13:56 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Thu, 20 Oct 2011 13:56:01 +0000 (13:56 +0000)
fips/fips.h
fips/rand/fips_drbg_lib.c
fips/rand/fips_drbg_selftest.c

index aaeadf5..a95f44e 100644 (file)
@@ -344,6 +344,7 @@ void ERR_load_FIPS_strings(void);
 /* Function codes. */
 #define FIPS_F_DH_BUILTIN_GENPARAMS                     100
 #define FIPS_F_DH_INIT                                  148
+#define FIPS_F_DRBG_RESEED                              162
 #define FIPS_F_DSA_BUILTIN_PARAMGEN                     101
 #define FIPS_F_DSA_BUILTIN_PARAMGEN2                    102
 #define FIPS_F_DSA_DO_SIGN                              103
@@ -364,8 +365,8 @@ void ERR_load_FIPS_strings(void);
 #define FIPS_F_FIPS_DRBG_BYTES                          111
 #define FIPS_F_FIPS_DRBG_CHECK                          146
 #define FIPS_F_FIPS_DRBG_CPRNG_TEST                     112
+#define FIPS_F_FIPS_DRBG_ERROR_CHECK                    114
 #define FIPS_F_FIPS_DRBG_GENERATE                       113
-#define FIPS_F_FIPS_DRBG_HEALTH_CHECK                   114
 #define FIPS_F_FIPS_DRBG_INIT                           115
 #define FIPS_F_FIPS_DRBG_INSTANTIATE                    116
 #define FIPS_F_FIPS_DRBG_NEW                            117
index 95c73e1..39c007f 100644 (file)
@@ -278,8 +278,8 @@ static int drbg_reseed(DRBG_CTX *dctx,
        int r = 0;
 
 #if 0
-       FIPSerr(FIPS_F_FIPS_DRBG_RESEED, FIPS_R_NOT_INSTANTIATED);
-       FIPSerr(FIPS_F_FIPS_DRBG_RESEED, FIPS_R_ADDITIONAL_INPUT_TOO_LONG);
+       FIPSerr(FIPS_F_DRBG_RESEED, FIPS_R_NOT_INSTANTIATED);
+       FIPSerr(FIPS_F_DRBG_RESEED, FIPS_R_ADDITIONAL_INPUT_TOO_LONG);
 #endif
        if (dctx->status != DRBG_STATUS_READY
                && dctx->status != DRBG_STATUS_RESEED)
@@ -336,7 +336,7 @@ static int drbg_reseed(DRBG_CTX *dctx,
                return 1;
 
        if (r && !(dctx->iflags & DRBG_FLAG_NOERR))
-               FIPSerr(FIPS_F_FIPS_DRBG_RESEED, r);
+               FIPSerr(FIPS_F_DRBG_RESEED, r);
 
        return 0;
        }
index 205cca2..ee0561b 100644 (file)
@@ -410,7 +410,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_instantiate(dctx, td->pers, dctx->max_pers + 1) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_PERSONALISATION_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_PERSONALISATION_ERROR_UNDETECTED);
                goto err;
                }
 
@@ -422,7 +422,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_instantiate(dctx, td->pers, td->perslen) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
 
@@ -430,14 +430,14 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
        if (FIPS_drbg_generate(dctx, randout, td->katlen, 0,
                                td->adin, td->adinlen))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_GENERATE_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_GENERATE_ERROR_UNDETECTED);
                goto err;
                }
 
        dctx->iflags &= ~DRBG_FLAG_NOERR;
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -452,14 +452,14 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_instantiate(dctx, td->pers, td->perslen) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
 
        dctx->iflags &= ~DRBG_FLAG_NOERR;
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -474,14 +474,14 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_instantiate(dctx, td->pers, td->perslen) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
 
        dctx->iflags &= ~DRBG_FLAG_NOERR;
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -501,14 +501,14 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
                if (FIPS_drbg_instantiate(dctx, td->pers, td->perslen) > 0)
                        {
-                       FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_NONCE_ERROR_UNDETECTED);
+                       FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_NONCE_ERROR_UNDETECTED);
                        goto err;
                        }
 
                dctx->iflags &= ~DRBG_FLAG_NOERR;
                if (!FIPS_drbg_uninstantiate(dctx))
                        {
-                       FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+                       FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                        goto err;
                        }
 
@@ -528,14 +528,14 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
                if (FIPS_drbg_instantiate(dctx, td->pers, td->perslen) > 0)
                        {
-                       FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_NONCE_ERROR_UNDETECTED);
+                       FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_NONCE_ERROR_UNDETECTED);
                        goto err;
                        }
 
                dctx->iflags &= ~DRBG_FLAG_NOERR;
                if (!FIPS_drbg_uninstantiate(dctx))
                        {
-                       FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+                       FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                        goto err;
                        }
 
@@ -556,7 +556,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
        if (FIPS_drbg_generate(dctx, randout, dctx->max_request + 1, 0,
                                td->adin, td->adinlen))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_REQUEST_LENGTH_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_REQUEST_LENGTH_ERROR_UNDETECTED);
                goto err;
                }
 
@@ -564,7 +564,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
        if (FIPS_drbg_generate(dctx, randout, td->katlen, 0,
                                td->adin, dctx->max_adin + 1))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED);
                goto err;
                }
 
@@ -577,7 +577,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
        if (FIPS_drbg_generate(dctx, randout, td->katlen, 1,
                                td->adin, td->adinlen))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
                
@@ -585,7 +585,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -607,13 +607,13 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
                goto err;
        if (t.entcnt != 1)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED);
                goto err;
                }
        /* Check reseed counter has been reset */
        if (dctx->reseed_counter != reseed_counter_tmp + 1)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_RESEED_COUNTER_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_RESEED_COUNTER_ERROR);
                goto err;
                }
 
@@ -627,7 +627,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_reseed(dctx, td->adin, dctx->max_adin + 1) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED);
                goto err;
                }
 
@@ -642,7 +642,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
        if (FIPS_drbg_generate(dctx, randout, td->katlen, 1,
                                td->adin, td->adinlen))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
                
@@ -650,7 +650,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -670,13 +670,13 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
                goto err;
        if (t.entcnt != 1)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED);
                goto err;
                }
        /* Check reseed counter has been reset */
        if (dctx->reseed_counter != reseed_counter_tmp + 1)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_RESEED_COUNTER_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_RESEED_COUNTER_ERROR);
                goto err;
                }
 
@@ -690,7 +690,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_reseed(dctx, td->adin, dctx->max_adin + 1) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED);
                goto err;
                }
 
@@ -705,13 +705,13 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_reseed(dctx, td->adin, td->adinlen) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
 
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -726,13 +726,13 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_reseed(dctx, td->adin, td->adinlen) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
 
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -747,13 +747,13 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
 
        if (FIPS_drbg_reseed(dctx, td->adin, td->adinlen) > 0)
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_ENTROPY_ERROR_UNDETECTED);
                goto err;
                }
 
        if (!FIPS_drbg_uninstantiate(dctx))
                {
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ERROR);
                goto err;
                }
 
@@ -765,7 +765,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
                {
                if (*p != 0)
                        {
-                       FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_UNINSTANTIATE_ZEROISE_ERROR);
+                       FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_UNINSTANTIATE_ZEROISE_ERROR);
                        goto err;
                        }
                p++;
@@ -778,7 +778,7 @@ static int fips_drbg_error_check(DRBG_CTX *dctx, DRBG_SELFTEST_DATA *td)
         * indicate the error.
         */
        if (!(dctx->iflags & DRBG_FLAG_NOERR))
-               FIPSerr(FIPS_F_FIPS_DRBG_HEALTH_CHECK, FIPS_R_FUNCTION_ERROR);
+               FIPSerr(FIPS_F_FIPS_DRBG_ERROR_CHECK, FIPS_R_FUNCTION_ERROR);
        FIPS_drbg_uninstantiate(dctx);
        return 0;