Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72919 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81395 invoked from network); 5 Mar 2014 12:36:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2014 12:36:42 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.176 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.176 mail-ob0-f176.google.com Received: from [209.85.214.176] ([209.85.214.176:58756] helo=mail-ob0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/00-15230-95A17135 for ; Wed, 05 Mar 2014 07:36:42 -0500 Received: by mail-ob0-f176.google.com with SMTP id wp18so923495obc.7 for ; Wed, 05 Mar 2014 04:36:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4+5fyz1SLY83rp5x3Btxqu3YEUurVgaQemLByLCk2wg=; b=IFBwnYGHtca89Uha8gwlyMjtjgM43TdXAQSKKuMlRkZNIouem/hioOVTaE7BOrLTz0 PuWqII9wT83Z4cjWmObzfxNWm5/wOyvNOnzv2AeNP9k0ZOT8Dm9qeF2yedtxMuU3iH6E 1DuQ8p9+1OEywejIvYE/Kr+FlHgweS8gPCpeSvs3vaDyerVcDlCqAObNnepPPtcRqi0a cwTJ110/qT3RpGfG1u0lfGQsMD0BCMy4DS9aew6sRuUMVsiYn7H5nSULaH41c1SfqSr8 Zew58FB/7gqVovAWNxWz5KE/n3XwcKOOWWAmUbpIVzNTFfrs+JupEGYa8g4N9YAiwdFB 1Zdw== MIME-Version: 1.0 X-Received: by 10.182.126.167 with SMTP id mz7mr754983obb.69.1394022998604; Wed, 05 Mar 2014 04:36:38 -0800 (PST) Received: by 10.182.69.101 with HTTP; Wed, 5 Mar 2014 04:36:38 -0800 (PST) In-Reply-To: References: Date: Wed, 5 Mar 2014 13:36:38 +0100 Message-ID: To: Andrey Andreev Cc: "internals@lists.php.net" , Derick Rethans Content-Type: multipart/alternative; boundary=001a11c1f540a401ef04f3db453d Subject: Re: [PHP-DEV] Stricter error handling in mcrypt extension From: nikita.ppv@gmail.com (Nikita Popov) --001a11c1f540a401ef04f3db453d Content-Type: text/plain; charset=ISO-8859-1 On Tue, Mar 4, 2014 at 9:32 PM, Andrey Andreev wrote: > Hey, > > Speaking of bugs in MCrypt and IVs ... in ECB mode it complains if you > don't pass an IV, even though it is ignored afterwards. > You're probably referring to mcrypt_generic here, rather than mcrypt_encrypt. I can bring that function in line with mcrypt_encrypt, i.e. add the same error checks and make the IV only required if the mode requires it. However I'm not sure what kind of return value I should use with this function. Currently it returns a long result, which is 0 on success and a negative number on error. However mcrypt does not define error codes for all possible error conditions, e.g. while it has a code for invalid key sizes, it doesn't have a code for invalid IV sizes. Personally I'd just switch it to true/false for success/error, as the warnings already tell you what kind of error occurred. Would that be okay with you, Derick? Nikita --001a11c1f540a401ef04f3db453d--