From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Apr 15 16:30:12 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 508581065670 for ; Sun, 15 Apr 2012 16:30:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 104C28FC0A for ; Sun, 15 Apr 2012 16:30:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3FGUBX5036093 for ; Sun, 15 Apr 2012 16:30:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3FGUBSo036090; Sun, 15 Apr 2012 16:30:11 GMT (envelope-from gnats) Resent-Date: Sun, 15 Apr 2012 16:30:11 GMT Resent-Message-Id: <201204151630.q3FGUBSo036090@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Christian Weisgerber Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FCFB106566C for ; Sun, 15 Apr 2012 16:21:32 +0000 (UTC) (envelope-from naddy@mips.inka.de) Received: from mail-in-06.arcor-online.net (mail-in-06.arcor-online.net [151.189.21.46]) by mx1.freebsd.org (Postfix) with ESMTP id AD31C8FC08 for ; Sun, 15 Apr 2012 16:21:31 +0000 (UTC) Received: from mail-in-19-z2.arcor-online.net (mail-in-19-z2.arcor-online.net [151.189.8.36]) by mx.arcor.de (Postfix) with ESMTP id 34DFC10BE66 for ; Sun, 15 Apr 2012 17:47:55 +0200 (CEST) Received: from mail-in-07.arcor-online.net (mail-in-07.arcor-online.net [151.189.21.47]) by mail-in-19-z2.arcor-online.net (Postfix) with ESMTP id 119D4D79C3 for ; Sun, 15 Apr 2012 17:47:55 +0200 (CEST) Received: from lorvorc.mips.inka.de (dslb-094-217-098-125.pools.arcor-ip.net [94.217.98.125]) by mail-in-07.arcor-online.net (Postfix) with ESMTPS id 02EE8107EC3 for ; Sun, 15 Apr 2012 17:47:54 +0200 (CEST) Received: from lorvorc.mips.inka.de (localhost [127.0.0.1]) by lorvorc.mips.inka.de (8.14.5/8.14.3) with ESMTP id q3FFlsSV049152 for ; Sun, 15 Apr 2012 17:47:54 +0200 (CEST) (envelope-from naddy@lorvorc.mips.inka.de) Received: (from naddy@localhost) by lorvorc.mips.inka.de (8.14.5/8.14.5/Submit) id q3FFlsoq049151; Sun, 15 Apr 2012 17:47:54 +0200 (CEST) (envelope-from naddy) Message-Id: <201204151547.q3FFlsoq049151@lorvorc.mips.inka.de> Date: Sun, 15 Apr 2012 17:47:54 +0200 (CEST) From: Christian Weisgerber To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/166968: archivers/unrar: speed up decryption X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Christian Weisgerber List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Apr 2012 16:30:12 -0000 >Number: 166968 >Category: ports >Synopsis: archivers/unrar: speed up decryption >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Apr 15 16:30:11 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Christian Weisgerber >Release: FreeBSD 7.4-STABLE amd64 >Organization: >Environment: System: FreeBSD lorvorc.mips.inka.de 7.4-STABLE FreeBSD 7.4-STABLE #0: Sat Apr 14 12:42:37 CEST 2012 naddy@lorvorc.mips.inka.de:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Use OpenSSL instead of the included AES code to speed up extraction of encrypted archives. >How-To-Repeat: >Fix: Index: Makefile =================================================================== RCS file: /home/pcvs/ports/archivers/unrar/Makefile,v retrieving revision 1.74 diff -u -r1.74 Makefile --- Makefile 19 Feb 2012 06:05:10 -0000 1.74 +++ Makefile 15 Apr 2012 15:45:41 -0000 @@ -7,7 +7,7 @@ PORTNAME= unrar PORTVERSION= 4.10 -PORTREVISION= 1 +PORTREVISION= 2 PORTEPOCH= 5 CATEGORIES+= archivers MASTER_SITES= http://www.rarlab.com/rar/ \ Index: files/patch-makefile.unix =================================================================== RCS file: files/patch-makefile.unix diff -N files/patch-makefile.unix --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-makefile.unix 15 Apr 2012 15:45:41 -0000 @@ -0,0 +1,14 @@ +--- makefile.unix.orig 2012-04-05 23:34:11.000000000 +0200 ++++ makefile.unix 2012-04-05 23:34:26.000000000 +0200 +@@ -8,9 +8,10 @@ + # Linux using GCC + CXX=g++ + CXXFLAGS=-O2 +-DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE ++DEFINES=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DOPENSSL + STRIP=strip + DESTDIR=/usr ++LIBS=-lcrypto + + # Linux using LCC + #CXX=lcc Index: files/patch-os.hpp =================================================================== RCS file: files/patch-os.hpp diff -N files/patch-os.hpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-os.hpp 15 Apr 2012 15:45:41 -0000 @@ -0,0 +1,13 @@ +--- os.hpp.orig 2012-04-05 22:20:56.000000000 +0200 ++++ os.hpp 2012-04-05 22:21:36.000000000 +0200 +@@ -193,6 +193,10 @@ + #include + #include + ++#ifdef OPENSSL ++#include ++#endif ++ + #ifdef S_IFLNK + #define SAVE_LINKS + #endif Index: files/patch-rijndael.cpp =================================================================== RCS file: files/patch-rijndael.cpp diff -N files/patch-rijndael.cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-rijndael.cpp 15 Apr 2012 15:45:41 -0000 @@ -0,0 +1,79 @@ +--- rijndael.cpp.orig 2012-01-09 14:46:08.000000000 +0100 ++++ rijndael.cpp 2012-04-05 23:36:23.000000000 +0200 +@@ -7,6 +7,8 @@ + **************************************************************************/ + #include "rar.hpp" + ++#ifndef OPENSSL ++ + const int uKeyLenInBytes=16, m_uRounds=10; + + static byte S[256],S5[256],rcon[30]; +@@ -54,6 +56,7 @@ inline void Copy128(byte *dest,const byt + #endif + } + ++#endif // OPENSSL + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // API +@@ -61,13 +64,21 @@ inline void Copy128(byte *dest,const byt + + Rijndael::Rijndael() + { ++#ifndef OPENSSL + if (S[0]==0) + GenerateTables(); ++#endif + } + + + void Rijndael::init(Direction dir,const byte * key,byte * initVector) + { ++#ifdef OPENSSL ++ EVP_CIPHER_CTX_init(&ctx); ++ EVP_CipherInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, initVector, ++ dir == Decrypt ? 0 : 1); ++ EVP_CIPHER_CTX_set_padding(&ctx, 0); ++#else + m_direction = dir; + + byte keyMatrix[_MAX_KEY_COLUMNS][4]; +@@ -82,6 +93,7 @@ void Rijndael::init(Direction dir,const + + if(m_direction == Decrypt) + keyEncToDec(); ++#endif // OPENSSL + } + + +@@ -91,6 +103,11 @@ size_t Rijndael::blockDecrypt(const byte + if (input == 0 || inputLen <= 0) + return 0; + ++#ifdef OPENSSL ++ int outLen; ++ EVP_CipherUpdate(&ctx, outBuffer, &outLen, input, inputLen); ++ return outLen; ++#else + byte block[16], iv[4][4]; + memcpy(iv,m_initVector,16); + +@@ -113,9 +130,11 @@ size_t Rijndael::blockDecrypt(const byte + memcpy(m_initVector,iv,16); + + return 16*numBlocks; ++#endif // OPENSSL + } + + ++#ifndef OPENSSL + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // ALGORITHM + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +@@ -296,3 +315,5 @@ void Rijndael::GenerateTables() + U1[b][0]=U2[b][1]=U3[b][2]=U4[b][3]=T5[i][0]=T6[i][1]=T7[i][2]=T8[i][3]=FFmul0e(b); + } + } ++ ++#endif // OPENSSL Index: files/patch-rijndael.hpp =================================================================== RCS file: files/patch-rijndael.hpp diff -N files/patch-rijndael.hpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/patch-rijndael.hpp 15 Apr 2012 15:45:41 -0000 @@ -0,0 +1,24 @@ +--- rijndael.hpp.orig 2012-01-09 14:46:08.000000000 +0100 ++++ rijndael.hpp 2012-04-05 22:42:56.000000000 +0200 +@@ -18,15 +18,21 @@ class Rijndael + public: + enum Direction { Encrypt , Decrypt }; + private: ++#ifndef OPENSSL + void keySched(byte key[_MAX_KEY_COLUMNS][4]); + void keyEncToDec(); + void encrypt(const byte a[16], byte b[16]); + void decrypt(const byte a[16], byte b[16]); + void GenerateTables(); ++#endif + ++#ifdef OPENSSL ++ EVP_CIPHER_CTX ctx; ++#else + Direction m_direction; + byte m_initVector[MAX_IV_SIZE]; + byte m_expandedKey[_MAX_ROUNDS+1][4][4]; ++#endif + public: + Rijndael(); + void init(Direction dir,const byte *key,byte *initVector); >Release-Note: >Audit-Trail: >Unformatted: