Import libgcrypt 1.5.3.

This commit is contained in:
Vladimir Serbinenko 2013-11-07 06:35:50 +01:00
parent c12936c5d1
commit d1307d873a
72 changed files with 11732 additions and 2916 deletions

View file

@ -104,21 +104,16 @@ global_init (void)
/* Initialize our portable thread/mutex wrapper. */
err = ath_init ();
if (err)
{
err = gpg_error_from_errno (err);
goto fail;
}
goto fail;
/* See whether the system is in FIPS mode. This needs to come as
early as possible but after ATH has been initialized. */
early as possible put after the ATH has been initialized. */
_gcry_initialize_fips_mode (force_fips_mode);
/* Before we do any other initialization we need to test available
hardware features. */
_gcry_detect_hw_features (disabled_hw_features);
/* Initialize the modules - this is mainly allocating some memory and
creating mutexes. */
err = _gcry_cipher_init ();
if (err)
goto fail;
@ -128,9 +123,15 @@ global_init (void)
err = _gcry_pk_init ();
if (err)
goto fail;
err = _gcry_primegen_init ();
if (err)
goto fail;
#if 0
/* Hmmm, as of now ac_init does nothing. */
if ( !fips_mode () )
{
err = _gcry_ac_init ();
if (err)
goto fail;
}
#endif
return;
@ -235,6 +236,9 @@ gcry_check_version( const char *req_version )
int rq_major, rq_minor, rq_micro;
const char *my_plvl;
if (req_version && req_version[0] == 1 && req_version[1] == 1)
return _gcry_compat_identification ();
/* Initialize library. */
global_init ();
@ -292,7 +296,6 @@ print_config ( int (*fnc)(FILE *fp, const char *format, ...), FILE *fp)
#endif
"\n");
fnc (fp, "mpi-asm:%s:\n", _gcry_mpi_get_hw_config ());
fnc (fp, "threads:%s:\n", ath_get_model (NULL));
hwf = _gcry_get_hw_features ();
fnc (fp, "hwflist:");
for (i=0; hwflist[i].desc; i++)
@ -444,8 +447,8 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
break;
case GCRYCTL_SET_THREAD_CBS:
err = ath_install (va_arg (arg_ptr, void *));
if (!err)
err = ath_install (va_arg (arg_ptr, void *), any_init_done);
if (! err)
global_init ();
break;
@ -596,9 +599,17 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr)
}
break;
case GCRYCTL_SET_ENFORCED_FIPS_FLAG:
if (!any_init_done)
{
/* Not yet intialized at all. Set the enforced fips mode flag */
_gcry_set_enforced_fips_mode ();
}
else
err = GPG_ERR_GENERAL;
break;
default:
/* A call to make sure that the dummy code is linked in. */
_gcry_compat_identification ();
err = GPG_ERR_INV_OP;
}