2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-12-30 23:52:00 +00:00
|
|
|
<!-- $Revision: 1.9 $ -->
|
2007-12-30 13:15:56 +00:00
|
|
|
<refentry xml:id="function.mcrypt-generic-init" xmlns="http://docbook.org/ns/docbook">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>mcrypt_generic_init</refname>
|
|
|
|
<refpurpose>This function initializes all buffers needed for encryption</refpurpose>
|
|
|
|
</refnamediv>
|
2007-12-30 23:52:00 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-12-30 13:15:56 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>int</type><methodname>mcrypt_generic_init</methodname>
|
|
|
|
<methodparam><type>resource</type><parameter>td</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
|
|
|
<methodparam><type>string</type><parameter>iv</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2007-12-30 23:52:00 +00:00
|
|
|
You need to call this function before every call to
|
|
|
|
<function>mcrypt_generic</function> or
|
|
|
|
<function>mdecrypt_generic</function>.
|
2007-12-30 13:15:56 +00:00
|
|
|
</para>
|
2007-12-30 23:52:00 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>td</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The encryption descriptior.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>key</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The maximum length of the key should be the one obtained by calling
|
|
|
|
<function>mcrypt_enc_get_key_size</function> and every value smaller
|
|
|
|
than this is legal.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>iv</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The IV should normally have the size of the algorithms block size, but
|
|
|
|
you must obtain the size by calling
|
|
|
|
<function>mcrypt_enc_get_iv_size</function>. IV is ignored in ECB. IV
|
|
|
|
MUST exist in CFB, CBC, STREAM, nOFB and OFB modes. It needs to be
|
|
|
|
random and unique (but not secret). The same IV must be used for
|
|
|
|
encryption/decryption. If you do not want to use it you should set it
|
|
|
|
to zeros, but this is not recommended.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
2007-12-30 13:15:56 +00:00
|
|
|
<para>
|
|
|
|
The function returns a negative value on error, -3 when the key length
|
|
|
|
was incorrect, -4 when there was a memory allocation problem and any
|
|
|
|
other return value is an unknown error. If an error occurs a warning will
|
|
|
|
be displayed accordingly. &false; is returned if incorrect parameters
|
|
|
|
were passed.
|
|
|
|
</para>
|
2007-12-30 23:52:00 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-12-30 13:15:56 +00:00
|
|
|
<para>
|
2007-12-30 23:52:00 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>mcrypt_module_open</function></member>
|
|
|
|
</simplelist>
|
2007-12-30 13:15:56 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|