From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 72CAFE00B5C; Tue, 25 Apr 2017 20:29:54 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, WEIRD_QUOTING autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no * trust * [104.47.32.106 listed in list.dnswl.org] * -0.0 SPF_HELO_PASS SPF: HELO matches SPF record * 0.0 WEIRD_QUOTING BODY: Weird repeated double-quotation marks * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0106.outbound.protection.outlook.com [104.47.32.106]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8EF8EE00B47 for ; Tue, 25 Apr 2017 20:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freescale.onmicrosoft.com; s=selector1-freescale-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Qy0gSFBFyjFdqCYNFPP6rXdUs2m54LP0t0mHZQwCsTw=; b=N9dDlO7dm7K4OSI2ULE7kg1veaOJt+NZCP5FtPX4YiKmY5Ugwg3+QKCuklc/kN4mm2NzXAQKHwoqr1SeBMXLt857ACca3z/QElVi939+E7Bg8LWloYFLCq65tkxtJTxs9a3IkO+kqzBB9B8IGLqqVFZGnE3y43/7tWqMxzS9T1A= Received: from BN6PR03CA0064.namprd03.prod.outlook.com (10.173.137.26) by DM5PR03MB3179.namprd03.prod.outlook.com (10.174.240.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Wed, 26 Apr 2017 03:29:35 +0000 Received: from BN1BFFO11FD024.protection.gbl (2a01:111:f400:7c10::1:110) by BN6PR03CA0064.outlook.office365.com (2603:10b6:404:4c::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13 via Frontend Transport; Wed, 26 Apr 2017 03:29:35 +0000 Authentication-Results: spf=neutral (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=none action=none header.from=freescale.com; Received-SPF: Neutral (protection.outlook.com: 192.88.168.50 is neither permitted nor denied by domain of freescale.com) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD024.mail.protection.outlook.com (10.58.144.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1047.9 via Frontend Transport; Wed, 26 Apr 2017 03:29:35 +0000 Received: from sun.ap.freescale.net (sun.ap.freescale.net [10.192.208.75]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v3Q3SamZ013754; Tue, 25 Apr 2017 20:29:31 -0700 From: Chunrong Guo To: Date: Wed, 26 Apr 2017 11:28:24 +0800 Message-ID: <1493177312-32691-21-git-send-email-B40290@freescale.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1493177312-32691-1-git-send-email-B40290@freescale.com> References: <1493177312-32691-1-git-send-email-B40290@freescale.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(39860400002)(39410400002)(39400400002)(39450400003)(39850400002)(2980300002)(377424004)(199003)(189002)(9170700003)(305945005)(77096006)(5660300001)(76176999)(50466002)(50986999)(54906002)(7110500001)(8656002)(189998001)(6306002)(10710500007)(106466001)(42882006)(2351001)(6916009)(105586002)(2950100002)(6666003)(2906002)(53936002)(110136004)(81166006)(50226002)(4326008)(8936002)(8676002)(107886003)(38730400002)(36756003)(2870700001)(104016004)(15650500001)(5820100001)(23676002)(47776003)(575784001)(2420400007)(356003)(559001)(579004)(414714003)(473944003)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR03MB3179; H:tx30smr01.am.freescale.net; FPR:; SPF:Neutral; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD024; 1:Aii7/JlNZHJuHNnw5RniiQ3GPWEFyzrucdr7rghP70aKd6WIcVG9z7JrrizNiqzgDXjX/w7GIiJ+kYa/N1TIxmP7C45K4/hfzuVwFtuY2h/cWTYeqsJ+iY/8ZIW9DQgK/rJRcM9Q4NC6M9hSZKonTx7gs5xZI+c0uq9v1rydq5Nzr9YfXQNKOWz2g3ld2Jybkfbi1Bz1+TUBMc40NFhwom0wh74uNoL5npyBOo/NbKpz6rPHuT7F4trW6a1rpfaIlsVGVQ3lok3g4+ImWOhLjFTsLdyZ+eq8ijXssW8Yvkf1rtb7yLDCTMJQcUpWUMLjV4MitgjNIkszhyMQ5V6uWhMg1yiQm3BxNbtiF/NVTk2P8lv2rDAm0DHddGx5fuBAfxyBuODzMPrnlIliDuZ49jBRYt19I+NebSiybD3MJEHZUriPwiFHyAYTFSUsugM9hGMEEF1YEuE85EnQrAi9QXxBZ8VEZRQ6bY//8tS9zoSUZXAL8oXcQ9/itaewznexLlIMEw0zzK9zsrpD2mIRPjVKAS5DkmE2nGbwf5J7rYs+QO/lV2aoP9S77Gp8Eb2Ten8LQy0vHxyxFunO1eSU8w== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b994d057-7251-4ed0-c819-08d48c54762d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR03MB3179; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3179; 3:lA9NhAjhiBpVgnazvW3XEySlnz/LRlYxVGvyYwWgsgIwqNSc7n3Tg75e8umOVqeHZxGzMzq9FJvccFmN2kEUrGtL+wMTR6tMhYtBVdCEhhTAtGgr2xwcfXMBKkmuCLhPxPyl6C0E9JYDGknen4TAvR85OhAwyuQz0pR6WOziLC2LkrLYcskzwUzKpdO6g7OU7mIM9zaBmAhHEf7ryY8S9a3LfVMZ5u6+0NfZTYjSDtlhzikECJjSlhks70Z5oHVmnZt/pGJmPZIEHZnYX3KOBBP0Y+fLvf8qVJDoeQG3AxQCkCT6xI7ZlviqqIjS47mec4oleEaVE7pWP+gt+Dw+z63kb7HOmRJqTnkZSsX2UGDiD7f8Fa4e6e2BlkwMUyiV2HSAMSuKcE0RrPlahUv8mDuArBk7WRJSSJWNZa59+yiFgIueZ42qDzsElUaHb1lpc0VFx2iQqw8vzd/hQVgHzDKhJHTZA+2PI2nGt4LQTyjiRidWI8ZS07WE2IoVgzTc X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3179; 25:qV29ECI+OM4Szqu1ChBi+yVFqiZIJP71vKCVxEWg1cWXqPDEfnnQthK5rruzovRPQBPJZxSKn3jyjhYP4qhhhnRogl75F111ItAsfVZD8f/udcRrzwyWKCnaZcMgWnSFOtXzObkvoi3U45AnR1BxA50JtB7Jv1bY3V4/BGpae6Oj82y5+xLRwsy0wMoPSbNk71FZFjdCS6xtV9Aoe0rxDkdV0wXSLOLMgs8+8/OG8t0F1EJI74rmu3MIOaBLvPOLhBl6amLPkr3u2y2lSa4j2YRy9qXPX/qVNsjSwif/4yuDXQGUi3iTiS5lDsUUxjhQBqYJeZbu+ix6nJ/vqxND6xzX0jOhrauvGkuIlarZ4hdxsoXgTbukK8xaMuESABDH04PfDa2fz/goxQWs6oVIqlm1PVvdur2wh1ycVnG847F+NFkJAhrgN5q2E/cLI3u6hs52VgE50G18Ys2CvqslPQ==; 31:W9NCwMa0xAzz9+ER0EMGgSG5fE9k5EU+ba2g7cCsk4svb4nqjwMwZW3/CQVyQHY1GfhPhTCAmhAmjMuTpPTmJjcZsehQtX+A5opci1MVs3DPbOWABklzkBtVlVhQJrwa7NzHbBmvO3yl+jZWttpF8OzUf2t25Kp1ZxXFsoPoxOHiG8Ry3AIrX7/hV66lOcvFxNoPJj/bzYVMfZTOxdiszvk6yMUgmuoXajUyBSpZEgAQtuEdkC/5/vdvjl0zC3DHij+498LwGTXMI87oQtVaTQ== X-LD-Processed: 710a03f5-10f6-4d38-9ff4-a80b81da590d,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3179; 20:ZJRINHlJ/rVx/FAtQyw4H9KPC9vpOe0L2sm9FRRkm1T7hObTmlBjwdCcTjns1NMGULqM4Gtr+Y0SG/cBz2PJZsxSNlyd/PwU6vFptyXp0J/7veK/eWy4S1L6ikUpcxmepkyVHPVh/UJi1XzelSUcnnzNdwP4PBBlAs86isiGkygCmc9rwwvR3UM2AwiFu09o29w6E6KgmG5H+ic2+UukZ47Eri2uDpslCALbWR+8fjqpNfTExBNVQFSVFVdHeA2BNAnk0PFpK95SrBPq66pzaTx5hsM51S7BgeS/Vce0ETR91DxTULt/Uk0q12qy/sjtxPmpSk1hMP1i0R4bD3sH1ncRihs0gfVB5/iWJNwkEOCDFfm3PJ+eW5/+vsN5SZnUSFaDpJEG6kyJi4LEyt9S0dkDrWLnIutY3/jQojAZUOTrSpaQlUhUQ8xUlKMP/ShBSn3dzQGMAnVwvTwdyFMf2ldHGBDfeYQaKp0QaDvYnWOvnkumYFjvxNAXp6epCA7UDwZl3UCKbiG3YuU4es7h3BEXaIVTqN+a+YG8pLSe+fvMDmK/AmCwKoC88pl47uVknUUb5b6Ha6+0ms16CVBv606E/s8dKup9uz0LOxx/6XQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(20558992708506)(26323138287068)(22074186197030)(166708455590820)(185117386973197)(788757137089)(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13017025)(8121501046)(5005006)(13015025)(13023025)(13024025)(13018025)(10201501046)(93006095)(3002001)(6055026)(6041248)(20161123555025)(20161123564025)(20161123560025)(201703131423075)(201703011903075)(201702281528075)(201703061421075)(20161123562025)(6072148); SRVR:DM5PR03MB3179; BCL:0; PCL:0; RULEID:; SRVR:DM5PR03MB3179; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjAzTUIzMTc5OzQ6cHU5c1hGRDdWU2wzaDNjT2FzbEJPVE1hZFJs?= =?utf-8?B?a3lzT253NVhHY1dBUjhhRXY1VFc1a2I5b3VqT1dKdFFEYURuQ05BdHpMQ1h5?= =?utf-8?B?VnQ2VlJVdWo2N3N0cVFja1ZDa0J0V1NDUXVvN0Y3ZmlVZlhkTytpWU12ZWRj?= =?utf-8?B?ZkVUbzRvODFnQWU1TEIyT2I4R2p6K1Z4NVFFMmR0WnJ5amVEcCt5MlN0aG13?= =?utf-8?B?SXhmRlJ6OG1MWjlLZ2xYUU9JMVhmREJXQTBYdHhoVUVXNWtXdTBjMkcyVEhl?= =?utf-8?B?TkJoN1VOa1N0enV1RyswNkc4R1Avem1vclN4NU5YbWNBSGNGTHFaZ2tjVno2?= =?utf-8?B?WmdScFErSGlObFRtSkoxY3BVTExUcnVrV1hiQlk4NjdmMGRXUWNEMGN2SWE2?= =?utf-8?B?TXVoT0NpMlpBRFNLaVRuL3ZGOTY2dTNZZWZPZnFjYk5uRXNrYm1YZENHeEsv?= =?utf-8?B?VERZSGNVS0thcy94Q2J4dHR2MjBMTEJsSTNFT2JDcUY4ZXRqU2FNZyswYkRX?= =?utf-8?B?Zy9xQTk1Zk9QR3lVWHJJT2pkdWNUdUFFYXlWU29HSzR6WFFaelIzcG13eUFK?= =?utf-8?B?V2FZMEs0dFB6M0VsZHBNZjkwNlJUTW5abUJYbzR0SDViRFo4WlBwS3d2YjE0?= =?utf-8?B?ZUxab0llUE9oNVhNa0h3VHZMdDlCb01GTkx0aWJNNE5wRmxxNzVTUS9kRjl3?= =?utf-8?B?a0xobzlrZlgwVDhWTFVVaWZibWJiSDUwK2JIMGp3YlA2eFZ0NWVuNlVhdGNT?= =?utf-8?B?YjkrMkxxSmZIVVJnRTY5cDFsYWdIcFVHVkM2YUtCRTVrV28zeE5Va3grVE1n?= =?utf-8?B?WUdiUllIT2thNmx2akNVK2NNbGhXU3R6bkI2dzZXS1pURU15bTFaUWlrQkgv?= =?utf-8?B?SlcySVU1OGRBWjJYYVUwSWp0REZTWnE1WnpxT0xOUXZhbGFRZnpOVC9UYzlV?= =?utf-8?B?WElEV2JVWThqZUVXNnovbUMybEQ0K0tOWFVRVnV1WWw3TlJkMnZhQWpwTjVE?= =?utf-8?B?Lzk2ZG94d2w5Y21EZm1veGtWMXE1NzRyN2EvakNPb05KYlhCYlkxemVsb1Ns?= =?utf-8?B?Mm1QbUFVNFp6MTNJMXY2Mmp0ZXdUOWpDRDgveXpsc25VZDlRaEFETm9SSXhU?= =?utf-8?B?QVRQWVRERE13cFhERVkwQ3J2TGJ5MFVZK2FqRE1uc3ZpRURKWDJQM0UzZXN6?= =?utf-8?B?QlAwcVV5NVMxSDltdFU4YTVWSXJjSVFiN1VPc2ZoZ0p2eEZPd2xoSGgxSm51?= =?utf-8?B?bmtJaGI1NklTZ3hHK25TNFh5TS9lSExnUU13dzB0L2IrODQ2UWNRN0pOSmJW?= =?utf-8?B?TmdRY05hMFdIS2ZLYVJ2Z01LYUZyMXlNQTlPZkNSRUhwU0FTRHUvS1FJQzlZ?= =?utf-8?B?aUdGVEZvUTVGKzkxRFRENjBpSGtTeHJ5M0lkYmRONFM5bC9pVVIyY3g5S1pw?= =?utf-8?B?RTlyK2FtVjBDMXZzY1VnSm15UGJGN2t4czBMNEhmR29Ea1h1YzlmWkFyRWNK?= =?utf-8?Q?OSTR1WYyk0DR1jmmeIzjrP2P0mQQ4fT4ApGBozDpQuJZg?= X-Forefront-PRVS: 0289B6431E X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjAzTUIzMTc5OzIzOlUrMkN2VWtVd21USGxrdWRJb2oyV2JYUDU5?= =?utf-8?B?L3JQdHhnSlJWVWUxT043OHpoc3VLZk9pRkhrdW9hQ1EvWnd5enNuYzdJdktH?= =?utf-8?B?bVUwYmRtRlIyWnZYL0lIeTVDNEMxOWtjWGw0aWlNYU95Tmxic1J2NGw0RFMr?= =?utf-8?B?bEduV3BWUXUwbmtlZlNSMjlrODBST0ZOMzlCU1FhWUNTNU1CRldRM0JwRThx?= =?utf-8?B?Z0cxOXRUZ2l4K21kL1RpTzFtR2h6b0phU2hXY0xWSzlGZHF5dDRlNlpZd2xZ?= =?utf-8?B?NVZid2V6Vm1sRWEvWDlJVGFSWmlSV3FablNWcGY2c3hkdXJhcmg3YTFSVExw?= =?utf-8?B?ZFdOV3BydEk2bURJclRZOU1uNmhHOUhwemNrV3M2R3M0KzZReE5SaWlRU1N4?= =?utf-8?B?NEIwVkZKcTliQVlZU3dKRXA5WWxWUDV0dE5aSkZqU2sxNGd1RTFrVmZyKzBV?= =?utf-8?B?UHhvK0NSeE5xNHA5aTYxb09ySmhlRy9keGZHY2NvQzdDb3BrRHJWbXJLckF1?= =?utf-8?B?SHIyaXVWY3ZXNldNZUxCVFkxTlhwbjJma2RlcHhTeW9WQklnQ0tSaWZOTjRh?= =?utf-8?B?YWFjMEtrMGl4ZUlOTGdaUmQ1WW9SQ0RhNG55OGw5bjQrRUdFVHZDM1FWaEZo?= =?utf-8?B?WEw3ZDI1emMyRnVEVjlNNUltMWlONGt3amdJMzMyY1prWVBPUndGOTJ6aUU3?= =?utf-8?B?ZThBeStOclVGdVYzMEQ3T25iVnhhSzJkb3BGN0YzdVcraHY1MGJyMG03MWFK?= =?utf-8?B?V2lscFphZXAwL0p3aG1iSE55ajBoRXRFVE1EU2hpRVpDSHBvTlF6Y0l4Y3FF?= =?utf-8?B?RlNSMTN1SlpTalQzMVkrY1RCRkZCcnBlYzZmbUZxaTRaaU9TbWowOU5PUG1s?= =?utf-8?B?NE5KTCsvWlgyUDRxRzNvVW0rd25BcDVTUStScXFvcFZOUzErdGlHL3BUZE9H?= =?utf-8?B?UHdxdVdPMmg1emhGMVVvSkh0NlJCVXdzUmVWMC95WW9rU1o5c3ROVmVzUEJx?= =?utf-8?B?WHc0Q3BqYTZsd3ZEcFM4QkY1NnVNZlZnQnRGNUhiNFFFWUdnOGdCMVBNVENO?= =?utf-8?B?M2VWR0F0VHdTZlExMGlndnNTTVNzV0lWNWtQb3RWS2l1d1pCUDZrWTlwQTJn?= =?utf-8?B?SXk4S3hBMG1zd0JLRDZ5ZzBweFIxbHpCcHZKSlRJb2crUzlneHlFbU5JS0I3?= =?utf-8?B?Wnd0UUhQY3V4aFNEY0U3ZmtXUUlMWm9TTkNZdXByNEt3WGFzME03d3l5OWYy?= =?utf-8?B?VTR4c1gwOE1FZy9kNEluNk0wYTJkaFhMdHpyNXJEeTBLcUVQQnczbmpJc2xk?= =?utf-8?B?SjNGcWhkcWdoUGFFR2VpNlZ3cmlxVXRhNnlibmN6YVdJSFFNTG9aOWJJTzFx?= =?utf-8?B?SUZWQ1E2aGwxcVl1UjlQUnFWa2w5L0Q5WXIvZ2lYbTdlSXhTaHhuR0xqVVdl?= =?utf-8?B?eVArN0NPR3pacDFORHFER3dJN21oWUVkYnRMWVZUNTdyZ3lzemFlSDRlYzln?= =?utf-8?B?cUpTQllOeVZ3ekgzellHdEpaT3N3RVVqK0ZuTThOeTZaSWhJOXBDTlh0cnFH?= =?utf-8?B?LzhjdVBUUDJ2WGVEMHUxNzhKSG01OEtkNnRpL2dpdmI5bnV3cjl1RU9oWjFQ?= =?utf-8?B?T0wvb2NuT1dsUGdkS1kxNVdhd2kzaHJ4MjRnQldGbTJ4Ukkxa051Qm5CQkRm?= =?utf-8?B?TXBnYkd6bUxzNkxLSXhiWEFjRTZjU1k2QStwUGFtaXNSa0c1cmhaU1RIZXhC?= =?utf-8?B?SGpuVTR0dW96cWJMbUo5ZlVqNHZ1eTMxLzVyOFl1NXBQL3pWTFZoc1JkVXlX?= =?utf-8?B?UXBEc0ZxNXZ5ZXpKM2Q0MHJxai95Yi83ang3S3ZpTzFnMUE9PQ==?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3179; 6:a28B2bWSZIue2/WjiRY0Ml3n9sDmCm1BVgWKGPU9GntkGjRaJxSQAdrKZW3/xqztJ8CUFIIwsOzTTbSclTaqe6ZimI10bEDeZJDf0enOA4Ci0VZmf07xueXyHjloBW1IxRQS9RuWuO5U6lLlUd+84s1i5lFOiib4m9QDD3AOlXtCiL71GkeRVtd5UIWd71qB1TkKW17+Lm+IWRumV+dHqUs4oJ55qilQt0l2zv3EmrUT+sEiH3WP4JWQ9xwQM0dxk86MEqNAa7POHrL5U0EVgncFMUJUwkKIrcPHShAJoff60DBx3WJCWnTf+NfN+kB5d7n5EIVGzPZXiPE51foCSvHJKhk5j3AOR7sf5nZ9Aq0eC6ziaKM0C3NtDFtVQLnI7EG2EP8SKBBDpI+LQIh2Mp+8aD7yX2m3eDJYZKX5eX3UmEufaoQ14Kum9hRESQpUIUkT2DQZotCfP/h6NV1EfmPE2/H3PcvNXL1t2LzOwN1FQq8/OJ+nEOb0+2FDQu9SPp+nDFfFf6K3xsciLPLOeWqaKtybmJsEHHJzwATUwJI=; 5:225s4hTzflWWA8BSf1hYy1ga4rWHbOirkwhIGi9WcLVR1ouGWJGRsn8W9jecjb5NY5T43/VQrwZdqJGPRig+kVkLGegLJFFUJ/3Z84DvbYCcs+MXw1Eo16UKA+qzUyZJaWeAY9gikhZnp3vpJrYBLo9y/zetnYnYGbW/DB1Ay/A=; 24:SKC+806TMIKWaf48KxF3/mgSUnhbfJ3LaS5AnAHdTsq8qs90dLcFbbcJw/vzWXtOGjrrtXbKhLcKleBXDzQRUfsdEmS7jotnMXez7jZSRT0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3179; 7:a8ONxS/+LTAQs9ZL8SB2Hk8QFJwcZLDrmFu6rgsIKVDqO0T6xi73oQu4bdeNHfWmX3D4p9I1EQiVEQyL9wGzVdLg43K4nhsHiQFJkvFkVhvTRoc3ECudNUkgrz3kDulzdNu+RKR4NanF38Lbs2E3JsISBS6bGghsZf5BeWzcbAZbiBogZvBO2lf7G5jb4ht+wGaL9BsrorbdpMAcRbDA1ZHF/D+7nJd4Q1bFnf5c/UGV3act8bVj+L3bCeaGY4UtRuxhfA09qjO3VAVQMNANcI7NtH40QZKBBpVHfVx8PgVfeUJCChE90c8jR3EaysDcuha6z8sKqXk8MWWuNMi1NA== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2017 03:29:35.2063 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB3179 Cc: zongchun.yu@nxp.com, chunrong.guo@nxp.com Subject: [[PATCH v2 21/29] cryptodev: update to 6c2b61c X-BeenThere: meta-freescale@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Usage and development list for the meta-fsl-* layers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 03:29:54 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit From: Chunrong Guo **include the following changes 6c2b61c - update copyright notes f79d523 - fix: reset finish condition before test start e8f7a91 - Merge remote-tracking branch 'upstream/master' 6818263 - Fix ablkcipher algorithms usage in v4.8+ kernels 26e167f - zc: Use the power of #elif e49fe25 - adjust to API changes in kernel >=4.10 2b29be8 - adjust to API changes in kernel >=4.10 c3afb40 - add support for rsa speed tests c9b7a80 - close the session after every test ba49470 - add support for authenc(hmac(sha1), cbc(aes)) speed tests 690cd62 - Merge branch 'master' into hpe2016 5adf04e - Merge remote-tracking branch 'upstream/master' 840c7ba - remove not used variable 2dbbb23 - do more strict code checking to avoid maintenance issues 88223e4 - avoid implicit conversion between signed and unsigned char 8db6905 - use buf_align macro to reduce code duplication b6d0e0f - rename header file to clarify purpose 1fd6062 - fix warnings of "implicit declaration of function" in async_speed ff3c8ab - remove not used local variables 25a1276 - fix incorrect return code in case of error from openssl_cioccrypt e7ef4ea - Merge pull request #17 from michaelweiser/gup_flags 99c6d21 - fix ignored SIGALRM signals on some platforms 71975fa - setting KERNEL_DIR is not necessary to build tests a96ff97 - fix issues with install target 07748d3 - Merge branch 'master' into hpe2016 cc89148 - Fix ablkcipher algorithms usage in v4.8+ kernels 4d6e4fb - Merge remote-tracking branch 'upstream/master' f126e48 - Adjust to another change in the user page API 4257fce - add -async option to run_crypto_tests.sh f953164 - merge sync and async benchmarks into a single program e7af57b - add % to cpu idle for convenience 1883c95 - add a wrapper script for running all tests 998b66b - add notes about configured limits in SEC driver b1a35f3 - fix ignored SIGALRM signals on some platforms b754517 - use the same algorithm names in sync_speed as in async_speed 8baefa4 - force LC_TIME value to avoid mpstat not using ISO8601 format d0978b5 - add sync speed tests with the same format as async ones 15d890b - graceful exit if cryptodev is not built with ASYNC flags 9a595bf - fix typo, use consistent spacing 9461878 - remove output line because it does not add clarity to the results b09c17f - the C standard used by cryptodev is C90 with GNU extensions 447808d - exit early if cryptodev tests are not installed 493afd3 - fix incorrect handling of error cases... e0d2c88 - make default output tabular abc007a - really fix (again...) the mpstat issue 2696cd5 - use $(...) instead of `...` for consistency e8fb004 - fix the scale of the runtime value 119151b - remove old results to avoid incorrect reports 71ac3d5 - fix the reported unit 8c47a0c - setting KERNEL_DIR is not necessary to build tests 182b307 - fix issues with install target 5021828 - do more strict code checking to avoid maintenance issues ab239d7 - return error code of the test if there is one b5228f2 - remove not used local variables 90d67ce - avoid implicit conversion between signed and unsigned char 4b442ca - fix build warnings on implicit function declarations 2821b92 - add a little space in the output for clarity 9d0ef05 - more precision in running mpstat 0180e2b - fix some issues with parsing mpstat output 4257fce - add -async option to run_crypto_tests.sh f953164 - merge sync and async benchmarks into a single program e7af57b - add % to cpu idle for convenience 7d7a733 - sanity check on /dev/crypto availability 137c0c4 - gracefull stop for async speed tests 600eb70 - fix: set min value when allocating alligned memory buffers 18408c9 - add multithreaded wrapper for async speed test 854cc84 - rename algorithm names for clarity 216f235 - honor the -m flag in async_speed 1023ede - add flag to report in a machine friendly format 219a8b4 - enable async code by default 9def784 - Merge remote-tracking branch 'radualexe/new_tests` 149dc1c - add basic optargs support for async_speed test 9595499 - add support for crc32c hash sync speed test 83e3840 - add support for aes-256-xts sync speed test fff72ae - add support for sha2-256 hash async speed test b961800 - add support for sha1 hash async speed test fea5006 - add support for crc32c hash async speed test 8768fad - add aes-256-xts support for async speed test Signed-off-by: Chunrong Guo --- recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc | 63 + ...-aes-256-xts-support-for-async-speed-test.patch | 64 + ...-support-for-crc32c-hash-async-speed-test.patch | 92 + ...dd-support-for-sha1-hash-async-speed-test.patch | 47 + ...upport-for-sha2-256-hash-async-speed-test.patch | 47 + ...d-support-for-aes-256-xts-sync-speed-test.patch | 48 + ...d-support-for-crc32c-hash-sync-speed-test.patch | 63 + ...asic-optargs-support-for-async_speed-test.patch | 439 +++++ .../0051-enable-async-code-by-default.patch | 37 + ...ag-to-report-in-a-machine-friendly-format.patch | 55 + .../0053-honor-the-m-flag-in-async_speed.patch | 137 ++ .../0054-rename-algorithm-names-for-clarity.patch | 57 + ...ultithreaded-wrapper-for-async-speed-test.patch | 173 ++ ...-value-when-allocating-alligned-memory-bu.patch | 58 + ...0057-gracefull-stop-for-async-speed-tests.patch | 64 + ...8-sanity-check-on-dev-crypto-availability.patch | 26 + ...ix-some-issues-with-parsing-mpstat-output.patch | 42 + .../0060-more-precision-in-running-mpstat.patch | 55 + ...-a-little-space-in-the-output-for-clarity.patch | 27 + ...arnings-on-implicit-function-declarations.patch | 129 ++ ...cit-conversion-between-signed-and-unsigne.patch | 698 ++++++++ .../0064-remove-not-used-local-variables.patch | 129 ++ ...rn-error-code-of-the-test-if-there-is-one.patch | 68 + ...ict-code-checking-to-avoid-maintenance-is.patch | 25 + .../0067-fix-issues-with-install-target.patch | 52 + ...ERNEL_DIR-is-not-necessary-to-build-tests.patch | 24 + .../sdk_patches/0069-fix-the-reported-unit.patch | 29 + ...ve-old-results-to-avoid-incorrect-reports.patch | 27 + .../0071-fix-the-scale-of-the-runtime-value.patch | 29 + .../0072-use-.-instead-of-.-for-consistency.patch | 82 + .../0073-really-fix-again.-the-mpstat-issue.patch | 34 + .../0074-make-default-output-tabular.patch | 83 + ...075-fix-incorrect-handling-of-error-cases.patch | 27 + ...arly-if-cryptodev-tests-are-not-installed.patch | 48 + ...ard-used-by-cryptodev-is-C90-with-GNU-ext.patch | 66 + ...ut-line-because-it-does-not-add-clarity-t.patch | 32 + .../0079-fix-typo-use-consistent-spacing.patch | 28 + ...it-if-cryptodev-is-not-built-with-ASYNC-f.patch | 31 + ...eed-tests-with-the-same-format-as-async-o.patch | 718 ++++++++ ...ME-value-to-avoid-mpstat-not-using-ISO860.patch | 31 + ...e-algorithm-names-in-sync_speed-as-in-asy.patch | 58 + ...ignored-SIGALRM-signals-on-some-platforms.patch | 44 + ...tes-about-configured-limits-in-SEC-driver.patch | 56 + ...dd-a-wrapper-script-for-running-all-tests.patch | 58 + .../0087-add-to-cpu-idle-for-convenience.patch | 26 + ...and-async-benchmarks-into-a-single-progra.patch | 1858 ++++++++++++++++++++ ...9-add-async-option-to-run_crypto_tests.sh.patch | 62 + ...90-Adjust-to-recent-user-page-API-changes.patch | 55 + .../0091-Fix-test-compile-time-warnings.patch | 65 + ...rt-skcipher-in-addition-to-ablkcipher-API.patch | 281 +++ ...lkcipher-algorithms-usage-in-v4.8-kernels.patch | 147 ++ ...st-to-another-change-in-the-user-page-API.patch | 36 + ...095-rename-header-file-to-clarify-purpose.patch | 173 ++ ...uf_align-macro-to-reduce-code-duplication.patch | 248 +++ ...cit-conversion-between-signed-and-unsigne.patch | 304 ++++ ...uce-tests-Makefile-distance-with-upstream.patch | 25 + ...-for-authenc-hmac-sha1-cbc-aes-speed-test.patch | 288 +++ .../0100-close-the-session-after-every-test.patch | 108 ++ .../0101-add-support-for-rsa-speed-tests.patch | 179 ++ ...0102-adjust-to-API-changes-in-kernel-4.10.patch | 57 + .../0103-zc-Use-the-power-of-elif.patch | 51 + ...-reset-finish-condition-before-test-start.patch | 29 + .../sdk_patches/0105-update-copyright-notes.patch | 77 + ...talling-header-file-provided-by-another-p.patch | 19 +- ...date-the-install-path-for-cryptodev-tests.patch | 28 + 65 files changed, 8303 insertions(+), 13 deletions(-) create mode 100644 recipes-kernel/cryptodev/sdk_patches/0044-add-aes-256-xts-support-for-async-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0046-add-support-for-sha1-hash-async-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0047-add-support-for-sha2-256-hash-async-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0048-add-support-for-aes-256-xts-sync-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0050-add-basic-optargs-support-for-async_speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0051-enable-async-code-by-default.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0052-add-flag-to-report-in-a-machine-friendly-format.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0053-honor-the-m-flag-in-async_speed.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0054-rename-algorithm-names-for-clarity.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0056-fix-set-min-value-when-allocating-alligned-memory-bu.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0057-gracefull-stop-for-async-speed-tests.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0058-sanity-check-on-dev-crypto-availability.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0059-fix-some-issues-with-parsing-mpstat-output.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0060-more-precision-in-running-mpstat.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0061-add-a-little-space-in-the-output-for-clarity.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0062-fix-build-warnings-on-implicit-function-declarations.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0063-avoid-implicit-conversion-between-signed-and-unsigne.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0064-remove-not-used-local-variables.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0065-return-error-code-of-the-test-if-there-is-one.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0066-do-more-strict-code-checking-to-avoid-maintenance-is.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0067-fix-issues-with-install-target.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0068-setting-KERNEL_DIR-is-not-necessary-to-build-tests.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0069-fix-the-reported-unit.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0070-remove-old-results-to-avoid-incorrect-reports.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0071-fix-the-scale-of-the-runtime-value.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0072-use-.-instead-of-.-for-consistency.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0073-really-fix-again.-the-mpstat-issue.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0074-make-default-output-tabular.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0075-fix-incorrect-handling-of-error-cases.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0076-exit-early-if-cryptodev-tests-are-not-installed.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0077-the-C-standard-used-by-cryptodev-is-C90-with-GNU-ext.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0078-remove-output-line-because-it-does-not-add-clarity-t.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0079-fix-typo-use-consistent-spacing.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0080-graceful-exit-if-cryptodev-is-not-built-with-ASYNC-f.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0081-add-sync-speed-tests-with-the-same-format-as-async-o.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0082-force-LC_TIME-value-to-avoid-mpstat-not-using-ISO860.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0083-use-the-same-algorithm-names-in-sync_speed-as-in-asy.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0084-fix-ignored-SIGALRM-signals-on-some-platforms.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0085-add-notes-about-configured-limits-in-SEC-driver.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0086-add-a-wrapper-script-for-running-all-tests.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0087-add-to-cpu-idle-for-convenience.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0088-merge-sync-and-async-benchmarks-into-a-single-progra.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0089-add-async-option-to-run_crypto_tests.sh.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0090-Adjust-to-recent-user-page-API-changes.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0091-Fix-test-compile-time-warnings.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0092-Support-skcipher-in-addition-to-ablkcipher-API.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0093-Fix-ablkcipher-algorithms-usage-in-v4.8-kernels.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0094-Adjust-to-another-change-in-the-user-page-API.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0097-avoid-implicit-conversion-between-signed-and-unsigne.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0098-reduce-tests-Makefile-distance-with-upstream.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0099-add-support-for-authenc-hmac-sha1-cbc-aes-speed-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0100-close-the-session-after-every-test.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0101-add-support-for-rsa-speed-tests.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0102-adjust-to-API-changes-in-kernel-4.10.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0103-zc-Use-the-power-of-elif.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0104-fix-reset-finish-condition-before-test-start.patch create mode 100644 recipes-kernel/cryptodev/sdk_patches/0105-update-copyright-notes.patch create mode 100644 recipes-kernel/cryptodev/yocto_patches/0003-update-the-install-path-for-cryptodev-tests.patch diff --git a/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc b/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc index 4c7cb93..b55a33c 100644 --- a/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc +++ b/recipes-kernel/cryptodev/cryptodev-qoriq_1.8.inc @@ -64,7 +64,70 @@ file://0040-fix-structure-init-in-sha_speed-test.patch \ file://0041-add-separate-target-for-building-tests.patch \ file://0042-fix-destination-for-staged-installs.patch \ file://0043-add-install-target-for-tests.patch \ +file://0044-add-aes-256-xts-support-for-async-speed-test.patch \ +file://0045-add-support-for-crc32c-hash-async-speed-test.patch \ +file://0046-add-support-for-sha1-hash-async-speed-test.patch \ +file://0047-add-support-for-sha2-256-hash-async-speed-test.patch \ +file://0048-add-support-for-aes-256-xts-sync-speed-test.patch \ +file://0049-add-support-for-crc32c-hash-sync-speed-test.patch \ +file://0050-add-basic-optargs-support-for-async_speed-test.patch \ +file://0051-enable-async-code-by-default.patch \ +file://0052-add-flag-to-report-in-a-machine-friendly-format.patch \ +file://0053-honor-the-m-flag-in-async_speed.patch \ +file://0054-rename-algorithm-names-for-clarity.patch \ +file://0055-add-multithreaded-wrapper-for-async-speed-test.patch \ +file://0056-fix-set-min-value-when-allocating-alligned-memory-bu.patch \ +file://0057-gracefull-stop-for-async-speed-tests.patch \ +file://0058-sanity-check-on-dev-crypto-availability.patch \ +file://0059-fix-some-issues-with-parsing-mpstat-output.patch \ +file://0060-more-precision-in-running-mpstat.patch \ +file://0061-add-a-little-space-in-the-output-for-clarity.patch \ +file://0062-fix-build-warnings-on-implicit-function-declarations.patch \ +file://0063-avoid-implicit-conversion-between-signed-and-unsigne.patch \ +file://0064-remove-not-used-local-variables.patch \ +file://0065-return-error-code-of-the-test-if-there-is-one.patch \ +file://0066-do-more-strict-code-checking-to-avoid-maintenance-is.patch \ +file://0067-fix-issues-with-install-target.patch \ +file://0068-setting-KERNEL_DIR-is-not-necessary-to-build-tests.patch \ +file://0069-fix-the-reported-unit.patch \ +file://0070-remove-old-results-to-avoid-incorrect-reports.patch \ +file://0071-fix-the-scale-of-the-runtime-value.patch \ +file://0072-use-.-instead-of-.-for-consistency.patch \ +file://0073-really-fix-again.-the-mpstat-issue.patch \ +file://0074-make-default-output-tabular.patch \ +file://0075-fix-incorrect-handling-of-error-cases.patch \ +file://0076-exit-early-if-cryptodev-tests-are-not-installed.patch \ +file://0077-the-C-standard-used-by-cryptodev-is-C90-with-GNU-ext.patch \ +file://0078-remove-output-line-because-it-does-not-add-clarity-t.patch \ +file://0079-fix-typo-use-consistent-spacing.patch \ +file://0080-graceful-exit-if-cryptodev-is-not-built-with-ASYNC-f.patch \ +file://0081-add-sync-speed-tests-with-the-same-format-as-async-o.patch \ +file://0082-force-LC_TIME-value-to-avoid-mpstat-not-using-ISO860.patch \ +file://0083-use-the-same-algorithm-names-in-sync_speed-as-in-asy.patch \ +file://0084-fix-ignored-SIGALRM-signals-on-some-platforms.patch \ +file://0085-add-notes-about-configured-limits-in-SEC-driver.patch \ +file://0086-add-a-wrapper-script-for-running-all-tests.patch \ +file://0087-add-to-cpu-idle-for-convenience.patch \ +file://0088-merge-sync-and-async-benchmarks-into-a-single-progra.patch \ +file://0089-add-async-option-to-run_crypto_tests.sh.patch \ +file://0090-Adjust-to-recent-user-page-API-changes.patch \ +file://0091-Fix-test-compile-time-warnings.patch \ +file://0092-Support-skcipher-in-addition-to-ablkcipher-API.patch \ +file://0093-Fix-ablkcipher-algorithms-usage-in-v4.8-kernels.patch \ +file://0094-Adjust-to-another-change-in-the-user-page-API.patch \ +file://0095-rename-header-file-to-clarify-purpose.patch \ +file://0096-use-buf_align-macro-to-reduce-code-duplication.patch \ +file://0097-avoid-implicit-conversion-between-signed-and-unsigne.patch \ +file://0098-reduce-tests-Makefile-distance-with-upstream.patch \ +file://0099-add-support-for-authenc-hmac-sha1-cbc-aes-speed-test.patch \ +file://0100-close-the-session-after-every-test.patch \ +file://0101-add-support-for-rsa-speed-tests.patch \ +file://0102-adjust-to-API-changes-in-kernel-4.10.patch \ +file://0103-zc-Use-the-power-of-elif.patch \ +file://0104-fix-reset-finish-condition-before-test-start.patch \ +file://0105-update-copyright-notes.patch \ " +SRC_URI_append = " file://0003-update-the-install-path-for-cryptodev-tests.patch" # NOTE: remove this patch and all traces of DISTRO_FEATURE c29x_pkc # if pkc-host does not need customized cryptodev patches anymore diff --git a/recipes-kernel/cryptodev/sdk_patches/0044-add-aes-256-xts-support-for-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0044-add-aes-256-xts-support-for-async-speed-test.patch new file mode 100644 index 0000000..8a3c4f2 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0044-add-aes-256-xts-support-for-async-speed-test.patch @@ -0,0 +1,64 @@ +From 6a89ac4c49068d4225f4c1cc94a1d20b3d174b3f Mon Sep 17 00:00:00 2001 +From: Radu Alexe +Date: Sat, 22 Oct 2016 21:55:25 +0300 +Subject: [PATCH 044/104] add aes-256-xts support for async speed test + +Signed-off-by: Radu Alexe +--- + ioctl.c | 3 +++ + tests/async_speed.c | 25 +++++++++++++++++++++++++ + 2 files changed, 28 insertions(+) + +diff --git a/ioctl.c b/ioctl.c +index 8d81b56..ca3c5ac 100644 +--- a/ioctl.c ++++ b/ioctl.c +@@ -172,6 +172,9 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) + case CRYPTO_AES_ECB: + alg_name = "ecb(aes)"; + break; ++ case CRYPTO_AES_XTS: ++ alg_name = "xts(aes)"; ++ break; + case CRYPTO_CAMELLIA_CBC: + alg_name = "cbc(camellia)"; + break; +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 1188599..39a3d23 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -211,6 +211,31 @@ int main(void) + break; + } + ++ fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AES_XTS; ++ sess.keylen = 32; ++ memset(keybuf, 0x42, sess.keylen); ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ alignmask = siop.alignmask; ++#endif ++ ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (encrypt_data(&sess, fdc, i, alignmask)) ++ break; ++ } ++ ++end: + close(fdc); + close(fd); + return 0; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch new file mode 100644 index 0000000..b1a790e --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0045-add-support-for-crc32c-hash-async-speed-test.patch @@ -0,0 +1,92 @@ +From aa329106f586f8d055ceaa919e327ebc99bdd6e3 Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 11:15:37 +0300 +Subject: [PATCH 045/104] add support for crc32c hash async speed test + +Signed-off-by: Alexe Radu +--- + crypto/cryptodev.h | 1 + + ioctl.c | 4 ++++ + tests/async_speed.c | 25 +++++++++++++++++++++++++ + 3 files changed, 30 insertions(+) + +diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h +index 9ade102..05221a4 100644 +--- a/crypto/cryptodev.h ++++ b/crypto/cryptodev.h +@@ -46,6 +46,7 @@ enum cryptodev_crypto_op_t { + CRYPTO_AES_XTS = 22, + CRYPTO_AES_ECB = 23, + CRYPTO_AES_GCM = 50, ++ CRYPTO_CRC32C, + + CRYPTO_CAMELLIA_CBC = 101, + CRYPTO_RIPEMD160, +diff --git a/ioctl.c b/ioctl.c +index ca3c5ac..2e2bdeb 100644 +--- a/ioctl.c ++++ b/ioctl.c +@@ -286,6 +286,10 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) + hash_name = "sha512"; + hmac_mode = 0; + break; ++ case CRYPTO_CRC32C: ++ hash_name = "crc32c"; ++ hmac_mode = 0; ++ break; + default: + ddebug(1, "bad mac: %d", sop->mac); + return -EINVAL; +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 39a3d23..8978b4b 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -65,6 +65,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + { + struct crypt_op cop; + char *buffer[64], iv[32]; ++ char mac[64][HASH_MAX_LEN]; + static int val = 23; + struct timeval start, end; + double total = 0; +@@ -114,6 +115,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + cop.iv = (unsigned char *)iv; + cop.op = COP_ENCRYPT; + cop.src = cop.dst = (unsigned char *)buffer[bufidx]; ++ cop.mac = mac[bufidx]; + bufidx = (bufidx + 1) % 64; + + if (ioctl(fdc, CIOCASYNCCRYPT, &cop)) { +@@ -235,6 +237,29 @@ int main(void) + break; + } + ++ fprintf(stderr, "\nTesting CRC32C hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_CRC32C; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ printf("requested hash CRYPTO_CRC32C, got %s with driver %s\n", ++ siop.hash_info.cra_name, siop.hash_info.cra_driver_name); ++ alignmask = siop.alignmask; ++#endif ++ ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (encrypt_data(&sess, fdc, i, alignmask)) ++ break; ++ } ++ + end: + close(fdc); + close(fd); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0046-add-support-for-sha1-hash-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0046-add-support-for-sha1-hash-async-speed-test.patch new file mode 100644 index 0000000..fb902fb --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0046-add-support-for-sha1-hash-async-speed-test.patch @@ -0,0 +1,47 @@ +From c2fed59ef63a1b9da26e8a5452004b07aad39261 Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 11:21:47 +0300 +Subject: [PATCH 046/104] add support for sha1 hash async speed test + +Signed-off-by: Alexe Radu +--- + tests/async_speed.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 8978b4b..64d5603 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -260,6 +260,29 @@ int main(void) + break; + } + ++ fprintf(stderr, "\nTesting SHA-1 hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_SHA1; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ printf("requested hash CRYPTO_SHA1, got %s with driver %s\n", ++ siop.hash_info.cra_name, siop.hash_info.cra_driver_name); ++ alignmask = siop.alignmask; ++#endif ++ ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (encrypt_data(&sess, fdc, i, alignmask)) ++ break; ++ } ++ + end: + close(fdc); + close(fd); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0047-add-support-for-sha2-256-hash-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0047-add-support-for-sha2-256-hash-async-speed-test.patch new file mode 100644 index 0000000..2721ea8 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0047-add-support-for-sha2-256-hash-async-speed-test.patch @@ -0,0 +1,47 @@ +From 14c5355aa23f970c7941afa460b2335f8e67445f Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 11:28:09 +0300 +Subject: [PATCH 047/104] add support for sha2-256 hash async speed test + +Signed-off-by: Alexe Radu +--- + tests/async_speed.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 64d5603..15ab80c 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -283,6 +283,29 @@ int main(void) + break; + } + ++ fprintf(stderr, "\nTesting SHA2-256 hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_SHA2_256; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ printf("requested hash CRYPTO_SHA2_256, got %s with driver %s\n", ++ siop.hash_info.cra_name, siop.hash_info.cra_driver_name); ++ alignmask = siop.alignmask; ++#endif ++ ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (encrypt_data(&sess, fdc, i, alignmask)) ++ break; ++ } ++ + end: + close(fdc); + close(fd); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0048-add-support-for-aes-256-xts-sync-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0048-add-support-for-aes-256-xts-sync-speed-test.patch new file mode 100644 index 0000000..85301aa --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0048-add-support-for-aes-256-xts-sync-speed-test.patch @@ -0,0 +1,48 @@ +From 139268835b7d84472950e3ed866f41d79a0cb723 Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 12:05:13 +0300 +Subject: [PATCH 048/104] add support for aes-256-xts sync speed test + +Signed-off-by: Alexe Radu +--- + tests/speed.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/tests/speed.c b/tests/speed.c +index 81c5a65..16ad7b7 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -206,6 +206,30 @@ int main(int argc, char** argv) + break; + } + ++ fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AES_XTS; ++ sess.keylen = 32; ++ memset(keybuf, 0x42, sess.keylen); ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSINFO)"); ++ return 1; ++ } ++ alignmask = siop.alignmask; ++#endif ++ ++ for (i = 512; i <= (64 * 1024); i *= 2) { ++ if (encrypt_data(&sess, fdc, i, alignmask)) ++ break; ++ } ++ + close(fdc); + close(fd); + return 0; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch new file mode 100644 index 0000000..26279b6 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0049-add-support-for-crc32c-hash-sync-speed-test.patch @@ -0,0 +1,63 @@ +From af3d42a68f1e356d21e52e72f3f5ebc7cfd90e81 Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 12:13:58 +0300 +Subject: [PATCH 049/104] add support for crc32c hash sync speed test + +Signed-off-by: Alexe Radu +--- + tests/speed.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +diff --git a/tests/speed.c b/tests/speed.c +index 16ad7b7..bd6d2b2 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -74,6 +74,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + { + struct crypt_op cop; + char *buffer, iv[32]; ++ char mac[HASH_MAX_LEN]; + static int val = 23; + struct timeval start, end; + double total = 0; +@@ -110,6 +111,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + cop.iv = (unsigned char *)iv; + cop.op = COP_ENCRYPT; + cop.src = cop.dst = (unsigned char *)buffer; ++ cop.mac = mac; + + if (ioctl(fdc, CIOCCRYPT, &cop)) { + perror("ioctl(CIOCCRYPT)"); +@@ -230,6 +232,29 @@ int main(int argc, char** argv) + break; + } + ++ fprintf(stderr, "\nTesting CRC32C hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_CRC32C; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++#ifdef CIOCGSESSINFO ++ siop.ses = sess.ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSINFO)"); ++ return 1; ++ } ++ printf("requested hash CRYPTO_CRC32C, got %s with driver %s\n", ++ siop.hash_info.cra_name, siop.hash_info.cra_driver_name); ++ alignmask = siop.alignmask; ++#endif ++ ++ for (i = 512; i <= (64 * 1024); i *= 2) { ++ if (encrypt_data(&sess, fdc, i, alignmask)) ++ break; ++ } ++ + close(fdc); + close(fd); + return 0; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0050-add-basic-optargs-support-for-async_speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0050-add-basic-optargs-support-for-async_speed-test.patch new file mode 100644 index 0000000..f54286a --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0050-add-basic-optargs-support-for-async_speed-test.patch @@ -0,0 +1,439 @@ +From 13cb1f2dcf8865b076a7e8290d8f864d91a2d7c7 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Mon, 24 Oct 2016 16:33:55 +0300 +Subject: [PATCH 050/104] add basic optargs support for async_speed test + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 302 +++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 202 insertions(+), 100 deletions(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 15ab80c..fff3414 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -27,9 +27,45 @@ + #include + #include + #include ++#include ++#include + + #ifdef ENABLE_ASYNC + ++struct test_params { ++ bool tflag; ++ bool nflag; ++ int tvalue; ++ int nvalue; ++}; ++ ++const char usage_str[] = "Usage: %s [OPTION]... |\n" ++ "Run benchmark test for cipher or hash\n\n" ++ " -t \t" "time to run each test (default 10 secs)\n" ++ " -n \t" "size of the test buffer\n" ++ " -h\t\t" "show this help\n" ++; ++ ++int run_null(int fdc, struct test_params tp); ++int run_aes_cbc(int fdc, struct test_params tp); ++int run_aes_xts(int fdc, struct test_params tp); ++int run_crc32c(int fdc, struct test_params tp); ++int run_sha1(int fdc, struct test_params tp); ++int run_sha256(int fdc, struct test_params tp); ++ ++#define ALG_COUNT 6 ++struct { ++ char *name; ++ int (*func)(int, struct test_params); ++} ciphers[ALG_COUNT] = { ++ {"null", run_null}, ++ {"aes-cbc", run_aes_cbc}, ++ {"aes-xts", run_aes_xts}, ++ {"crc32c", run_crc32c}, ++ {"sha1", run_sha1}, ++ {"sha256", run_sha256}, ++}; ++ + static double udifftimeval(struct timeval start, struct timeval end) + { + return (double)(end.tv_usec - start.tv_usec) + +@@ -61,7 +97,7 @@ static void value2human(double bytes, double time, double* data, double* speed,c + } + + +-int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) ++int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + { + struct crypt_op cop; + char *buffer[64], iv[32]; +@@ -72,31 +108,33 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + double secs, ddata, dspeed; + char metric[16]; + int rc, wqueue = 0, bufidx = 0; ++ int alignmask; + + memset(iv, 0x23, 32); + +- printf("\tEncrypting in chunks of %d bytes: ", chunksize); ++ printf("\tEncrypting in chunks of %d bytes: ", tp.nvalue); + fflush(stdout); + ++ alignmask = get_alignmask(fdc, sess); + for (rc = 0; rc < 64; rc++) { + if (alignmask) { +- if (posix_memalign((void **)(buffer + rc), alignmask + 1, chunksize)) { ++ if (posix_memalign((void **)(buffer + rc), alignmask + 1, tp.nvalue)) { + printf("posix_memalign() failed!\n"); + return 1; + } + } else { +- if (!(buffer[rc] = malloc(chunksize))) { ++ if (!(buffer[rc] = malloc(tp.nvalue))) { + perror("malloc()"); + return 1; + } + } +- memset(buffer[rc], val++, chunksize); ++ memset(buffer[rc], val++, tp.nvalue); + } + pfd.fd = fdc; + pfd.events = POLLOUT | POLLIN; + + must_finish = 0; +- alarm(5); ++ alarm(tp.tvalue); + + gettimeofday(&start, NULL); + do { +@@ -111,7 +149,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + if (pfd.revents & POLLOUT) { + memset(&cop, 0, sizeof(cop)); + cop.ses = sess->ses; +- cop.len = chunksize; ++ cop.len = tp.nvalue; + cop.iv = (unsigned char *)iv; + cop.op = COP_ENCRYPT; + cop.src = cop.dst = (unsigned char *)buffer[bufidx]; +@@ -146,25 +184,75 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + return 0; + } + +-int main(void) ++void usage(char *cmd_name) + { +- int fd, i, fdc = -1, alignmask = 0; +- struct session_op sess; +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +-#endif +- char keybuf[32]; ++ printf(usage_str, cmd_name); ++} + +- signal(SIGALRM, alarm_handler); ++int run_test(int id, struct test_params tp) ++{ ++ int fd; ++ int fdc; + +- if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) { ++ fd = open("/dev/crypto", O_RDWR, 0); ++ if (fd < 0) { + perror("open()"); +- return 1; ++ return fd; + } + if (ioctl(fd, CRIOGET, &fdc)) { + perror("ioctl(CRIOGET)"); +- return 1; ++ return -EINVAL; ++ } ++ ++ ciphers[id].func(fdc, tp); ++ ++ close(fdc); ++ close(fd); ++} ++ ++int get_alignmask(int fdc, struct session_op *sess) ++{ ++ int alignmask; ++ ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++ ++ siop.ses = sess->ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSINFO)"); ++ return -EINVAL; ++ } ++ alignmask = siop.alignmask; ++#else ++ alignmask = 0; ++#endif ++ ++ return alignmask; ++} ++ ++void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ int i; ++ ++ if (tp.nflag) { ++ encrypt_data(fdc, tp, sess); ++ } else { ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ tp.nvalue = i; ++ if (encrypt_data(fdc, tp, sess)) { ++ break; ++ } ++ } + } ++} ++ ++ ++int run_null(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ int alignmask; ++ int i; + + fprintf(stderr, "Testing NULL cipher: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -173,21 +261,19 @@ int main(void) + sess.key = (unsigned char *)keybuf; + if (ioctl(fdc, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return 1; ++ return -EINVAL; + } +- alignmask = siop.alignmask; +-#endif + +- for (i = 256; i <= (64 * 4096); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_aes_cbc(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ int alignmask; ++ int i; + + fprintf(stderr, "\nTesting AES-128-CBC cipher: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -197,21 +283,17 @@ int main(void) + sess.key = (unsigned char *)keybuf; + if (ioctl(fdc, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return 1; ++ return -EINVAL; + } +- alignmask = siop.alignmask; +-#endif + +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_aes_xts(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; + + fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -221,21 +303,16 @@ int main(void) + sess.key = (unsigned char *)keybuf; + if (ioctl(fdc, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +- return 1; ++ return -EINVAL; + } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- alignmask = siop.alignmask; +-#endif + +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_crc32c(int fdc, struct test_params tp) ++{ ++ struct session_op sess; + + fprintf(stderr, "\nTesting CRC32C hash: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -244,21 +321,14 @@ int main(void) + perror("ioctl(CIOCGSESSION)"); + return 1; + } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- printf("requested hash CRYPTO_CRC32C, got %s with driver %s\n", +- siop.hash_info.cra_name, siop.hash_info.cra_driver_name); +- alignmask = siop.alignmask; +-#endif + +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_sha1(int fdc, struct test_params tp) ++{ ++ struct session_op sess; + + fprintf(stderr, "\nTesting SHA-1 hash: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -267,21 +337,14 @@ int main(void) + perror("ioctl(CIOCGSESSION)"); + return 1; + } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- printf("requested hash CRYPTO_SHA1, got %s with driver %s\n", +- siop.hash_info.cra_name, siop.hash_info.cra_driver_name); +- alignmask = siop.alignmask; +-#endif + +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_sha256(int fdc, struct test_params tp) ++{ ++ struct session_op sess; + + fprintf(stderr, "\nTesting SHA2-256 hash: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -290,25 +353,64 @@ int main(void) + perror("ioctl(CIOCGSESSION)"); + return 1; + } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- printf("requested hash CRYPTO_SHA2_256, got %s with driver %s\n", +- siop.hash_info.cra_name, siop.hash_info.cra_driver_name); +- alignmask = siop.alignmask; +-#endif + +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int main(int argc, char **argv) ++{ ++ int i; ++ int c; ++ int index; ++ bool alg_flag; ++ char *alg_name; ++ struct test_params tp; ++ ++ tp.tflag = false; ++ tp.nflag = false; ++ alg_flag = false; ++ opterr = 0; ++ while ((c = getopt(argc, argv, "hn:t:")) != -1) { ++ switch (c) { ++ case 'n': ++ tp.nvalue = atoi(optarg); ++ tp.nflag = true; ++ break; ++ case 't': ++ tp.tvalue = atoi(optarg); ++ tp.tflag = true; + break; ++ case 'h': /* no break */ ++ default: ++ usage(argv[0]); ++ exit(1); ++ } ++ } ++ ++ /* the name of a specific test asked on the command line */ ++ if (optind < argc) { ++ alg_name = argv[optind]; ++ alg_flag = true; ++ } ++ ++ /* default test time */ ++ if (!tp.tflag) { ++ tp.tvalue = 5; ++ } ++ ++ signal(SIGALRM, alarm_handler); ++ ++ for (i = 0; i < ALG_COUNT; i++) { ++ if (alg_flag) { ++ if (strcmp(alg_name, ciphers[i].name) == 0) { ++ run_test(i, tp); ++ } ++ } else { ++ run_test(i, tp); ++ } + } + +-end: +- close(fdc); +- close(fd); + return 0; + } + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0051-enable-async-code-by-default.patch b/recipes-kernel/cryptodev/sdk_patches/0051-enable-async-code-by-default.patch new file mode 100644 index 0000000..cfe4cd9 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0051-enable-async-code-by-default.patch @@ -0,0 +1,37 @@ +From 6b31215e77b89fd7bd4dcfb6e4e3a9ee53e7731d Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 25 Oct 2016 15:03:19 +0300 +Subject: [PATCH 051/104] enable async code by default + +Signed-off-by: Cristian Stoica +--- + Makefile | 2 +- + tests/Makefile | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 9871a8e..3934e1f 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,7 +3,7 @@ + # disabled by default. To re-enable it uncomment the + # corresponding CFLAG. + # +-CRYPTODEV_CFLAGS ?= #-DENABLE_ASYNC ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC + KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS) + KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build + VERSION = 1.8 +diff --git a/tests/Makefile b/tests/Makefile +index 5e3111d..683f40b 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -1,4 +1,5 @@ + KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC + KBUILD_CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0052-add-flag-to-report-in-a-machine-friendly-format.patch b/recipes-kernel/cryptodev/sdk_patches/0052-add-flag-to-report-in-a-machine-friendly-format.patch new file mode 100644 index 0000000..c2b88a5 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0052-add-flag-to-report-in-a-machine-friendly-format.patch @@ -0,0 +1,55 @@ +From 6d2e0927c2ed2795267d7652d9413d7e01da202e Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 25 Oct 2016 16:54:06 +0300 +Subject: [PATCH 052/104] add flag to report in a machine friendly format + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index fff3414..1941750 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -35,6 +35,7 @@ + struct test_params { + bool tflag; + bool nflag; ++ bool mflag; + int tvalue; + int nvalue; + }; +@@ -43,6 +44,7 @@ const char usage_str[] = "Usage: %s [OPTION]... |\n" + "Run benchmark test for cipher or hash\n\n" + " -t \t" "time to run each test (default 10 secs)\n" + " -n \t" "size of the test buffer\n" ++ " -m\t\t" "output in a machine readable format\n" + " -h\t\t" "show this help\n" + ; + +@@ -369,9 +371,10 @@ int main(int argc, char **argv) + + tp.tflag = false; + tp.nflag = false; ++ tp.mflag = false; + alg_flag = false; + opterr = 0; +- while ((c = getopt(argc, argv, "hn:t:")) != -1) { ++ while ((c = getopt(argc, argv, "hn:t:m")) != -1) { + switch (c) { + case 'n': + tp.nvalue = atoi(optarg); +@@ -381,6 +384,9 @@ int main(int argc, char **argv) + tp.tvalue = atoi(optarg); + tp.tflag = true; + break; ++ case 'm': ++ tp.mflag = true; ++ break; + case 'h': /* no break */ + default: + usage(argv[0]); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0053-honor-the-m-flag-in-async_speed.patch b/recipes-kernel/cryptodev/sdk_patches/0053-honor-the-m-flag-in-async_speed.patch new file mode 100644 index 0000000..4653920 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0053-honor-the-m-flag-in-async_speed.patch @@ -0,0 +1,137 @@ +From 9aae91f24b42a9a812cd0518c0c4ef3f548d64d1 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 25 Oct 2016 17:02:29 +0300 +Subject: [PATCH 053/104] honor the -m flag in async_speed + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 36 ++++++++++++++++++++++++------------ + 1 file changed, 24 insertions(+), 12 deletions(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 1941750..73ec9d2 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -29,6 +29,8 @@ + #include + #include + #include ++#include ++#include + + #ifdef ENABLE_ASYNC + +@@ -85,7 +87,7 @@ static void alarm_handler(int signo) + + static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; + +-static void value2human(double bytes, double time, double* data, double* speed,char* metric) ++static void value2human(uint64_t bytes, double time, double* data, double* speed,char* metric) + { + int unit = 0; + +@@ -98,6 +100,11 @@ static void value2human(double bytes, double time, double* data, double* speed,c + sprintf(metric, "%sB", units[unit]); + } + ++static void value2machine(uint64_t bytes, double time, double* speed) ++{ ++ *speed = bytes / time; ++} ++ + + int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + { +@@ -106,7 +113,7 @@ int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + char mac[64][HASH_MAX_LEN]; + static int val = 23; + struct timeval start, end; +- double total = 0; ++ uint64_t total = 0; + double secs, ddata, dspeed; + char metric[16]; + int rc, wqueue = 0, bufidx = 0; +@@ -114,8 +121,10 @@ int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + + memset(iv, 0x23, 32); + +- printf("\tEncrypting in chunks of %d bytes: ", tp.nvalue); +- fflush(stdout); ++ if (!tp.mflag) { ++ printf("\tBuffer size %d bytes: ", tp.nvalue); ++ fflush(stdout); ++ } + + alignmask = get_alignmask(fdc, sess); + for (rc = 0; rc < 64; rc++) { +@@ -177,9 +186,14 @@ int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + + secs = udifftimeval(start, end)/ 1000000.0; + +- value2human(total, secs, &ddata, &dspeed, metric); +- printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); +- printf ("%.2f %s/sec\n", dspeed, metric); ++ if (tp.mflag) { ++ value2machine(total, secs, &dspeed); ++ printf("%" PRIu64 "\t%.2f\t%.2f\n", total, secs, dspeed); ++ } else { ++ value2human(total, secs, &ddata, &dspeed, metric); ++ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); ++ printf ("%.2f %s/sec\n", dspeed, metric); ++ } + + for (rc = 0; rc < 64; rc++) + free(buffer[rc]); +@@ -206,6 +220,9 @@ int run_test(int id, struct test_params tp) + return -EINVAL; + } + ++ if (!tp.mflag) { ++ fprintf(stderr, "Testing %s:\n", ciphers[id].name); ++ } + ciphers[id].func(fdc, tp); + + close(fdc); +@@ -277,7 +294,6 @@ int run_aes_cbc(int fdc, struct test_params tp) + int alignmask; + int i; + +- fprintf(stderr, "\nTesting AES-128-CBC cipher: \n"); + memset(&sess, 0, sizeof(sess)); + sess.cipher = CRYPTO_AES_CBC; + sess.keylen = 16; +@@ -297,7 +313,6 @@ int run_aes_xts(int fdc, struct test_params tp) + struct session_op sess; + char keybuf[32]; + +- fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); + memset(&sess, 0, sizeof(sess)); + sess.cipher = CRYPTO_AES_XTS; + sess.keylen = 32; +@@ -316,7 +331,6 @@ int run_crc32c(int fdc, struct test_params tp) + { + struct session_op sess; + +- fprintf(stderr, "\nTesting CRC32C hash: \n"); + memset(&sess, 0, sizeof(sess)); + sess.mac = CRYPTO_CRC32C; + if (ioctl(fdc, CIOCGSESSION, &sess)) { +@@ -332,7 +346,6 @@ int run_sha1(int fdc, struct test_params tp) + { + struct session_op sess; + +- fprintf(stderr, "\nTesting SHA-1 hash: \n"); + memset(&sess, 0, sizeof(sess)); + sess.mac = CRYPTO_SHA1; + if (ioctl(fdc, CIOCGSESSION, &sess)) { +@@ -348,7 +361,6 @@ int run_sha256(int fdc, struct test_params tp) + { + struct session_op sess; + +- fprintf(stderr, "\nTesting SHA2-256 hash: \n"); + memset(&sess, 0, sizeof(sess)); + sess.mac = CRYPTO_SHA2_256; + if (ioctl(fdc, CIOCGSESSION, &sess)) { +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0054-rename-algorithm-names-for-clarity.patch b/recipes-kernel/cryptodev/sdk_patches/0054-rename-algorithm-names-for-clarity.patch new file mode 100644 index 0000000..242f4a6 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0054-rename-algorithm-names-for-clarity.patch @@ -0,0 +1,57 @@ +From f71ba99a8943767c39df5104e86054c9c0e76fd8 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 25 Oct 2016 17:31:40 +0300 +Subject: [PATCH 054/104] rename algorithm names for clarity + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 73ec9d2..263ead7 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -51,8 +51,8 @@ const char usage_str[] = "Usage: %s [OPTION]... |\n" + ; + + int run_null(int fdc, struct test_params tp); +-int run_aes_cbc(int fdc, struct test_params tp); +-int run_aes_xts(int fdc, struct test_params tp); ++int run_aes_128_cbc(int fdc, struct test_params tp); ++int run_aes_256_xts(int fdc, struct test_params tp); + int run_crc32c(int fdc, struct test_params tp); + int run_sha1(int fdc, struct test_params tp); + int run_sha256(int fdc, struct test_params tp); +@@ -63,8 +63,8 @@ struct { + int (*func)(int, struct test_params); + } ciphers[ALG_COUNT] = { + {"null", run_null}, +- {"aes-cbc", run_aes_cbc}, +- {"aes-xts", run_aes_xts}, ++ {"aes-128-cbc", run_aes_128_cbc}, ++ {"aes-256-xts", run_aes_256_xts}, + {"crc32c", run_crc32c}, + {"sha1", run_sha1}, + {"sha256", run_sha256}, +@@ -287,7 +287,7 @@ int run_null(int fdc, struct test_params tp) + return 0; + } + +-int run_aes_cbc(int fdc, struct test_params tp) ++int run_aes_128_cbc(int fdc, struct test_params tp) + { + struct session_op sess; + char keybuf[32]; +@@ -308,7 +308,7 @@ int run_aes_cbc(int fdc, struct test_params tp) + return 0; + } + +-int run_aes_xts(int fdc, struct test_params tp) ++int run_aes_256_xts(int fdc, struct test_params tp) + { + struct session_op sess; + char keybuf[32]; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch new file mode 100644 index 0000000..4129010 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch @@ -0,0 +1,173 @@ +From 789d3c5ecda60a6dc5d5b3597047ad65c412f10d Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 25 Oct 2016 15:30:59 +0300 +Subject: [PATCH 055/104] add multithreaded wrapper for async speed test + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 1 + + tests/async_speed_multi.sh | 140 +++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 141 insertions(+) + create mode 100755 tests/async_speed_multi.sh + +diff --git a/tests/Makefile b/tests/Makefile +index 683f40b..6424c11 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -40,6 +40,7 @@ install: + for prog in $(hostprogs); do \ + install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \ + done ++ install -m 755 async_speed_multi.sh $(DESTDIR)/$(bindir) + + clean: + rm -f *.o *~ $(hostprogs) +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +new file mode 100755 +index 0000000..761c0cb +--- /dev/null ++++ b/tests/async_speed_multi.sh +@@ -0,0 +1,140 @@ ++#!/bin/bash ++# ++# Copyright 2016 NXP Semiconductors ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++ ++ ++# no user-configurable options below this line ++ ++NUM_CORES=`nproc` ++OUT_BASENAME="async_speed" ++MPSTAT="mpstat" ++MPSTAT_OUT="mpstat_out" ++ ++function usage ++{ ++cat << EOF ++Usage: `basename $0` [OPTIONS] ++ ++ -m number of threads to run with (defaults to number of cores) ++ -t time to run each test (default 10 secs) ++ -n size of the test buffer (default 256 bytes) ++ -h show this help ++ ++alg_name: null, aes-128-cbc, aes-256-xts, sha1, sha256, crc32c ++EOF ++} ++ ++function SUM { ++ paste -sd+ - | bc -l ++} ++ ++function get_cpu_idle ++{ ++ header_line=`grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g'` ++ idle_column=`echo $header_line | wc -w` ++ ++ all_cpu_idle=`grep all ${MPSTAT_OUT} | tail -n +2 | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | SUM` ++ mpstat_lines=`grep all ${MPSTAT_OUT} | tail -n +2 | wc -l` ++ ++ average_idle=`echo "scale=2; $all_cpu_idle / $mpstat_lines" | bc -l` ++ echo $average_idle ++} ++ ++function run_parallel ++{ ++ trap control_c SIGINT ++ ++ OPTIONS="-t $tvalue -n $nvalue -m" ++ CMD="async_speed $OPTIONS $alg_name" ++ ++ echo "Running $mvalue threads in parallel:" ++ echo " $CMD" ++ ++ $MPSTAT 1 $(($tvalue-1)) &> $MPSTAT_OUT & ++ MPSTAT_PID=$! ++ ++ PIDS="" ++ start=`date +%s.%N` ++ ++ for i in `seq 0 $(($mvalue-1))` ++ do ++ CMD_OUT="${OUT_BASENAME}_${i}" ++ ++ $CMD &> $CMD_OUT & ++ PID=$! ++ AFFINITY=$(($i % $NUM_CORES)) ++ taskset -pc $AFFINITY $PID > /dev/null ++ ++ PIDS="$PID $PIDS" ++ done ++ ++ wait $PIDS ++ end=`date +%s.%N` ++ ++ wait $MPSTAT_PID ++ ++ runtime=$(echo "scale=2; $end - $start" | bc -l ) ++ total_data=`cat ${OUT_BASENAME}_* | cut -f 1 | SUM` ++ avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) ++ cpu_idle=`get_cpu_idle` ++ ++ echo ++ echo "buffer size : $nvalue" ++ echo "running time : $runtime" ++ echo "avg_speed : $avg_speed GiB/s" ++ echo "all_cpu idle : $cpu_idle %" ++ echo ++} ++ ++function control_c ++{ ++ killall async_speed > /dev/null ++ killall mpstat > /dev/null ++} ++ ++function main ++{ ++ while getopts hm:t:n: option ++ do ++ case "$option" in ++ m) mvalue="$OPTARG";; ++ t) tvalue="$OPTARG";; ++ n) nvalue="$OPTARG";; ++ *) usage $0; exit 1;; ++ esac ++ done ++ ++ shift $((OPTIND-1)) ++ alg_name=$1 ++ ++ [ -z "$tvalue" ] && tvalue=10 # 10 seconds per test by default ++ [ -z "$mvalue" ] && mvalue=`nproc` # thread count defaults to nproc ++ [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size ++ ++ case "$alg_name" in ++ "null" |\ ++ "aes-128-cbc" |\ ++ "aes-256-xts" |\ ++ "sha1" |\ ++ "sha256" |\ ++ "crc32c" ) run_parallel;; ++ * ) usage && exit 1;; ++ esac ++} ++ ++main "$@" ++ +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0056-fix-set-min-value-when-allocating-alligned-memory-bu.patch b/recipes-kernel/cryptodev/sdk_patches/0056-fix-set-min-value-when-allocating-alligned-memory-bu.patch new file mode 100644 index 0000000..d98e588 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0056-fix-set-min-value-when-allocating-alligned-memory-bu.patch @@ -0,0 +1,58 @@ +From ad7fee26da24fca57efee5ba10756e001769b2ce Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 16:46:11 +0300 +Subject: [PATCH 056/104] fix: set min value when allocating alligned memory + buffers + +The function "posix_memalign()" requires that the alignment be at least +sizeof(void*). In some situations the alignmask for some crypto algorithms +is smaller then the minimum required. For ex. on 64-bit platforms where +the alignment may be 4 bytes. + +Signed-off-by: Alexe Radu +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 4 ++++ + tests/speed.c | 2 ++ + 2 files changed, 6 insertions(+) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index 263ead7..b895a85 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -232,6 +232,7 @@ int run_test(int id, struct test_params tp) + int get_alignmask(int fdc, struct session_op *sess) + { + int alignmask; ++ int min_alignmask = sizeof(void*) - 1; + + #ifdef CIOCGSESSINFO + struct session_info_op siop; +@@ -242,6 +243,9 @@ int get_alignmask(int fdc, struct session_op *sess) + return -EINVAL; + } + alignmask = siop.alignmask; ++ if (alignmask < min_alignmask) { ++ alignmask = min_alignmask; ++ } + #else + alignmask = 0; + #endif +diff --git a/tests/speed.c b/tests/speed.c +index bd6d2b2..0b14c88 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -80,8 +80,10 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + double total = 0; + double secs, ddata, dspeed; + char metric[16]; ++ int min_alignmask = sizeof(void*) - 1; + + if (alignmask) { ++ alignmask = ((alignmask < min_alignmask) ? min_alignmask : alignmask); + if (posix_memalign((void **)&buffer, MAX(alignmask + 1, sizeof(void*)), chunksize)) { + printf("posix_memalign() failed! (mask %x, size: %d)\n", alignmask+1, chunksize); + return 1; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0057-gracefull-stop-for-async-speed-tests.patch b/recipes-kernel/cryptodev/sdk_patches/0057-gracefull-stop-for-async-speed-tests.patch new file mode 100644 index 0000000..5ba0578 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0057-gracefull-stop-for-async-speed-tests.patch @@ -0,0 +1,64 @@ +From f7e3566382bf22fc73c5a0edfde5c5349a92f8ea Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Tue, 25 Oct 2016 18:35:13 +0300 +Subject: [PATCH 057/104] gracefull stop for async speed tests + +Signed-off-by: Alexe Radu +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index b895a85..e6bbeed 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -77,6 +77,7 @@ static double udifftimeval(struct timeval start, struct timeval end) + } + + static int must_finish = 0; ++static int must_exit = 0; + static struct pollfd pfd; + + static void alarm_handler(int signo) +@@ -85,6 +86,12 @@ static void alarm_handler(int signo) + pfd.events = POLLIN; + } + ++static void exit_handler(int signo) ++{ ++ must_exit = 1; ++ printf("\nexit requested by user through ctrl+c \n"); ++} ++ + static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; + + static void value2human(uint64_t bytes, double time, double* data, double* speed,char* metric) +@@ -261,6 +268,10 @@ void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) + encrypt_data(fdc, tp, sess); + } else { + for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (must_exit) { ++ break; ++ } ++ + tp.nvalue = i; + if (encrypt_data(fdc, tp, sess)) { + break; +@@ -422,8 +433,13 @@ int main(int argc, char **argv) + } + + signal(SIGALRM, alarm_handler); ++ signal(SIGINT, exit_handler); + + for (i = 0; i < ALG_COUNT; i++) { ++ if (must_exit) { ++ break; ++ } ++ + if (alg_flag) { + if (strcmp(alg_name, ciphers[i].name) == 0) { + run_test(i, tp); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0058-sanity-check-on-dev-crypto-availability.patch b/recipes-kernel/cryptodev/sdk_patches/0058-sanity-check-on-dev-crypto-availability.patch new file mode 100644 index 0000000..6273330 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0058-sanity-check-on-dev-crypto-availability.patch @@ -0,0 +1,26 @@ +From b04d0b7ccb9150d4f16c712a830f8a4e3bdd2d05 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 09:29:36 +0300 +Subject: [PATCH 058/104] sanity check on /dev/crypto availability + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 761c0cb..94c2312 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -108,6 +108,8 @@ function control_c + + function main + { ++ [ ! -e "/dev/crypto" ] && sudo modprobe cryptodev || modprobe cryptodev || exit 1 ++ + while getopts hm:t:n: option + do + case "$option" in +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0059-fix-some-issues-with-parsing-mpstat-output.patch b/recipes-kernel/cryptodev/sdk_patches/0059-fix-some-issues-with-parsing-mpstat-output.patch new file mode 100644 index 0000000..fd2feda --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0059-fix-some-issues-with-parsing-mpstat-output.patch @@ -0,0 +1,42 @@ +From 28c87b3dd5ed2ac90185b09bdc7233648d5d89b5 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 09:14:28 +0300 +Subject: [PATCH 059/104] fix some issues with parsing mpstat output + +- mpstat with 'count' parameter will average the results for us on the + last line so we don't need to do this ourselves. +- set time format to ISO to avoid incorrect parsing of the header line + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 94c2312..a28f72d 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -21,6 +21,7 @@ + + NUM_CORES=`nproc` + OUT_BASENAME="async_speed" ++S_TIME_FORMAT=ISO + MPSTAT="mpstat" + MPSTAT_OUT="mpstat_out" + +@@ -47,10 +48,8 @@ function get_cpu_idle + header_line=`grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g'` + idle_column=`echo $header_line | wc -w` + +- all_cpu_idle=`grep all ${MPSTAT_OUT} | tail -n +2 | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | SUM` +- mpstat_lines=`grep all ${MPSTAT_OUT} | tail -n +2 | wc -l` +- +- average_idle=`echo "scale=2; $all_cpu_idle / $mpstat_lines" | bc -l` ++ average_idle=`grep Average ${MPSTAT_OUT} | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | tail -n 1` ++ + echo $average_idle + } + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0060-more-precision-in-running-mpstat.patch b/recipes-kernel/cryptodev/sdk_patches/0060-more-precision-in-running-mpstat.patch new file mode 100644 index 0000000..ae749bd --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0060-more-precision-in-running-mpstat.patch @@ -0,0 +1,55 @@ +From 26291db7df602d3d3d5601817229822b13904fe9 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 09:48:44 +0300 +Subject: [PATCH 060/104] more precision in running mpstat + +Start mpstat one second later than the tests so we don't measure +transient issues. Likewise, stop mpstat just before the tests terminate +so we don't record incorrect CPU idle. + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index a28f72d..5268c86 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -22,7 +22,6 @@ + NUM_CORES=`nproc` + OUT_BASENAME="async_speed" + S_TIME_FORMAT=ISO +-MPSTAT="mpstat" + MPSTAT_OUT="mpstat_out" + + function usage +@@ -47,7 +46,6 @@ function get_cpu_idle + { + header_line=`grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g'` + idle_column=`echo $header_line | wc -w` +- + average_idle=`grep Average ${MPSTAT_OUT} | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | tail -n 1` + + echo $average_idle +@@ -63,7 +61,7 @@ function run_parallel + echo "Running $mvalue threads in parallel:" + echo " $CMD" + +- $MPSTAT 1 $(($tvalue-1)) &> $MPSTAT_OUT & ++ (sleep 1; mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & + MPSTAT_PID=$! + + PIDS="" +@@ -126,6 +124,8 @@ function main + [ -z "$mvalue" ] && mvalue=`nproc` # thread count defaults to nproc + [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size + ++ [ "$tvalue" -lt 5 ] && tvalue=5 ++ + case "$alg_name" in + "null" |\ + "aes-128-cbc" |\ +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0061-add-a-little-space-in-the-output-for-clarity.patch b/recipes-kernel/cryptodev/sdk_patches/0061-add-a-little-space-in-the-output-for-clarity.patch new file mode 100644 index 0000000..9e3ec84 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0061-add-a-little-space-in-the-output-for-clarity.patch @@ -0,0 +1,27 @@ +From 3bfdd0d1991a37c1adc82cc7e1938e2d9d175bd7 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 10:01:57 +0300 +Subject: [PATCH 061/104] add a little space in the output for clarity + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 5268c86..331158b 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -58,7 +58,8 @@ function run_parallel + OPTIONS="-t $tvalue -n $nvalue -m" + CMD="async_speed $OPTIONS $alg_name" + +- echo "Running $mvalue threads in parallel:" ++ echo ++ echo "Running $tvalue seconds $mvalue threads in parallel:" + echo " $CMD" + + (sleep 1; mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0062-fix-build-warnings-on-implicit-function-declarations.patch b/recipes-kernel/cryptodev/sdk_patches/0062-fix-build-warnings-on-implicit-function-declarations.patch new file mode 100644 index 0000000..dba2575 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0062-fix-build-warnings-on-implicit-function-declarations.patch @@ -0,0 +1,129 @@ +From 0fd37b5225bd26182b20588b200a4fc0a3f415e5 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 10:10:47 +0300 +Subject: [PATCH 062/104] fix build warnings on implicit function declarations + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 2 +- + tests/async_speed.c | 47 +++++++++++++++++++++++------------------------ + tests/hashcrypt_speed.c | 1 + + tests/sha_speed.c | 1 + + tests/speed.c | 1 + + 5 files changed, 27 insertions(+), 25 deletions(-) + +diff --git a/tests/Makefile b/tests/Makefile +index 6424c11..14ae2c7 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -1,5 +1,5 @@ + KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build +-CRYPTODEV_CFLAGS += -DENABLE_ASYNC ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC -Wimplicit-function-declaration + KBUILD_CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index e6bbeed..a1a1b7e 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -112,6 +112,29 @@ static void value2machine(uint64_t bytes, double time, double* speed) + *speed = bytes / time; + } + ++int get_alignmask(int fdc, struct session_op *sess) ++{ ++ int alignmask; ++ int min_alignmask = sizeof(void*) - 1; ++ ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++ ++ siop.ses = sess->ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSINFO)"); ++ return -EINVAL; ++ } ++ alignmask = siop.alignmask; ++ if (alignmask < min_alignmask) { ++ alignmask = min_alignmask; ++ } ++#else ++ alignmask = 0; ++#endif ++ ++ return alignmask; ++} + + int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + { +@@ -236,30 +259,6 @@ int run_test(int id, struct test_params tp) + close(fd); + } + +-int get_alignmask(int fdc, struct session_op *sess) +-{ +- int alignmask; +- int min_alignmask = sizeof(void*) - 1; +- +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +- +- siop.ses = sess->ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return -EINVAL; +- } +- alignmask = siop.alignmask; +- if (alignmask < min_alignmask) { +- alignmask = min_alignmask; +- } +-#else +- alignmask = 0; +-#endif +- +- return alignmask; +-} +- + void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) + { + int i; +diff --git a/tests/hashcrypt_speed.c b/tests/hashcrypt_speed.c +index e60b73d..045bf8e 100644 +--- a/tests/hashcrypt_speed.c ++++ b/tests/hashcrypt_speed.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + #include + + #define MAX(x,y) ((x)>(y)?(x):(y)) +diff --git a/tests/sha_speed.c b/tests/sha_speed.c +index 75d0f42..e5c6efe 100644 +--- a/tests/sha_speed.c ++++ b/tests/sha_speed.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include + +diff --git a/tests/speed.c b/tests/speed.c +index 0b14c88..d2e1aed 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0063-avoid-implicit-conversion-between-signed-and-unsigne.patch b/recipes-kernel/cryptodev/sdk_patches/0063-avoid-implicit-conversion-between-signed-and-unsigne.patch new file mode 100644 index 0000000..133d46c --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0063-avoid-implicit-conversion-between-signed-and-unsigne.patch @@ -0,0 +1,698 @@ +From 5f3a9153f7685f6dde29f7cd2d58534126c5b9af Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 10:45:40 +0300 +Subject: [PATCH 063/104] avoid implicit conversion between signed and unsigned + char + +Signed-off-by: Cristian Stoica +--- + tests/async_cipher.c | 36 ++++++++++++++-------------- + tests/async_hmac.c | 8 +++---- + tests/async_speed.c | 2 +- + tests/cipher-aead-srtp.c | 50 +++++++++++++++++++------------------- + tests/cipher-aead.c | 48 ++++++++++++++++++------------------- + tests/cipher-gcm.c | 62 ++++++++++++++++++++++++------------------------ + tests/cipher.c | 35 ++++++++++++++------------- + tests/cipher_comp.c | 12 +++++----- + tests/fullspeed.c | 3 ++- + tests/hash_comp.c | 8 +++---- + tests/hmac.c | 8 +++---- + tests/speed.c | 3 ++- + 12 files changed, 138 insertions(+), 137 deletions(-) + +diff --git a/tests/async_cipher.c b/tests/async_cipher.c +index 162a695..dd08403 100644 +--- a/tests/async_cipher.c ++++ b/tests/async_cipher.c +@@ -9,7 +9,7 @@ + #include + #include + #include +- ++#include + #include + #include + +@@ -26,10 +26,10 @@ static int debug = 0; + static int + test_crypto(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; + + struct session_op sess; + #ifdef CIOCGSESSINFO +@@ -62,8 +62,8 @@ test_crypto(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + #else + plaintext = plaintext_raw; + ciphertext = ciphertext_raw; +@@ -127,15 +127,15 @@ test_crypto(int cfd) + + static int test_aes(int cfd) + { +- char plaintext1_raw[BLOCK_SIZE + 63], *plaintext1; +- char ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 }; +- char iv1[BLOCK_SIZE]; +- char key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +- char plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 }; +- char plaintext2_raw[BLOCK_SIZE + 63], *plaintext2; +- char ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 }; +- char iv2[BLOCK_SIZE]; +- char key2[KEY_SIZE]; ++ uint8_t plaintext1_raw[BLOCK_SIZE + 63], *plaintext1; ++ uint8_t ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 }; ++ uint8_t iv1[BLOCK_SIZE]; ++ uint8_t key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; ++ uint8_t plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 }; ++ uint8_t plaintext2_raw[BLOCK_SIZE + 63], *plaintext2; ++ uint8_t ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 }; ++ uint8_t iv2[BLOCK_SIZE]; ++ uint8_t key2[KEY_SIZE]; + + struct session_op sess1, sess2; + #ifdef CIOCGSESSINFO +@@ -162,7 +162,7 @@ static int test_aes(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext1 = (char *)(((unsigned long)plaintext1_raw + siop1.alignmask) & ~siop1.alignmask); ++ plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop1.alignmask) & ~siop1.alignmask); + #else + plaintext1 = plaintext1_raw; + #endif +@@ -185,7 +185,7 @@ static int test_aes(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext2 = (char *)(((unsigned long)plaintext2_raw + siop2.alignmask) & ~siop2.alignmask); ++ plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop2.alignmask) & ~siop2.alignmask); + #else + plaintext2 = plaintext2_raw; + #endif +diff --git a/tests/async_hmac.c b/tests/async_hmac.c +index 97fd0c5..94a02c0 100644 +--- a/tests/async_hmac.c ++++ b/tests/async_hmac.c +@@ -61,7 +61,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = "what do ya want for nothing?"; ++ cryp.src = (uint8_t*)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + +@@ -98,7 +98,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = "what do ya want for nothing?"; ++ cryp.src = (uint8_t*)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + +@@ -208,7 +208,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do")-1; +- cryp.src = "what do"; ++ cryp.src = (uint8_t*)"what do"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_UPDATE; +@@ -218,7 +218,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof(" ya want for nothing?")-1; +- cryp.src = " ya want for nothing?"; ++ cryp.src = (uint8_t*)" ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_FINAL; +diff --git a/tests/async_speed.c b/tests/async_speed.c +index a1a1b7e..dabbbc1 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -140,7 +140,7 @@ int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) + { + struct crypt_op cop; + char *buffer[64], iv[32]; +- char mac[64][HASH_MAX_LEN]; ++ uint8_t mac[64][HASH_MAX_LEN]; + static int val = 23; + struct timeval start, end; + uint64_t total = 0; +diff --git a/tests/cipher-aead-srtp.c b/tests/cipher-aead-srtp.c +index fae04e7..c44877d 100644 +--- a/tests/cipher-aead-srtp.c ++++ b/tests/cipher-aead-srtp.c +@@ -77,13 +77,13 @@ int i; + static int + test_crypto(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- unsigned char sha1mac[20]; +- unsigned char tag[20]; +- unsigned char mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t sha1mac[20]; ++ uint8_t tag[20]; ++ uint8_t mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + int mackey_len = 16; + + struct session_op sess; +@@ -122,8 +122,8 @@ test_crypto(int cfd) + printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + + memset(plaintext, 0x15, HEADER_SIZE); /* header */ + memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */ +@@ -225,12 +225,12 @@ test_crypto(int cfd) + static int + test_encrypt_decrypt(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- unsigned char tag[20]; +- unsigned char mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t tag[20]; ++ uint8_t mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + int mackey_len = 16; + + struct session_op sess; +@@ -265,8 +265,8 @@ test_encrypt_decrypt(int cfd) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + + memset(plaintext, 0x15, HEADER_SIZE); /* header */ + memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */ +@@ -367,12 +367,12 @@ test_encrypt_decrypt(int cfd) + static int + test_encrypt_decrypt_error(int cfd, int err) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- unsigned char tag[20]; +- unsigned char mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t tag[20]; ++ uint8_t mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + int mackey_len = 16; + + struct session_op sess; +@@ -407,8 +407,8 @@ test_encrypt_decrypt_error(int cfd, int err) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + + memset(plaintext, 0x15, HEADER_SIZE); /* header */ + memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */ +diff --git a/tests/cipher-aead.c b/tests/cipher-aead.c +index 164327f..da43aa6 100644 +--- a/tests/cipher-aead.c ++++ b/tests/cipher-aead.c +@@ -89,12 +89,12 @@ int i; + static int + test_crypto(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- char auth[AUTH_SIZE]; +- unsigned char sha1mac[20]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t auth[AUTH_SIZE]; ++ uint8_t sha1mac[20]; + int pad, i; + + struct session_op sess; +@@ -133,8 +133,8 @@ test_crypto(int cfd) + printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + memset(plaintext, 0x15, DATA_SIZE); + + if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) { +@@ -242,12 +242,12 @@ test_crypto(int cfd) + static int + test_encrypt_decrypt(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- char auth[AUTH_SIZE]; +- unsigned char sha1mac[20]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t auth[AUTH_SIZE]; ++ uint8_t sha1mac[20]; + int enc_len; + + struct session_op sess; +@@ -285,8 +285,8 @@ test_encrypt_decrypt(int cfd) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); + +@@ -391,12 +391,12 @@ test_encrypt_decrypt(int cfd) + static int + test_encrypt_decrypt_error(int cfd, int err) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- char auth[AUTH_SIZE]; +- unsigned char sha1mac[20]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t auth[AUTH_SIZE]; ++ uint8_t sha1mac[20]; + int enc_len; + + struct session_op sess; +@@ -434,8 +434,8 @@ test_encrypt_decrypt_error(int cfd, int err) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + memset(plaintext, 0x15, DATA_SIZE); + + if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) { +diff --git a/tests/cipher-gcm.c b/tests/cipher-gcm.c +index dfc3d84..3f6cc7b 100644 +--- a/tests/cipher-gcm.c ++++ b/tests/cipher-gcm.c +@@ -45,45 +45,45 @@ struct aes_gcm_vectors_st { + + struct aes_gcm_vectors_st aes_gcm_vectors[] = { + { +- .key = ++ .key = (uint8_t*) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .auth = NULL, + .auth_size = 0, +- .plaintext = ++ .plaintext = (uint8_t*) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .plaintext_size = 16, +- .ciphertext = ++ .ciphertext = (uint8_t*) + "\x03\x88\xda\xce\x60\xb6\xa3\x92\xf3\x28\xc2\xb9\x71\xb2\xfe\x78", +- .iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", +- .tag = ++ .iv = (uint8_t*)"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", ++ .tag = (uint8_t*) + "\xab\x6e\x47\xd4\x2c\xec\x13\xbd\xf5\x3a\x67\xb2\x12\x57\xbd\xdf" + }, + { +- .key = ++ .key = (uint8_t*) + "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08", + .auth = NULL, + .auth_size = 0, +- .plaintext = ++ .plaintext = (uint8_t*) + "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39\x1a\xaf\xd2\x55", + .plaintext_size = 64, +- .ciphertext = ++ .ciphertext = (uint8_t*) + "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91\x47\x3f\x59\x85", +- .iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", +- .tag = "\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4" ++ .iv = (uint8_t*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", ++ .tag = (uint8_t*)"\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4" + }, + { +- .key = ++ .key = (uint8_t*) + "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08", +- .auth = ++ .auth = (uint8_t*) + "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef\xab\xad\xda\xd2", + .auth_size = 20, +- .plaintext = ++ .plaintext = (uint8_t*) + "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39", + .plaintext_size = 60, +- .ciphertext = ++ .ciphertext = (uint8_t*) + "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91", +- .iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", +- .tag = ++ .iv = (uint8_t*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", ++ .tag = (uint8_t*) + "\x5b\xc9\x4f\xbc\x32\x21\xa5\xdb\x94\xfa\xe9\x5a\xe7\x12\x1a\x47" + } + }; +@@ -94,7 +94,7 @@ struct aes_gcm_vectors_st aes_gcm_vectors[] = { + static int test_crypto(int cfd) + { + int i; +- int8_t tmp[128]; ++ uint8_t tmp[128]; + + struct session_op sess; + struct crypt_auth_op cao; +@@ -191,11 +191,11 @@ static int test_crypto(int cfd) + */ + static int test_encrypt_decrypt(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- char auth[AUTH_SIZE]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t auth[AUTH_SIZE]; + int enc_len; + + struct session_op sess; +@@ -233,10 +233,10 @@ static int test_encrypt_decrypt(int cfd) + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + + plaintext = +- (char *) (((unsigned long) plaintext_raw + siop.alignmask) & ++ (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) & + ~siop.alignmask); + ciphertext = +- (char *) (((unsigned long) ciphertext_raw + siop.alignmask) & ++ (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) & + ~siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); +@@ -336,11 +336,11 @@ static int test_encrypt_decrypt(int cfd) + + static int test_encrypt_decrypt_error(int cfd, int err) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; +- char auth[AUTH_SIZE]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; ++ uint8_t auth[AUTH_SIZE]; + int enc_len; + + struct session_op sess; +@@ -386,10 +386,10 @@ static int test_encrypt_decrypt_error(int cfd, int err) + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + + plaintext = +- (char *) (((unsigned long) plaintext_raw + siop.alignmask) & ++ (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) & + ~siop.alignmask); + ciphertext = +- (char *) (((unsigned long) ciphertext_raw + siop.alignmask) & ++ (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) & + ~siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); +diff --git a/tests/cipher.c b/tests/cipher.c +index 07144f2..f3ca2f0 100644 +--- a/tests/cipher.c ++++ b/tests/cipher.c +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -21,10 +22,10 @@ static int debug = 0; + static int + test_crypto(int cfd) + { +- char plaintext_raw[DATA_SIZE + 63], *plaintext; +- char ciphertext_raw[DATA_SIZE + 63], *ciphertext; +- char iv[BLOCK_SIZE]; +- char key[KEY_SIZE]; ++ uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext; ++ uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t key[KEY_SIZE]; + + struct session_op sess; + #ifdef CIOCGSESSINFO +@@ -57,8 +58,8 @@ test_crypto(int cfd) + printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); ++ ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); + #else + plaintext = plaintext_raw; + ciphertext = ciphertext_raw; +@@ -143,15 +144,15 @@ test_crypto(int cfd) + + static int test_aes(int cfd) + { +- char plaintext1_raw[BLOCK_SIZE + 63], *plaintext1; +- char ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 }; +- char iv1[BLOCK_SIZE]; +- char key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +- char plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 }; +- char plaintext2_raw[BLOCK_SIZE + 63], *plaintext2; +- char ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 }; +- char iv2[BLOCK_SIZE]; +- char key2[KEY_SIZE]; ++ uint8_t plaintext1_raw[BLOCK_SIZE + 63], *plaintext1; ++ uint8_t ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 }; ++ uint8_t iv1[BLOCK_SIZE]; ++ uint8_t key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; ++ uint8_t plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 }; ++ uint8_t plaintext2_raw[BLOCK_SIZE + 63], *plaintext2; ++ uint8_t ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 }; ++ uint8_t iv2[BLOCK_SIZE]; ++ uint8_t key2[KEY_SIZE]; + + struct session_op sess; + #ifdef CIOCGSESSINFO +@@ -176,7 +177,7 @@ static int test_aes(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext1 = (char *)(((unsigned long)plaintext1_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop.alignmask) & ~siop.alignmask); + #else + plaintext1 = plaintext1_raw; + #endif +@@ -226,7 +227,7 @@ static int test_aes(int cfd) + printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext2 = (char *)(((unsigned long)plaintext2_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop.alignmask) & ~siop.alignmask); + #else + plaintext2 = plaintext2_raw; + #endif +diff --git a/tests/cipher_comp.c b/tests/cipher_comp.c +index b2bc5af..03f67bf 100644 +--- a/tests/cipher_comp.c ++++ b/tests/cipher_comp.c +@@ -24,12 +24,12 @@ + static int + test_crypto(int cfd, struct session_op *sess, int datalen) + { +- char *data, *encrypted; +- char *encrypted_comp; ++ uint8_t *data, *encrypted; ++ uint8_t *encrypted_comp; + +- char iv_in[BLOCK_SIZE]; +- char iv[BLOCK_SIZE]; +- char iv_comp[BLOCK_SIZE]; ++ uint8_t iv_in[BLOCK_SIZE]; ++ uint8_t iv[BLOCK_SIZE]; ++ uint8_t iv_comp[BLOCK_SIZE]; + + struct crypt_op cryp; + +@@ -90,7 +90,7 @@ main(int argc, char **argv) + { + int fd; + struct session_op sess; +- unsigned char key[KEY_SIZE]; ++ uint8_t key[KEY_SIZE]; + int datalen = BLOCK_SIZE; + int datalen_end = MAX_DATALEN; + int i; +diff --git a/tests/fullspeed.c b/tests/fullspeed.c +index 611859d..c025130 100644 +--- a/tests/fullspeed.c ++++ b/tests/fullspeed.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include + +@@ -74,7 +75,7 @@ static void value2human(int si, double bytes, double time, double* data, double* + int encrypt_data(int algo, void* keybuf, int key_size, int fdc, int chunksize) + { + struct crypt_op cop; +- char *buffer, iv[32]; ++ uint8_t *buffer, iv[32]; + static int val = 23; + struct timeval start, end; + double total = 0; +diff --git a/tests/hash_comp.c b/tests/hash_comp.c +index 9e700a1..e6a4346 100644 +--- a/tests/hash_comp.c ++++ b/tests/hash_comp.c +@@ -30,11 +30,9 @@ static void printhex(unsigned char *buf, int buflen) + static int + test_crypto(int cfd, struct session_op *sess, int datalen) + { +- unsigned char *data; +- +- unsigned char mac[AALG_MAX_RESULT_LEN]; +- +- unsigned char mac_comp[AALG_MAX_RESULT_LEN]; ++ uint8_t *data; ++ uint8_t mac[AALG_MAX_RESULT_LEN]; ++ uint8_t mac_comp[AALG_MAX_RESULT_LEN]; + + struct crypt_op cryp; + +diff --git a/tests/hmac.c b/tests/hmac.c +index 1d9349e..80a2c42 100644 +--- a/tests/hmac.c ++++ b/tests/hmac.c +@@ -69,7 +69,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = "what do ya want for nothing?"; ++ cryp.src = (uint8_t*)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + if (ioctl(cfd, CIOCCRYPT, &cryp)) { +@@ -113,7 +113,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = "what do ya want for nothing?"; ++ cryp.src = (uint8_t*)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + if (ioctl(cfd, CIOCCRYPT, &cryp)) { +@@ -246,7 +246,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do")-1; +- cryp.src = "what do"; ++ cryp.src = (uint8_t*)"what do"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_UPDATE; +@@ -257,7 +257,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof(" ya want for nothing?")-1; +- cryp.src = " ya want for nothing?"; ++ cryp.src = (uint8_t*)" ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_FINAL; +diff --git a/tests/speed.c b/tests/speed.c +index d2e1aed..0e2bbc3 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include + +@@ -75,7 +76,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) + { + struct crypt_op cop; + char *buffer, iv[32]; +- char mac[HASH_MAX_LEN]; ++ uint8_t mac[HASH_MAX_LEN]; + static int val = 23; + struct timeval start, end; + double total = 0; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0064-remove-not-used-local-variables.patch b/recipes-kernel/cryptodev/sdk_patches/0064-remove-not-used-local-variables.patch new file mode 100644 index 0000000..24eac13 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0064-remove-not-used-local-variables.patch @@ -0,0 +1,129 @@ +From c31ba5b149428cbbcd48fab649331a2d38003209 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 10:47:07 +0300 +Subject: [PATCH 064/104] remove not used local variables + +Signed-off-by: Cristian Stoica +--- + tests/async_hmac.c | 2 -- + tests/async_speed.c | 5 ----- + tests/cipher_comp.c | 2 +- + tests/hash_comp.c | 5 ++--- + tests/hmac.c | 2 -- + tests/sha_speed.c | 1 - + 6 files changed, 3 insertions(+), 14 deletions(-) + +diff --git a/tests/async_hmac.c b/tests/async_hmac.c +index 94a02c0..85d19c6 100644 +--- a/tests/async_hmac.c ++++ b/tests/async_hmac.c +@@ -185,8 +185,6 @@ test_extras(int cfd) + struct session_op sess; + struct crypt_op cryp; + uint8_t mac[AALG_MAX_RESULT_LEN]; +- uint8_t oldmac[AALG_MAX_RESULT_LEN]; +- uint8_t md5_hmac_out[] = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38"; + uint8_t sha1_out[] = "\x8f\x82\x03\x94\xf9\x53\x35\x18\x20\x45\xda\x24\xf3\x4d\xe5\x2b\xf8\xbc\x34\x32"; + int i; + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index dabbbc1..f2b9772 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -284,8 +284,6 @@ int run_null(int fdc, struct test_params tp) + { + struct session_op sess; + char keybuf[32]; +- int alignmask; +- int i; + + fprintf(stderr, "Testing NULL cipher: \n"); + memset(&sess, 0, sizeof(sess)); +@@ -305,8 +303,6 @@ int run_aes_128_cbc(int fdc, struct test_params tp) + { + struct session_op sess; + char keybuf[32]; +- int alignmask; +- int i; + + memset(&sess, 0, sizeof(sess)); + sess.cipher = CRYPTO_AES_CBC; +@@ -390,7 +386,6 @@ int main(int argc, char **argv) + { + int i; + int c; +- int index; + bool alg_flag; + char *alg_name; + struct test_params tp; +diff --git a/tests/cipher_comp.c b/tests/cipher_comp.c +index 03f67bf..dbf9977 100644 +--- a/tests/cipher_comp.c ++++ b/tests/cipher_comp.c +@@ -33,7 +33,7 @@ test_crypto(int cfd, struct session_op *sess, int datalen) + + struct crypt_op cryp; + +- int ret = 0, fail = 0; ++ int ret = 0; + + data = malloc(datalen); + encrypted = malloc(datalen); +diff --git a/tests/hash_comp.c b/tests/hash_comp.c +index e6a4346..73f85ed 100644 +--- a/tests/hash_comp.c ++++ b/tests/hash_comp.c +@@ -36,7 +36,7 @@ test_crypto(int cfd, struct session_op *sess, int datalen) + + struct crypt_op cryp; + +- int ret = 0, fail = 0; ++ int ret = 0; + + data = malloc(datalen); + memset(data, datalen & 0xff, datalen); +@@ -66,7 +66,7 @@ test_crypto(int cfd, struct session_op *sess, int datalen) + + if (memcmp(mac, mac_comp, AALG_MAX_RESULT_LEN)) { + printf("fail for datalen %d, MACs do not match!\n", datalen); +- fail = 1; ++ ret = 1; + printf("wrong mac: "); + printhex(mac, 20); + printf("right mac: "); +@@ -88,7 +88,6 @@ main(int argc, char **argv) + struct session_op sess; + int datalen = BLOCK_SIZE; + int datalen_end = MAX_DATALEN; +- int i; + + if (argc > 1) { + datalen = min(max(atoi(argv[1]), BLOCK_SIZE), MAX_DATALEN); +diff --git a/tests/hmac.c b/tests/hmac.c +index 80a2c42..3b248f3 100644 +--- a/tests/hmac.c ++++ b/tests/hmac.c +@@ -212,8 +212,6 @@ test_extras(int cfd) + #endif + struct crypt_op cryp; + uint8_t mac[AALG_MAX_RESULT_LEN]; +- uint8_t oldmac[AALG_MAX_RESULT_LEN]; +- uint8_t md5_hmac_out[] = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38"; + uint8_t sha1_out[] = "\x8f\x82\x03\x94\xf9\x53\x35\x18\x20\x45\xda\x24\xf3\x4d\xe5\x2b\xf8\xbc\x34\x32"; + int i; + +diff --git a/tests/sha_speed.c b/tests/sha_speed.c +index e5c6efe..9f2c8cc 100644 +--- a/tests/sha_speed.c ++++ b/tests/sha_speed.c +@@ -296,7 +296,6 @@ int main(void) + int fd; + int fdc; + int err; +- int i; + struct session_op sess; + + signal(SIGALRM, alarm_handler); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0065-return-error-code-of-the-test-if-there-is-one.patch b/recipes-kernel/cryptodev/sdk_patches/0065-return-error-code-of-the-test-if-there-is-one.patch new file mode 100644 index 0000000..2775237 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0065-return-error-code-of-the-test-if-there-is-one.patch @@ -0,0 +1,68 @@ +From 58da37b93d2532e489514b810c63d735a165ff09 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 10:47:58 +0300 +Subject: [PATCH 065/104] return error code of the test if there is one + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index f2b9772..d843c02 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -239,6 +239,7 @@ int run_test(int id, struct test_params tp) + { + int fd; + int fdc; ++ int err; + + fd = open("/dev/crypto", O_RDWR, 0); + if (fd < 0) { +@@ -253,10 +254,12 @@ int run_test(int id, struct test_params tp) + if (!tp.mflag) { + fprintf(stderr, "Testing %s:\n", ciphers[id].name); + } +- ciphers[id].func(fdc, tp); ++ err = ciphers[id].func(fdc, tp); + + close(fdc); + close(fd); ++ ++ return err; + } + + void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) +@@ -384,6 +387,7 @@ int run_sha256(int fdc, struct test_params tp) + + int main(int argc, char **argv) + { ++ int err = 0; + int i; + int c; + bool alg_flag; +@@ -436,14 +440,17 @@ int main(int argc, char **argv) + + if (alg_flag) { + if (strcmp(alg_name, ciphers[i].name) == 0) { +- run_test(i, tp); ++ err = run_test(i, tp); + } + } else { +- run_test(i, tp); ++ err = run_test(i, tp); ++ if (err != 0) { ++ break; ++ } + } + } + +- return 0; ++ return err; + } + + #else +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0066-do-more-strict-code-checking-to-avoid-maintenance-is.patch b/recipes-kernel/cryptodev/sdk_patches/0066-do-more-strict-code-checking-to-avoid-maintenance-is.patch new file mode 100644 index 0000000..3255dd8 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0066-do-more-strict-code-checking-to-avoid-maintenance-is.patch @@ -0,0 +1,25 @@ +From af792c280ec5d76f473487cd1ed9335a6ec534de Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 10:49:36 +0300 +Subject: [PATCH 066/104] do more strict code checking to avoid maintenance + issues + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/Makefile b/tests/Makefile +index 14ae2c7..a27cf9b 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -1,5 +1,5 @@ + KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build +-CRYPTODEV_CFLAGS += -DENABLE_ASYNC -Wimplicit-function-declaration ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC -Wall -Werror + KBUILD_CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0067-fix-issues-with-install-target.patch b/recipes-kernel/cryptodev/sdk_patches/0067-fix-issues-with-install-target.patch new file mode 100644 index 0000000..e60e90a --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0067-fix-issues-with-install-target.patch @@ -0,0 +1,52 @@ +From bd36f9cda9fb5eeebec23cc966a81e93b4fa8bf7 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 12:53:11 +0300 +Subject: [PATCH 067/104] fix issues with install target + +Aparently, on some setups, 'sudo make' will clear the $PWD variable +on the first Makefile expansion. This leads to failures of "sudo make +install" or other issues when trying to preserve the environment with +sudo -E. + +There are two solutions to this problem: +1) Use $$PWD instead of $(PWD) to render `$PWD` as the actual string to +be used on the secondary Makefile expansion. +This is used (albeit inconsistently) in the Linux kernel guide for +external modules: +kernel https://www.kernel.org/doc/Documentation/kbuild/modules.txt + +2) A second solution is based on GNU make which sets CURDIR to the +pathname of current working directory. This variable is never touched +again by make. +This solution is choosen for it is just as clear as the PWD one would +have been had it worked in the first place. + +Signed-off-by: Cristian Stoica + + + +--- a/Makefileold 2017-04-18 13:55:30.740561749 +0800 ++++ b/Makefile 2017-04-18 13:58:04.348556431 +0800 +@@ -15,7 +15,7 @@ + + obj-m += cryptodev.o + +-KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(PWD) ++KERNEL_MAKE_OPTS := -C $(KERNEL_DIR) M=$(CURDIR) + ifneq ($(ARCH),) + KERNEL_MAKE_OPTS += ARCH=$(ARCH) + endif +@@ -32,11 +32,11 @@ + install: modules_install + + modules_install: +- $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install ++ $(MAKE) $(KERNEL_MAKE_OPTS) modules_install + install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h + + clean: +- $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean ++ $(MAKE) $(KERNEL_MAKE_OPTS) clean + rm -f $(hostprogs) *~ + CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean + diff --git a/recipes-kernel/cryptodev/sdk_patches/0068-setting-KERNEL_DIR-is-not-necessary-to-build-tests.patch b/recipes-kernel/cryptodev/sdk_patches/0068-setting-KERNEL_DIR-is-not-necessary-to-build-tests.patch new file mode 100644 index 0000000..07156a6 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0068-setting-KERNEL_DIR-is-not-necessary-to-build-tests.patch @@ -0,0 +1,24 @@ +From 39f0c5ae656f4b487a0950235e2371e4dd840594 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 13:11:11 +0300 +Subject: [PATCH 068/104] setting KERNEL_DIR is not necessary to build tests + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tests/Makefile b/tests/Makefile +index a27cf9b..e7a60cb 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -1,6 +1,4 @@ +-KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build + CRYPTODEV_CFLAGS += -DENABLE_ASYNC -Wall -Werror +-KBUILD_CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + + comp_progs := cipher_comp hash_comp hmac_comp +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0069-fix-the-reported-unit.patch b/recipes-kernel/cryptodev/sdk_patches/0069-fix-the-reported-unit.patch new file mode 100644 index 0000000..91a3c0d --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0069-fix-the-reported-unit.patch @@ -0,0 +1,29 @@ +From 99ce54741ccbbe8581ab83b73ab11d2dae4f01b1 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 14:55:28 +0300 +Subject: [PATCH 069/104] fix the reported unit + +1GiB = 1024*1024*1024 +1GB = 1000000000 + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 331158b..bf5f1c6 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -93,7 +93,7 @@ function run_parallel + echo + echo "buffer size : $nvalue" + echo "running time : $runtime" +- echo "avg_speed : $avg_speed GiB/s" ++ echo "avg_speed : $avg_speed GB/s" + echo "all_cpu idle : $cpu_idle %" + echo + } +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0070-remove-old-results-to-avoid-incorrect-reports.patch b/recipes-kernel/cryptodev/sdk_patches/0070-remove-old-results-to-avoid-incorrect-reports.patch new file mode 100644 index 0000000..270b69e --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0070-remove-old-results-to-avoid-incorrect-reports.patch @@ -0,0 +1,27 @@ +From 73748415251dbf3d6e3fc9531e38b8e61ff63e20 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 26 Oct 2016 15:09:04 +0300 +Subject: [PATCH 070/104] remove old results to avoid incorrect reports + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index bf5f1c6..10b2348 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -108,6 +108,9 @@ function main + { + [ ! -e "/dev/crypto" ] && sudo modprobe cryptodev || modprobe cryptodev || exit 1 + ++ rm -f ${OUT_BASENAME}_* ++ rm -f ${MPSTAT_OUT} ++ + while getopts hm:t:n: option + do + case "$option" in +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0071-fix-the-scale-of-the-runtime-value.patch b/recipes-kernel/cryptodev/sdk_patches/0071-fix-the-scale-of-the-runtime-value.patch new file mode 100644 index 0000000..f52e09a --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0071-fix-the-scale-of-the-runtime-value.patch @@ -0,0 +1,29 @@ +From d9de6a0f342b2291e2f2d82b594fbb3b8ed7f468 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 09:29:24 +0300 +Subject: [PATCH 071/104] fix the scale of the runtime value + +Subtraction operation does not honor the scale variable. Only +division does. + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 10b2348..659be0e 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -85,7 +85,7 @@ function run_parallel + + wait $MPSTAT_PID + +- runtime=$(echo "scale=2; $end - $start" | bc -l ) ++ runtime=$(echo "scale=2; ($end - $start) / 1" | bc -l ) + total_data=`cat ${OUT_BASENAME}_* | cut -f 1 | SUM` + avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) + cpu_idle=`get_cpu_idle` +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0072-use-.-instead-of-.-for-consistency.patch b/recipes-kernel/cryptodev/sdk_patches/0072-use-.-instead-of-.-for-consistency.patch new file mode 100644 index 0000000..0cf2a0c --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0072-use-.-instead-of-.-for-consistency.patch @@ -0,0 +1,82 @@ +From abcf5983f6d69c5ff35e77fb79ea7afe2149411a Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 09:33:11 +0300 +Subject: [PATCH 072/104] use $(...) instead of `...` for consistency + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 659be0e..e10dc0d 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -19,7 +19,7 @@ + + # no user-configurable options below this line + +-NUM_CORES=`nproc` ++NUM_CORES=$(nproc) + OUT_BASENAME="async_speed" + S_TIME_FORMAT=ISO + MPSTAT_OUT="mpstat_out" +@@ -44,9 +44,9 @@ function SUM { + + function get_cpu_idle + { +- header_line=`grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g'` +- idle_column=`echo $header_line | wc -w` +- average_idle=`grep Average ${MPSTAT_OUT} | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | tail -n 1` ++ header_line=$(grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g') ++ idle_column=$(echo $header_line | wc -w) ++ average_idle=$(grep Average ${MPSTAT_OUT} | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | tail -n 1) + + echo $average_idle + } +@@ -66,9 +66,9 @@ function run_parallel + MPSTAT_PID=$! + + PIDS="" +- start=`date +%s.%N` ++ start=$(date +%s.%N) + +- for i in `seq 0 $(($mvalue-1))` ++ for i in $(seq 0 $(($mvalue-1))) + do + CMD_OUT="${OUT_BASENAME}_${i}" + +@@ -81,14 +81,14 @@ function run_parallel + done + + wait $PIDS +- end=`date +%s.%N` ++ end=$(date +%s.%N) + + wait $MPSTAT_PID + + runtime=$(echo "scale=2; ($end - $start) / 1" | bc -l ) +- total_data=`cat ${OUT_BASENAME}_* | cut -f 1 | SUM` ++ total_data=$(cat ${OUT_BASENAME}_* | cut -f 1 | SUM) + avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) +- cpu_idle=`get_cpu_idle` ++ cpu_idle=$(get_cpu_idle) + + echo + echo "buffer size : $nvalue" +@@ -124,9 +124,9 @@ function main + shift $((OPTIND-1)) + alg_name=$1 + +- [ -z "$tvalue" ] && tvalue=10 # 10 seconds per test by default +- [ -z "$mvalue" ] && mvalue=`nproc` # thread count defaults to nproc +- [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size ++ [ -z "$tvalue" ] && tvalue=10 # 10 seconds per test by default ++ [ -z "$mvalue" ] && mvalue=$NUM_CORES # thread count defaults to nproc ++ [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size + + [ "$tvalue" -lt 5 ] && tvalue=5 + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0073-really-fix-again.-the-mpstat-issue.patch b/recipes-kernel/cryptodev/sdk_patches/0073-really-fix-again.-the-mpstat-issue.patch new file mode 100644 index 0000000..5410870 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0073-really-fix-again.-the-mpstat-issue.patch @@ -0,0 +1,34 @@ +From 787cbdf6b032964df00c4379d9a81ba4384a492e Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 10:06:08 +0300 +Subject: [PATCH 073/104] really fix (again...) the mpstat issue + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index e10dc0d..22a12cb 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -21,7 +21,6 @@ + + NUM_CORES=$(nproc) + OUT_BASENAME="async_speed" +-S_TIME_FORMAT=ISO + MPSTAT_OUT="mpstat_out" + + function usage +@@ -62,7 +61,7 @@ function run_parallel + echo "Running $tvalue seconds $mvalue threads in parallel:" + echo " $CMD" + +- (sleep 1; mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & ++ (sleep 1; S_TIME_FORMAT=ISO mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & + MPSTAT_PID=$! + + PIDS="" +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0074-make-default-output-tabular.patch b/recipes-kernel/cryptodev/sdk_patches/0074-make-default-output-tabular.patch new file mode 100644 index 0000000..16eadac --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0074-make-default-output-tabular.patch @@ -0,0 +1,83 @@ +From 826f2feb22f5391e985930af40782b2fb980e028 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 10:12:25 +0300 +Subject: [PATCH 074/104] make default output tabular + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 33 +++++++++++++++++++++++---------- + 1 file changed, 23 insertions(+), 10 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 22a12cb..b509c25 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -31,6 +31,7 @@ Usage: `basename $0` [OPTIONS] + -m number of threads to run with (defaults to number of cores) + -t time to run each test (default 10 secs) + -n size of the test buffer (default 256 bytes) ++ -v make output more verbose (default tabular) + -h show this help + + alg_name: null, aes-128-cbc, aes-256-xts, sha1, sha256, crc32c +@@ -57,9 +58,12 @@ function run_parallel + OPTIONS="-t $tvalue -n $nvalue -m" + CMD="async_speed $OPTIONS $alg_name" + +- echo +- echo "Running $tvalue seconds $mvalue threads in parallel:" +- echo " $CMD" ++ if [ ! -z "$vvalue" ] ++ then ++ echo ++ echo "Running $tvalue seconds $mvalue threads in parallel:" ++ echo " $CMD" ++ fi + + (sleep 1; S_TIME_FORMAT=ISO mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & + MPSTAT_PID=$! +@@ -89,12 +93,20 @@ function run_parallel + avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) + cpu_idle=$(get_cpu_idle) + +- echo +- echo "buffer size : $nvalue" +- echo "running time : $runtime" +- echo "avg_speed : $avg_speed GB/s" +- echo "all_cpu idle : $cpu_idle %" +- echo ++ if [ ! -z "$vvalue" ] ++ then ++ echo ++ echo "buffer size : $nvalue" ++ echo "running time : $runtime" ++ echo "avg_speed : $avg_speed GB/s" ++ echo "all_cpu idle : $cpu_idle %" ++ echo ++ else ++ echo -e "algorithm\t""threads\t""runtime\t"\ ++ "buf_size\t""GB/s\t""%cpu_idle" ++ echo -e "${alg_name}\t${mvalue}\t${runtime}\t"\ ++ "${nvalue}\t${avg_speed}\t${cpu_idle}" ++ fi + } + + function control_c +@@ -110,12 +122,13 @@ function main + rm -f ${OUT_BASENAME}_* + rm -f ${MPSTAT_OUT} + +- while getopts hm:t:n: option ++ while getopts vhm:t:n: option + do + case "$option" in + m) mvalue="$OPTARG";; + t) tvalue="$OPTARG";; + n) nvalue="$OPTARG";; ++ v) vvalue="verbose";; + *) usage $0; exit 1;; + esac + done +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0075-fix-incorrect-handling-of-error-cases.patch b/recipes-kernel/cryptodev/sdk_patches/0075-fix-incorrect-handling-of-error-cases.patch new file mode 100644 index 0000000..79ca7d2 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0075-fix-incorrect-handling-of-error-cases.patch @@ -0,0 +1,27 @@ +From fbf88220797a95281457680a18e9241b3af1f3fb Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 10:27:16 +0300 +Subject: [PATCH 075/104] fix incorrect handling of error cases... + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index b509c25..862f39d 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -117,7 +117,8 @@ function control_c + + function main + { +- [ ! -e "/dev/crypto" ] && sudo modprobe cryptodev || modprobe cryptodev || exit 1 ++ [ ! -e "/dev/crypto" ] && ++ (sudo modprobe cryptodev || modprobe cryptodev || exit 1) + + rm -f ${OUT_BASENAME}_* + rm -f ${MPSTAT_OUT} +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0076-exit-early-if-cryptodev-tests-are-not-installed.patch b/recipes-kernel/cryptodev/sdk_patches/0076-exit-early-if-cryptodev-tests-are-not-installed.patch new file mode 100644 index 0000000..0570e1a --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0076-exit-early-if-cryptodev-tests-are-not-installed.patch @@ -0,0 +1,48 @@ +From 87214642cbfc6dbd43948940b5d1ce9528f451bd Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 10:46:01 +0300 +Subject: [PATCH 076/104] exit early if cryptodev tests are not installed + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 862f39d..62c4759 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -20,6 +20,7 @@ + # no user-configurable options below this line + + NUM_CORES=$(nproc) ++CMD_BIN="async_speed" + OUT_BASENAME="async_speed" + MPSTAT_OUT="mpstat_out" + +@@ -56,7 +57,7 @@ function run_parallel + trap control_c SIGINT + + OPTIONS="-t $tvalue -n $nvalue -m" +- CMD="async_speed $OPTIONS $alg_name" ++ CMD="$CMD_BIN $OPTIONS $alg_name" + + if [ ! -z "$vvalue" ] + then +@@ -120,6 +121,13 @@ function main + [ ! -e "/dev/crypto" ] && + (sudo modprobe cryptodev || modprobe cryptodev || exit 1) + ++ $(which ${CMD_BIN} &> /dev/null) ++ if (($? != 0)) ++ then ++ echo "${CMD_BIN} test is not installed" ++ exit 1 ++ fi ++ + rm -f ${OUT_BASENAME}_* + rm -f ${MPSTAT_OUT} + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0077-the-C-standard-used-by-cryptodev-is-C90-with-GNU-ext.patch b/recipes-kernel/cryptodev/sdk_patches/0077-the-C-standard-used-by-cryptodev-is-C90-with-GNU-ext.patch new file mode 100644 index 0000000..b4ab34c --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0077-the-C-standard-used-by-cryptodev-is-C90-with-GNU-ext.patch @@ -0,0 +1,66 @@ +From 76de6db1bc69b2239d8fb91fd65b74610cb8e22f Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Thu, 27 Oct 2016 16:41:10 +0300 +Subject: [PATCH 077/104] the C standard used by cryptodev is C90 with GNU + extensions + +This avoids some problems with gcc>=5.0 which chaged the default to C11. +The choice for gnu90 is based on the C standard used by Linux kernel which +is gnu90 as well. + +Signed-off-by: Cristian Stoica +--- + Makefile | 6 +++--- + lib/Makefile | 2 +- + tests/Makefile | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index 90e86d9..80439f6 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,7 +3,7 @@ + # disabled by default. To re-enable it uncomment the + # corresponding CFLAG. + # +-CRYPTODEV_CFLAGS += -DENABLE_ASYNC ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC -std=gnu90 + KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS) + KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build + VERSION = 1.8 +@@ -38,10 +38,10 @@ modules_install: + clean: + $(MAKE) $(KERNEL_MAKE_OPTS) clean + rm -f $(hostprogs) *~ +- CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests clean ++ CFLAGS="$(CRYPTODEV_CFLAGS)" KERNEL_DIR="$(KERNEL_DIR)" $(MAKE) -C tests clean + + check: +- CFLAGS=$(CRYPTODEV_CFLAGS) KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests check ++ CFLAGS="$(CRYPTODEV_CFLAGS)" KERNEL_DIR="$(KERNEL_DIR)" $(MAKE) -C tests check + + testprogs: + KERNEL_DIR=$(KERNEL_DIR) $(MAKE) -C tests all +diff --git a/lib/Makefile b/lib/Makefile +index 3bedc34..0044613 100644 +--- a/lib/Makefile ++++ b/lib/Makefile +@@ -1,4 +1,4 @@ +-CFLAGS=-g -O2 -Wall ++CFLAGS=-g -O2 -Wall -std=gnu90 + + all: benchmark + +diff --git a/tests/Makefile b/tests/Makefile +index e7a60cb..23d67f9 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -1,4 +1,4 @@ +-CRYPTODEV_CFLAGS += -DENABLE_ASYNC -Wall -Werror ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC -std=gnu90 -Wall -Werror + CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + + comp_progs := cipher_comp hash_comp hmac_comp +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0078-remove-output-line-because-it-does-not-add-clarity-t.patch b/recipes-kernel/cryptodev/sdk_patches/0078-remove-output-line-because-it-does-not-add-clarity-t.patch new file mode 100644 index 0000000..3b474a3 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0078-remove-output-line-because-it-does-not-add-clarity-t.patch @@ -0,0 +1,32 @@ +From 0bd3dada58288792f587712c95a1f125a7655535 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 09:05:26 +0300 +Subject: [PATCH 078/104] remove output line because it does not add clarity to + the results + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 62c4759..991e190 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -59,13 +59,6 @@ function run_parallel + OPTIONS="-t $tvalue -n $nvalue -m" + CMD="$CMD_BIN $OPTIONS $alg_name" + +- if [ ! -z "$vvalue" ] +- then +- echo +- echo "Running $tvalue seconds $mvalue threads in parallel:" +- echo " $CMD" +- fi +- + (sleep 1; S_TIME_FORMAT=ISO mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & + MPSTAT_PID=$! + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0079-fix-typo-use-consistent-spacing.patch b/recipes-kernel/cryptodev/sdk_patches/0079-fix-typo-use-consistent-spacing.patch new file mode 100644 index 0000000..7003692 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0079-fix-typo-use-consistent-spacing.patch @@ -0,0 +1,28 @@ +From 9c8d7ce749931de6c7604b3b8be44d4a17bcd7d1 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 09:11:13 +0300 +Subject: [PATCH 079/104] fix typo, use consistent spacing + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 991e190..125d45c 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -96,8 +96,8 @@ function run_parallel + echo "all_cpu idle : $cpu_idle %" + echo + else +- echo -e "algorithm\t""threads\t""runtime\t"\ +- "buf_size\t""GB/s\t""%cpu_idle" ++ echo -e "algorithm\t""threads\t""run time\t"\ ++ "buffer size\t""GB/s\t""%cpu idle" + echo -e "${alg_name}\t${mvalue}\t${runtime}\t"\ + "${nvalue}\t${avg_speed}\t${cpu_idle}" + fi +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0080-graceful-exit-if-cryptodev-is-not-built-with-ASYNC-f.patch b/recipes-kernel/cryptodev/sdk_patches/0080-graceful-exit-if-cryptodev-is-not-built-with-ASYNC-f.patch new file mode 100644 index 0000000..64450df --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0080-graceful-exit-if-cryptodev-is-not-built-with-ASYNC-f.patch @@ -0,0 +1,31 @@ +From 9a486f5ebf648971db9bdbd30f7e52251a659ddd Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 12:01:00 +0300 +Subject: [PATCH 080/104] graceful exit if cryptodev is not built with ASYNC + flags + +--- + tests/async_speed_multi.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 125d45c..f2a8ba6 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -82,6 +82,13 @@ function run_parallel + + wait $MPSTAT_PID + ++ grep "ioctl" ${OUT_BASENAME}_* &> /dev/null ++ if (($? == 0)) ++ then ++ echo "cryptodev is not built with -DENABLE_ASYNC flag" ++ exit 1 ++ fi ++ + runtime=$(echo "scale=2; ($end - $start) / 1" | bc -l ) + total_data=$(cat ${OUT_BASENAME}_* | cut -f 1 | SUM) + avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0081-add-sync-speed-tests-with-the-same-format-as-async-o.patch b/recipes-kernel/cryptodev/sdk_patches/0081-add-sync-speed-tests-with-the-same-format-as-async-o.patch new file mode 100644 index 0000000..5e8893b --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0081-add-sync-speed-tests-with-the-same-format-as-async-o.patch @@ -0,0 +1,718 @@ +From b13160357e683b9d42ba513433b4c09456a8332b Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Fri, 28 Oct 2016 13:39:50 +0300 +Subject: [PATCH 081/104] add sync speed tests with the same format as async + ones + +The file speed.c was removed because has the same functionality +as sync_speed.c + +Signed-off-by: Alexe Radu +--- + tests/Makefile | 4 +- + tests/speed.c | 265 ----------------------------------- + tests/sync_speed.c | 399 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 401 insertions(+), 267 deletions(-) + delete mode 100644 tests/speed.c + create mode 100644 tests/sync_speed.c + +diff --git a/tests/Makefile b/tests/Makefile +index 23d67f9..400fb7a 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -3,14 +3,14 @@ CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + + comp_progs := cipher_comp hash_comp hmac_comp + +-hostprogs := cipher cipher-aead hmac speed async_cipher async_hmac \ ++hostprogs := cipher cipher-aead hmac sync_speed async_cipher async_hmac \ + async_speed sha_speed hashcrypt_speed fullspeed cipher-gcm \ + cipher-aead-srtp $(comp_progs) + + example-cipher-objs := cipher.o + example-cipher-aead-objs := cipher-aead.o + example-hmac-objs := hmac.o +-example-speed-objs := speed.c ++example-speed-objs := sync_speed.o + example-fullspeed-objs := fullspeed.c + example-sha-speed-objs := sha_speed.c + example-async-cipher-objs := async_cipher.o +diff --git a/tests/speed.c b/tests/speed.c +deleted file mode 100644 +index 0e2bbc3..0000000 +--- a/tests/speed.c ++++ /dev/null +@@ -1,265 +0,0 @@ +-/* cryptodev_test - simple benchmark tool for cryptodev +- * +- * Copyright (C) 2010 by Phil Sutter +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-static int si = 1; /* SI by default */ +- +-static double udifftimeval(struct timeval start, struct timeval end) +-{ +- return (double)(end.tv_usec - start.tv_usec) + +- (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; +-} +- +-static int must_finish = 0; +- +-static void alarm_handler(int signo) +-{ +- must_finish = 1; +-} +- +-static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; +-static char *si_units[] = { "", "K", "M", "G", "T", 0}; +- +-static void value2human(int si, double bytes, double time, double* data, double* speed,char* metric) +-{ +- int unit = 0; +- +- *data = bytes; +- +- if (si) { +- while (*data > 1000 && si_units[unit + 1]) { +- *data /= 1000; +- unit++; +- } +- *speed = *data / time; +- sprintf(metric, "%sB", si_units[unit]); +- } else { +- while (*data > 1024 && units[unit + 1]) { +- *data /= 1024; +- unit++; +- } +- *speed = *data / time; +- sprintf(metric, "%sB", units[unit]); +- } +-} +- +-#define MAX(x,y) ((x)>(y)?(x):(y)) +- +-int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask) +-{ +- struct crypt_op cop; +- char *buffer, iv[32]; +- uint8_t mac[HASH_MAX_LEN]; +- static int val = 23; +- struct timeval start, end; +- double total = 0; +- double secs, ddata, dspeed; +- char metric[16]; +- int min_alignmask = sizeof(void*) - 1; +- +- if (alignmask) { +- alignmask = ((alignmask < min_alignmask) ? min_alignmask : alignmask); +- if (posix_memalign((void **)&buffer, MAX(alignmask + 1, sizeof(void*)), chunksize)) { +- printf("posix_memalign() failed! (mask %x, size: %d)\n", alignmask+1, chunksize); +- return 1; +- } +- } else { +- if (!(buffer = malloc(chunksize))) { +- perror("malloc()"); +- return 1; +- } +- } +- +- memset(iv, 0x23, 32); +- +- printf("\tEncrypting in chunks of %d bytes: ", chunksize); +- fflush(stdout); +- +- memset(buffer, val++, chunksize); +- +- must_finish = 0; +- alarm(5); +- +- gettimeofday(&start, NULL); +- do { +- memset(&cop, 0, sizeof(cop)); +- cop.ses = sess->ses; +- cop.len = chunksize; +- cop.iv = (unsigned char *)iv; +- cop.op = COP_ENCRYPT; +- cop.src = cop.dst = (unsigned char *)buffer; +- cop.mac = mac; +- +- if (ioctl(fdc, CIOCCRYPT, &cop)) { +- perror("ioctl(CIOCCRYPT)"); +- return 1; +- } +- total+=chunksize; +- } while(must_finish==0); +- gettimeofday(&end, NULL); +- +- secs = udifftimeval(start, end)/ 1000000.0; +- +- value2human(si, total, secs, &ddata, &dspeed, metric); +- printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); +- printf ("%.2f %s/sec\n", dspeed, metric); +- +- free(buffer); +- return 0; +-} +- +-int main(int argc, char** argv) +-{ +- int fd, i, fdc = -1, alignmask = 0; +- struct session_op sess; +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +-#endif +- char keybuf[32]; +- +- signal(SIGALRM, alarm_handler); +- +- if (argc > 1) { +- if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) { +- printf("Usage: speed [--kib]\n"); +- exit(0); +- } +- if (strcmp(argv[1], "--kib") == 0) { +- si = 0; +- } +- } +- +- if ((fd = open("/dev/crypto", O_RDWR, 0)) < 0) { +- perror("open()"); +- return 1; +- } +- if (ioctl(fd, CRIOGET, &fdc)) { +- perror("ioctl(CRIOGET)"); +- return 1; +- } +- +- fprintf(stderr, "Testing NULL cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_NULL; +- sess.keylen = 0; +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return 1; +- } +- alignmask = siop.alignmask; +-#endif +- +- for (i = 512; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } +- +- fprintf(stderr, "\nTesting AES-128-CBC cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_AES_CBC; +- sess.keylen = 16; +- memset(keybuf, 0x42, 16); +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return 1; +- } +- alignmask = siop.alignmask; +-#endif +- +- for (i = 512; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } +- +- fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_AES_XTS; +- sess.keylen = 32; +- memset(keybuf, 0x42, sess.keylen); +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return 1; +- } +- alignmask = siop.alignmask; +-#endif +- +- for (i = 512; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } +- +- fprintf(stderr, "\nTesting CRC32C hash: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_CRC32C; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +-#ifdef CIOCGSESSINFO +- siop.ses = sess.ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return 1; +- } +- printf("requested hash CRYPTO_CRC32C, got %s with driver %s\n", +- siop.hash_info.cra_name, siop.hash_info.cra_driver_name); +- alignmask = siop.alignmask; +-#endif +- +- for (i = 512; i <= (64 * 1024); i *= 2) { +- if (encrypt_data(&sess, fdc, i, alignmask)) +- break; +- } +- +- close(fdc); +- close(fd); +- return 0; +-} +diff --git a/tests/sync_speed.c b/tests/sync_speed.c +new file mode 100644 +index 0000000..b0cb9ad +--- /dev/null ++++ b/tests/sync_speed.c +@@ -0,0 +1,399 @@ ++/* cryptodev_test - simple benchmark tool for cryptodev ++ * ++ * Copyright (C) 2010 by Phil Sutter ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct test_params { ++ bool tflag; ++ bool nflag; ++ int tvalue; ++ int nvalue; ++}; ++ ++const char usage_str[] = "Usage: %s [OPTION]... |\n" ++ "Run benchmark test for cipher or hash\n\n" ++ " -t \t" "time to run each test (default 10 secs)\n" ++ " -n \t" "size of the test buffer\n" ++ " -h\t\t" "show this help\n" ++; ++ ++int run_null(int fdc, struct test_params tp); ++int run_aes_cbc(int fdc, struct test_params tp); ++int run_aes_xts(int fdc, struct test_params tp); ++int run_crc32c(int fdc, struct test_params tp); ++int run_sha1(int fdc, struct test_params tp); ++int run_sha256(int fdc, struct test_params tp); ++int get_alignmask(int fdc, struct session_op *sess); ++ ++#define ALG_COUNT 6 ++struct { ++ char *name; ++ int (*func)(int, struct test_params); ++} ciphers[ALG_COUNT] = { ++ {"null", run_null}, ++ {"aes-cbc", run_aes_cbc}, ++ {"aes-xts", run_aes_xts}, ++ {"crc32c", run_crc32c}, ++ {"sha1", run_sha1}, ++ {"sha256", run_sha256}, ++}; ++ ++static double udifftimeval(struct timeval start, struct timeval end) ++{ ++ return (double)(end.tv_usec - start.tv_usec) + ++ (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; ++} ++ ++static int must_finish = 0; ++static int must_exit = 0; ++ ++static void alarm_handler(int signo) ++{ ++ must_finish = 1; ++} ++ ++static void exit_handler(int signo) ++{ ++ must_exit = 1; ++ printf("\nexit requested by user through ctrl+c \n"); ++} ++ ++static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; ++ ++static void value2human(double bytes, double time, double* data, double* speed,char* metric) ++{ ++ int unit = 0; ++ ++ *data = bytes; ++ while (*data > 1024 && units[unit + 1]) { ++ *data /= 1024; ++ unit++; ++ } ++ *speed = *data / time; ++ sprintf(metric, "%sB", units[unit]); ++} ++ ++static int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ struct crypt_op cop; ++ char *buffer, iv[32]; ++ char mac[HASH_MAX_LEN]; ++ static int val = 23; ++ struct timeval start, end; ++ double total = 0; ++ double secs, ddata, dspeed; ++ char metric[16]; ++ int alignmask; ++ int min_alignmask = sizeof(void*) - 1; ++ ++ memset(iv, 0x23, 32); ++ ++ printf("\tEncrypting in chunks of %d bytes: ", tp.nvalue); ++ fflush(stdout); ++ ++ alignmask = get_alignmask(fdc, sess); ++ if (alignmask) { ++ alignmask = ((alignmask < min_alignmask) ? min_alignmask : alignmask); ++ if (posix_memalign((void **)(&buffer), alignmask + 1, tp.nvalue)) { ++ printf("posix_memalign() failed!\n"); ++ return 1; ++ } ++ } else { ++ if (!(buffer = malloc(tp.nvalue))) { ++ perror("malloc()"); ++ return 1; ++ } ++ } ++ memset(buffer, val++, tp.nvalue); ++ ++ must_finish = 0; ++ alarm(tp.tvalue); ++ ++ gettimeofday(&start, NULL); ++ do { ++ memset(&cop, 0, sizeof(cop)); ++ cop.ses = sess->ses; ++ cop.len = tp.nvalue; ++ cop.iv = (unsigned char *)iv; ++ cop.op = COP_ENCRYPT; ++ cop.src = cop.dst = (unsigned char *)buffer; ++ cop.mac = (unsigned char *)mac; ++ ++ if (ioctl(fdc, CIOCCRYPT, &cop)) { ++ perror("ioctl(CIOCCRYPT)"); ++ return 1; ++ } ++ total += cop.len; ++ } while(!must_finish); ++ gettimeofday(&end, NULL); ++ ++ secs = udifftimeval(start, end)/ 1000000.0; ++ ++ value2human(total, secs, &ddata, &dspeed, metric); ++ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); ++ printf ("%.2f %s/sec\n", dspeed, metric); ++ ++ free(buffer); ++ return 0; ++} ++ ++void usage(char *cmd_name) ++{ ++ printf(usage_str, cmd_name); ++} ++ ++int run_test(int id, struct test_params tp) ++{ ++ int fd; ++ int fdc; ++ ++ fd = open("/dev/crypto", O_RDWR, 0); ++ if (fd < 0) { ++ perror("open()"); ++ return fd; ++ } ++ if (ioctl(fd, CRIOGET, &fdc)) { ++ perror("ioctl(CRIOGET)"); ++ return -EINVAL; ++ } ++ ++ ciphers[id].func(fdc, tp); ++ ++ close(fdc); ++ close(fd); ++ ++ return 0; ++} ++ ++int get_alignmask(int fdc, struct session_op *sess) ++{ ++ int alignmask; ++ ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++ ++ siop.ses = sess->ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSINFO)"); ++ return -EINVAL; ++ } ++ alignmask = siop.alignmask; ++#else ++ alignmask = 0; ++#endif ++ ++ return alignmask; ++} ++ ++void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ int i; ++ ++ if (tp.nflag) { ++ encrypt_data(fdc, tp, sess); ++ } else { ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (must_exit) ++ break; ++ ++ tp.nvalue = i; ++ if (encrypt_data(fdc, tp, sess)) { ++ break; ++ } ++ } ++ } ++} ++ ++ ++int run_null(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ ++ fprintf(stderr, "Testing NULL cipher: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_NULL; ++ sess.keylen = 0; ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_aes_cbc(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ ++ fprintf(stderr, "\nTesting AES-128-CBC cipher: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AES_CBC; ++ sess.keylen = 16; ++ memset(keybuf, 0x42, 16); ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_aes_xts(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ ++ fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AES_XTS; ++ sess.keylen = 32; ++ memset(keybuf, 0x42, sess.keylen); ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_crc32c(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ ++ fprintf(stderr, "\nTesting CRC32C hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_CRC32C; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_sha1(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ ++ fprintf(stderr, "\nTesting SHA-1 hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_SHA1; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_sha256(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ ++ fprintf(stderr, "\nTesting SHA2-256 hash: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_SHA2_256; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int main(int argc, char **argv) ++{ ++ int i; ++ int c; ++ bool alg_flag; ++ char *alg_name; ++ struct test_params tp; ++ ++ tp.tflag = false; ++ tp.nflag = false; ++ alg_flag = false; ++ opterr = 0; ++ while ((c = getopt(argc, argv, "hn:t:")) != -1) { ++ switch (c) { ++ case 'n': ++ tp.nvalue = atoi(optarg); ++ tp.nflag = true; ++ break; ++ case 't': ++ tp.tvalue = atoi(optarg); ++ tp.tflag = true; ++ break; ++ case 'h': /* no break */ ++ default: ++ usage(argv[0]); ++ exit(1); ++ } ++ } ++ ++ /* the name of a specific test asked on the command line */ ++ if (optind < argc) { ++ alg_name = argv[optind]; ++ alg_flag = true; ++ } ++ ++ /* default test time */ ++ if (!tp.tflag) { ++ tp.tvalue = 5; ++ } ++ ++ signal(SIGALRM, alarm_handler); ++ signal(SIGINT, exit_handler); ++ ++ for (i = 0; i < ALG_COUNT; i++) { ++ if (must_exit) ++ break; ++ ++ if (alg_flag) { ++ if (strcmp(alg_name, ciphers[i].name) == 0) { ++ run_test(i, tp); ++ } ++ } else { ++ run_test(i, tp); ++ } ++ } ++ ++ return 0; ++} +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0082-force-LC_TIME-value-to-avoid-mpstat-not-using-ISO860.patch b/recipes-kernel/cryptodev/sdk_patches/0082-force-LC_TIME-value-to-avoid-mpstat-not-using-ISO860.patch new file mode 100644 index 0000000..6f3df51 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0082-force-LC_TIME-value-to-avoid-mpstat-not-using-ISO860.patch @@ -0,0 +1,31 @@ +From eee8668c6f0e558e77533edb80c1ca7d4dc486e2 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 17:00:29 +0300 +Subject: [PATCH 082/104] force LC_TIME value to avoid mpstat not using ISO8601 + format + +(not everybody has this locale - silent warnings on some systems) + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index f2a8ba6..1901620 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -24,6 +24,10 @@ CMD_BIN="async_speed" + OUT_BASENAME="async_speed" + MPSTAT_OUT="mpstat_out" + ++# A bigger hammer for mpstat to use ISO8601 time format (fixed in 11.2.2) ++export LC_TIME=en_GB.UTF-8 &> /dev/null ++ ++ + function usage + { + cat << EOF +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0083-use-the-same-algorithm-names-in-sync_speed-as-in-asy.patch b/recipes-kernel/cryptodev/sdk_patches/0083-use-the-same-algorithm-names-in-sync_speed-as-in-asy.patch new file mode 100644 index 0000000..13dde81 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0083-use-the-same-algorithm-names-in-sync_speed-as-in-asy.patch @@ -0,0 +1,58 @@ +From a6e777aba434533f726bc9d34b074b7f36429126 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 17:23:27 +0300 +Subject: [PATCH 083/104] use the same algorithm names in sync_speed as in + async_speed + +Signed-off-by: Cristian Stoica +--- + tests/sync_speed.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tests/sync_speed.c b/tests/sync_speed.c +index b0cb9ad..56cd3aa 100644 +--- a/tests/sync_speed.c ++++ b/tests/sync_speed.c +@@ -45,8 +45,8 @@ const char usage_str[] = "Usage: %s [OPTION]... |\n" + ; + + int run_null(int fdc, struct test_params tp); +-int run_aes_cbc(int fdc, struct test_params tp); +-int run_aes_xts(int fdc, struct test_params tp); ++int run_aes_128_cbc(int fdc, struct test_params tp); ++int run_aes_256_xts(int fdc, struct test_params tp); + int run_crc32c(int fdc, struct test_params tp); + int run_sha1(int fdc, struct test_params tp); + int run_sha256(int fdc, struct test_params tp); +@@ -58,8 +58,8 @@ struct { + int (*func)(int, struct test_params); + } ciphers[ALG_COUNT] = { + {"null", run_null}, +- {"aes-cbc", run_aes_cbc}, +- {"aes-xts", run_aes_xts}, ++ {"aes-128-cbc", run_aes_128_cbc}, ++ {"aes-256-xts", run_aes_256_xts}, + {"crc32c", run_crc32c}, + {"sha1", run_sha1}, + {"sha256", run_sha256}, +@@ -251,7 +251,7 @@ int run_null(int fdc, struct test_params tp) + return 0; + } + +-int run_aes_cbc(int fdc, struct test_params tp) ++int run_aes_128_cbc(int fdc, struct test_params tp) + { + struct session_op sess; + char keybuf[32]; +@@ -271,7 +271,7 @@ int run_aes_cbc(int fdc, struct test_params tp) + return 0; + } + +-int run_aes_xts(int fdc, struct test_params tp) ++int run_aes_256_xts(int fdc, struct test_params tp) + { + struct session_op sess; + char keybuf[32]; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0084-fix-ignored-SIGALRM-signals-on-some-platforms.patch b/recipes-kernel/cryptodev/sdk_patches/0084-fix-ignored-SIGALRM-signals-on-some-platforms.patch new file mode 100644 index 0000000..aa05f98 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0084-fix-ignored-SIGALRM-signals-on-some-platforms.patch @@ -0,0 +1,44 @@ +From 1bcef054cfc094e51c9c3cb1048b8bf909326082 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 17:41:09 +0300 +Subject: [PATCH 084/104] fix ignored SIGALRM signals on some platforms + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 4 ++-- + tests/sync_speed.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index d843c02..eb8468d 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -76,8 +76,8 @@ static double udifftimeval(struct timeval start, struct timeval end) + (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; + } + +-static int must_finish = 0; +-static int must_exit = 0; ++static volatile int must_finish; ++static volatile int must_exit; + static struct pollfd pfd; + + static void alarm_handler(int signo) +diff --git a/tests/sync_speed.c b/tests/sync_speed.c +index 56cd3aa..ba1d170 100644 +--- a/tests/sync_speed.c ++++ b/tests/sync_speed.c +@@ -71,8 +71,8 @@ static double udifftimeval(struct timeval start, struct timeval end) + (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; + } + +-static int must_finish = 0; +-static int must_exit = 0; ++static volatile int must_finish; ++static volatile int must_exit; + + static void alarm_handler(int signo) + { +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0085-add-notes-about-configured-limits-in-SEC-driver.patch b/recipes-kernel/cryptodev/sdk_patches/0085-add-notes-about-configured-limits-in-SEC-driver.patch new file mode 100644 index 0000000..23f4b54 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0085-add-notes-about-configured-limits-in-SEC-driver.patch @@ -0,0 +1,56 @@ +From b682119d432af1190699c56039f6584ac83ae7b9 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 18:03:07 +0300 +Subject: [PATCH 085/104] add notes about configured limits in SEC driver + +Signed-off-by: Cristian Stoica +--- + tests/async_speed.c | 3 ++- + tests/async_speed_multi.sh | 2 ++ + tests/sync_speed.c | 3 ++- + 3 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/tests/async_speed.c b/tests/async_speed.c +index eb8468d..d16d17e 100644 +--- a/tests/async_speed.c ++++ b/tests/async_speed.c +@@ -47,7 +47,8 @@ const char usage_str[] = "Usage: %s [OPTION]... |\n" + " -t \t" "time to run each test (default 10 secs)\n" + " -n \t" "size of the test buffer\n" + " -m\t\t" "output in a machine readable format\n" +- " -h\t\t" "show this help\n" ++ " -h\t\t" "show this help\n\n" ++ "Note: SEC driver is configured to support buffers smaller than 512K\n" + ; + + int run_null(int fdc, struct test_params tp); +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index 1901620..f83e362 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -40,6 +40,8 @@ Usage: `basename $0` [OPTIONS] + -h show this help + + alg_name: null, aes-128-cbc, aes-256-xts, sha1, sha256, crc32c ++ ++Note: SEC driver is configured to support buffers smaller than 512K + EOF + } + +diff --git a/tests/sync_speed.c b/tests/sync_speed.c +index ba1d170..ceae645 100644 +--- a/tests/sync_speed.c ++++ b/tests/sync_speed.c +@@ -41,7 +41,8 @@ const char usage_str[] = "Usage: %s [OPTION]... |\n" + "Run benchmark test for cipher or hash\n\n" + " -t \t" "time to run each test (default 10 secs)\n" + " -n \t" "size of the test buffer\n" +- " -h\t\t" "show this help\n" ++ " -h\t\t" "show this help\n\n" ++ "Note: SEC driver is configured to support buffers smaller than 512K\n" + ; + + int run_null(int fdc, struct test_params tp); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0086-add-a-wrapper-script-for-running-all-tests.patch b/recipes-kernel/cryptodev/sdk_patches/0086-add-a-wrapper-script-for-running-all-tests.patch new file mode 100644 index 0000000..3e781aa --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0086-add-a-wrapper-script-for-running-all-tests.patch @@ -0,0 +1,58 @@ +From fc04b5a05fd4ab1fc0f581b52d52db7c709dfc6a Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 18:55:09 +0300 +Subject: [PATCH 086/104] add a wrapper script for running all tests + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 1 + + tests/run_crypto_tests.sh | 25 +++++++++++++++++++++++++ + 2 files changed, 26 insertions(+) + create mode 100644 tests/run_crypto_tests.sh + +diff --git a/tests/Makefile b/tests/Makefile +index 400fb7a..51469e8 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -39,6 +39,7 @@ install: + install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \ + done + install -m 755 async_speed_multi.sh $(DESTDIR)/$(bindir) ++ install -m 755 run_crypto_tests.sh $(DESTDIR)/$(bindir) + + clean: + rm -f *.o *~ $(hostprogs) +diff --git a/tests/run_crypto_tests.sh b/tests/run_crypto_tests.sh +new file mode 100644 +index 0000000..32ab8e2 +--- /dev/null ++++ b/tests/run_crypto_tests.sh +@@ -0,0 +1,25 @@ ++#!/bin/bash ++ ++ ++BUF_SIZE="8192 16384 65536 131072 262144" ++THREAD_CNT="1 8 12" ++ALG_NAMES="aes-128-cbc aes-256-xts sha1 sha256 crc32c" ++ ++#restool dpseci create --num-queues=8 --priorities=1,2,3,4,5,6,7,8 ++#restool dprc assign dprc.1 --object=dpseci.0 --plugged=1 ++ ++ ++#grep DPIO /proc/interrupts ++for alg_name in ${ALG_NAMES} ++do ++ for multi in ${THREAD_CNT} ++ do ++ for bsize in ${BUF_SIZE} ++ do ++ async_speed_multi.sh -t 10 -n $bsize -m ${multi} ${alg_name} | ++ tail -n 1 ++ done ++ done ++done ++ ++#grep DPIO /proc/interrupts +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0087-add-to-cpu-idle-for-convenience.patch b/recipes-kernel/cryptodev/sdk_patches/0087-add-to-cpu-idle-for-convenience.patch new file mode 100644 index 0000000..edd47f7 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0087-add-to-cpu-idle-for-convenience.patch @@ -0,0 +1,26 @@ +From a2894f645e972b7dfc97b59ea1c1e91e741c04d1 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Fri, 28 Oct 2016 19:07:29 +0300 +Subject: [PATCH 087/104] add % to cpu idle for convenience + +Signed-off-by: Cristian Stoica +--- + tests/async_speed_multi.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +index f83e362..90f9b72 100755 +--- a/tests/async_speed_multi.sh ++++ b/tests/async_speed_multi.sh +@@ -112,7 +112,7 @@ function run_parallel + echo -e "algorithm\t""threads\t""run time\t"\ + "buffer size\t""GB/s\t""%cpu idle" + echo -e "${alg_name}\t${mvalue}\t${runtime}\t"\ +- "${nvalue}\t${avg_speed}\t${cpu_idle}" ++ "${nvalue}\t${avg_speed}\t${cpu_idle}%" + fi + } + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0088-merge-sync-and-async-benchmarks-into-a-single-progra.patch b/recipes-kernel/cryptodev/sdk_patches/0088-merge-sync-and-async-benchmarks-into-a-single-progra.patch new file mode 100644 index 0000000..9f7709b --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0088-merge-sync-and-async-benchmarks-into-a-single-progra.patch @@ -0,0 +1,1858 @@ +From a7e42a9c9a2cd4b4ffd369ae57dfbd207536766a Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 1 Nov 2016 12:01:33 +0200 +Subject: [PATCH 088/104] merge sync and async benchmarks into a single program + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 9 +- + tests/async_speed.c | 463 -------------------------------------- + tests/async_speed_multi.sh | 172 -------------- + tests/run_crypto_tests.sh | 2 +- + tests/speed.c | 546 +++++++++++++++++++++++++++++++++++++++++++++ + tests/speed_multi.sh | 174 +++++++++++++++ + tests/sync_speed.c | 400 --------------------------------- + 7 files changed, 725 insertions(+), 1041 deletions(-) + delete mode 100644 tests/async_speed.c + delete mode 100755 tests/async_speed_multi.sh + create mode 100644 tests/speed.c + create mode 100755 tests/speed_multi.sh + delete mode 100644 tests/sync_speed.c + +diff --git a/tests/Makefile b/tests/Makefile +index 51469e8..88f5040 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -3,19 +3,18 @@ CFLAGS += -I.. $(CRYPTODEV_CFLAGS) + + comp_progs := cipher_comp hash_comp hmac_comp + +-hostprogs := cipher cipher-aead hmac sync_speed async_cipher async_hmac \ +- async_speed sha_speed hashcrypt_speed fullspeed cipher-gcm \ ++hostprogs := cipher cipher-aead hmac async_cipher async_hmac \ ++ speed sha_speed hashcrypt_speed fullspeed cipher-gcm \ + cipher-aead-srtp $(comp_progs) + + example-cipher-objs := cipher.o + example-cipher-aead-objs := cipher-aead.o + example-hmac-objs := hmac.o +-example-speed-objs := sync_speed.o + example-fullspeed-objs := fullspeed.c + example-sha-speed-objs := sha_speed.c + example-async-cipher-objs := async_cipher.o + example-async-hmac-objs := async_hmac.o +-example-async-speed-objs := async_speed.o ++example-async-speed-objs := speed.o + example-hashcrypt-speed-objs := hashcrypt_speed.c + + prefix ?= /usr/local +@@ -38,7 +37,7 @@ install: + for prog in $(hostprogs); do \ + install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \ + done +- install -m 755 async_speed_multi.sh $(DESTDIR)/$(bindir) ++ install -m 755 speed_multi.sh $(DESTDIR)/$(bindir) + install -m 755 run_crypto_tests.sh $(DESTDIR)/$(bindir) + + clean: +diff --git a/tests/async_speed.c b/tests/async_speed.c +deleted file mode 100644 +index d16d17e..0000000 +--- a/tests/async_speed.c ++++ /dev/null +@@ -1,463 +0,0 @@ +-/* cryptodev_test - simple benchmark tool for cryptodev +- * +- * Copyright (C) 2010 by Phil Sutter +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef ENABLE_ASYNC +- +-struct test_params { +- bool tflag; +- bool nflag; +- bool mflag; +- int tvalue; +- int nvalue; +-}; +- +-const char usage_str[] = "Usage: %s [OPTION]... |\n" +- "Run benchmark test for cipher or hash\n\n" +- " -t \t" "time to run each test (default 10 secs)\n" +- " -n \t" "size of the test buffer\n" +- " -m\t\t" "output in a machine readable format\n" +- " -h\t\t" "show this help\n\n" +- "Note: SEC driver is configured to support buffers smaller than 512K\n" +-; +- +-int run_null(int fdc, struct test_params tp); +-int run_aes_128_cbc(int fdc, struct test_params tp); +-int run_aes_256_xts(int fdc, struct test_params tp); +-int run_crc32c(int fdc, struct test_params tp); +-int run_sha1(int fdc, struct test_params tp); +-int run_sha256(int fdc, struct test_params tp); +- +-#define ALG_COUNT 6 +-struct { +- char *name; +- int (*func)(int, struct test_params); +-} ciphers[ALG_COUNT] = { +- {"null", run_null}, +- {"aes-128-cbc", run_aes_128_cbc}, +- {"aes-256-xts", run_aes_256_xts}, +- {"crc32c", run_crc32c}, +- {"sha1", run_sha1}, +- {"sha256", run_sha256}, +-}; +- +-static double udifftimeval(struct timeval start, struct timeval end) +-{ +- return (double)(end.tv_usec - start.tv_usec) + +- (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; +-} +- +-static volatile int must_finish; +-static volatile int must_exit; +-static struct pollfd pfd; +- +-static void alarm_handler(int signo) +-{ +- must_finish = 1; +- pfd.events = POLLIN; +-} +- +-static void exit_handler(int signo) +-{ +- must_exit = 1; +- printf("\nexit requested by user through ctrl+c \n"); +-} +- +-static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; +- +-static void value2human(uint64_t bytes, double time, double* data, double* speed,char* metric) +-{ +- int unit = 0; +- +- *data = bytes; +- while (*data > 1024 && units[unit + 1]) { +- *data /= 1024; +- unit++; +- } +- *speed = *data / time; +- sprintf(metric, "%sB", units[unit]); +-} +- +-static void value2machine(uint64_t bytes, double time, double* speed) +-{ +- *speed = bytes / time; +-} +- +-int get_alignmask(int fdc, struct session_op *sess) +-{ +- int alignmask; +- int min_alignmask = sizeof(void*) - 1; +- +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +- +- siop.ses = sess->ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return -EINVAL; +- } +- alignmask = siop.alignmask; +- if (alignmask < min_alignmask) { +- alignmask = min_alignmask; +- } +-#else +- alignmask = 0; +-#endif +- +- return alignmask; +-} +- +-int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) +-{ +- struct crypt_op cop; +- char *buffer[64], iv[32]; +- uint8_t mac[64][HASH_MAX_LEN]; +- static int val = 23; +- struct timeval start, end; +- uint64_t total = 0; +- double secs, ddata, dspeed; +- char metric[16]; +- int rc, wqueue = 0, bufidx = 0; +- int alignmask; +- +- memset(iv, 0x23, 32); +- +- if (!tp.mflag) { +- printf("\tBuffer size %d bytes: ", tp.nvalue); +- fflush(stdout); +- } +- +- alignmask = get_alignmask(fdc, sess); +- for (rc = 0; rc < 64; rc++) { +- if (alignmask) { +- if (posix_memalign((void **)(buffer + rc), alignmask + 1, tp.nvalue)) { +- printf("posix_memalign() failed!\n"); +- return 1; +- } +- } else { +- if (!(buffer[rc] = malloc(tp.nvalue))) { +- perror("malloc()"); +- return 1; +- } +- } +- memset(buffer[rc], val++, tp.nvalue); +- } +- pfd.fd = fdc; +- pfd.events = POLLOUT | POLLIN; +- +- must_finish = 0; +- alarm(tp.tvalue); +- +- gettimeofday(&start, NULL); +- do { +- if ((rc = poll(&pfd, 1, 100)) < 0) { +- if (errno & (ERESTART | EINTR)) +- continue; +- fprintf(stderr, "errno = %d ", errno); +- perror("poll()"); +- return 1; +- } +- +- if (pfd.revents & POLLOUT) { +- memset(&cop, 0, sizeof(cop)); +- cop.ses = sess->ses; +- cop.len = tp.nvalue; +- cop.iv = (unsigned char *)iv; +- cop.op = COP_ENCRYPT; +- cop.src = cop.dst = (unsigned char *)buffer[bufidx]; +- cop.mac = mac[bufidx]; +- bufidx = (bufidx + 1) % 64; +- +- if (ioctl(fdc, CIOCASYNCCRYPT, &cop)) { +- perror("ioctl(CIOCASYNCCRYPT)"); +- return 1; +- } +- wqueue++; +- } +- if (pfd.revents & POLLIN) { +- if (ioctl(fdc, CIOCASYNCFETCH, &cop)) { +- perror("ioctl(CIOCASYNCFETCH)"); +- return 1; +- } +- wqueue--; +- total += cop.len; +- } +- } while(!must_finish || wqueue); +- gettimeofday(&end, NULL); +- +- secs = udifftimeval(start, end)/ 1000000.0; +- +- if (tp.mflag) { +- value2machine(total, secs, &dspeed); +- printf("%" PRIu64 "\t%.2f\t%.2f\n", total, secs, dspeed); +- } else { +- value2human(total, secs, &ddata, &dspeed, metric); +- printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); +- printf ("%.2f %s/sec\n", dspeed, metric); +- } +- +- for (rc = 0; rc < 64; rc++) +- free(buffer[rc]); +- return 0; +-} +- +-void usage(char *cmd_name) +-{ +- printf(usage_str, cmd_name); +-} +- +-int run_test(int id, struct test_params tp) +-{ +- int fd; +- int fdc; +- int err; +- +- fd = open("/dev/crypto", O_RDWR, 0); +- if (fd < 0) { +- perror("open()"); +- return fd; +- } +- if (ioctl(fd, CRIOGET, &fdc)) { +- perror("ioctl(CRIOGET)"); +- return -EINVAL; +- } +- +- if (!tp.mflag) { +- fprintf(stderr, "Testing %s:\n", ciphers[id].name); +- } +- err = ciphers[id].func(fdc, tp); +- +- close(fdc); +- close(fd); +- +- return err; +-} +- +-void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) +-{ +- int i; +- +- if (tp.nflag) { +- encrypt_data(fdc, tp, sess); +- } else { +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (must_exit) { +- break; +- } +- +- tp.nvalue = i; +- if (encrypt_data(fdc, tp, sess)) { +- break; +- } +- } +- } +-} +- +- +-int run_null(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- char keybuf[32]; +- +- fprintf(stderr, "Testing NULL cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_NULL; +- sess.keylen = 0; +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return -EINVAL; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_aes_128_cbc(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- char keybuf[32]; +- +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_AES_CBC; +- sess.keylen = 16; +- memset(keybuf, 0x42, 16); +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return -EINVAL; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_aes_256_xts(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- char keybuf[32]; +- +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_AES_XTS; +- sess.keylen = 32; +- memset(keybuf, 0x42, sess.keylen); +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return -EINVAL; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_crc32c(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_CRC32C; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_sha1(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_SHA1; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_sha256(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_SHA2_256; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int main(int argc, char **argv) +-{ +- int err = 0; +- int i; +- int c; +- bool alg_flag; +- char *alg_name; +- struct test_params tp; +- +- tp.tflag = false; +- tp.nflag = false; +- tp.mflag = false; +- alg_flag = false; +- opterr = 0; +- while ((c = getopt(argc, argv, "hn:t:m")) != -1) { +- switch (c) { +- case 'n': +- tp.nvalue = atoi(optarg); +- tp.nflag = true; +- break; +- case 't': +- tp.tvalue = atoi(optarg); +- tp.tflag = true; +- break; +- case 'm': +- tp.mflag = true; +- break; +- case 'h': /* no break */ +- default: +- usage(argv[0]); +- exit(1); +- } +- } +- +- /* the name of a specific test asked on the command line */ +- if (optind < argc) { +- alg_name = argv[optind]; +- alg_flag = true; +- } +- +- /* default test time */ +- if (!tp.tflag) { +- tp.tvalue = 5; +- } +- +- signal(SIGALRM, alarm_handler); +- signal(SIGINT, exit_handler); +- +- for (i = 0; i < ALG_COUNT; i++) { +- if (must_exit) { +- break; +- } +- +- if (alg_flag) { +- if (strcmp(alg_name, ciphers[i].name) == 0) { +- err = run_test(i, tp); +- } +- } else { +- err = run_test(i, tp); +- if (err != 0) { +- break; +- } +- } +- } +- +- return err; +-} +- +-#else +-int +-main(int argc, char** argv) +-{ +- return (0); +-} +-#endif +diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh +deleted file mode 100755 +index 90f9b72..0000000 +--- a/tests/async_speed_multi.sh ++++ /dev/null +@@ -1,172 +0,0 @@ +-#!/bin/bash +-# +-# Copyright 2016 NXP Semiconductors +-# +-# This program is free software: you can redistribute it and/or modify +-# it under the terms of the GNU General Public License as published by +-# the Free Software Foundation, either version 2 of the License, or +-# (at your option) any later version. +-# +-# This program is distributed in the hope that it will be useful, +-# but WITHOUT ANY WARRANTY; without even the implied warranty of +-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-# GNU General Public License for more details. +-# +-# You should have received a copy of the GNU General Public License +-# along with this program. If not, see . +- +- +- +-# no user-configurable options below this line +- +-NUM_CORES=$(nproc) +-CMD_BIN="async_speed" +-OUT_BASENAME="async_speed" +-MPSTAT_OUT="mpstat_out" +- +-# A bigger hammer for mpstat to use ISO8601 time format (fixed in 11.2.2) +-export LC_TIME=en_GB.UTF-8 &> /dev/null +- +- +-function usage +-{ +-cat << EOF +-Usage: `basename $0` [OPTIONS] +- +- -m number of threads to run with (defaults to number of cores) +- -t time to run each test (default 10 secs) +- -n size of the test buffer (default 256 bytes) +- -v make output more verbose (default tabular) +- -h show this help +- +-alg_name: null, aes-128-cbc, aes-256-xts, sha1, sha256, crc32c +- +-Note: SEC driver is configured to support buffers smaller than 512K +-EOF +-} +- +-function SUM { +- paste -sd+ - | bc -l +-} +- +-function get_cpu_idle +-{ +- header_line=$(grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g') +- idle_column=$(echo $header_line | wc -w) +- average_idle=$(grep Average ${MPSTAT_OUT} | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | tail -n 1) +- +- echo $average_idle +-} +- +-function run_parallel +-{ +- trap control_c SIGINT +- +- OPTIONS="-t $tvalue -n $nvalue -m" +- CMD="$CMD_BIN $OPTIONS $alg_name" +- +- (sleep 1; S_TIME_FORMAT=ISO mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & +- MPSTAT_PID=$! +- +- PIDS="" +- start=$(date +%s.%N) +- +- for i in $(seq 0 $(($mvalue-1))) +- do +- CMD_OUT="${OUT_BASENAME}_${i}" +- +- $CMD &> $CMD_OUT & +- PID=$! +- AFFINITY=$(($i % $NUM_CORES)) +- taskset -pc $AFFINITY $PID > /dev/null +- +- PIDS="$PID $PIDS" +- done +- +- wait $PIDS +- end=$(date +%s.%N) +- +- wait $MPSTAT_PID +- +- grep "ioctl" ${OUT_BASENAME}_* &> /dev/null +- if (($? == 0)) +- then +- echo "cryptodev is not built with -DENABLE_ASYNC flag" +- exit 1 +- fi +- +- runtime=$(echo "scale=2; ($end - $start) / 1" | bc -l ) +- total_data=$(cat ${OUT_BASENAME}_* | cut -f 1 | SUM) +- avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) +- cpu_idle=$(get_cpu_idle) +- +- if [ ! -z "$vvalue" ] +- then +- echo +- echo "buffer size : $nvalue" +- echo "running time : $runtime" +- echo "avg_speed : $avg_speed GB/s" +- echo "all_cpu idle : $cpu_idle %" +- echo +- else +- echo -e "algorithm\t""threads\t""run time\t"\ +- "buffer size\t""GB/s\t""%cpu idle" +- echo -e "${alg_name}\t${mvalue}\t${runtime}\t"\ +- "${nvalue}\t${avg_speed}\t${cpu_idle}%" +- fi +-} +- +-function control_c +-{ +- killall async_speed > /dev/null +- killall mpstat > /dev/null +-} +- +-function main +-{ +- [ ! -e "/dev/crypto" ] && +- (sudo modprobe cryptodev || modprobe cryptodev || exit 1) +- +- $(which ${CMD_BIN} &> /dev/null) +- if (($? != 0)) +- then +- echo "${CMD_BIN} test is not installed" +- exit 1 +- fi +- +- rm -f ${OUT_BASENAME}_* +- rm -f ${MPSTAT_OUT} +- +- while getopts vhm:t:n: option +- do +- case "$option" in +- m) mvalue="$OPTARG";; +- t) tvalue="$OPTARG";; +- n) nvalue="$OPTARG";; +- v) vvalue="verbose";; +- *) usage $0; exit 1;; +- esac +- done +- +- shift $((OPTIND-1)) +- alg_name=$1 +- +- [ -z "$tvalue" ] && tvalue=10 # 10 seconds per test by default +- [ -z "$mvalue" ] && mvalue=$NUM_CORES # thread count defaults to nproc +- [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size +- +- [ "$tvalue" -lt 5 ] && tvalue=5 +- +- case "$alg_name" in +- "null" |\ +- "aes-128-cbc" |\ +- "aes-256-xts" |\ +- "sha1" |\ +- "sha256" |\ +- "crc32c" ) run_parallel;; +- * ) usage && exit 1;; +- esac +-} +- +-main "$@" +- +diff --git a/tests/run_crypto_tests.sh b/tests/run_crypto_tests.sh +index 32ab8e2..e128637 100644 +--- a/tests/run_crypto_tests.sh ++++ b/tests/run_crypto_tests.sh +@@ -16,7 +16,7 @@ do + do + for bsize in ${BUF_SIZE} + do +- async_speed_multi.sh -t 10 -n $bsize -m ${multi} ${alg_name} | ++ speed_multi.sh -t 10 -n $bsize -m ${multi} ${alg_name} | + tail -n 1 + done + done +diff --git a/tests/speed.c b/tests/speed.c +new file mode 100644 +index 0000000..3b36db1 +--- /dev/null ++++ b/tests/speed.c +@@ -0,0 +1,546 @@ ++/* cryptodev_test - simple benchmark tool for cryptodev ++ * ++ * Copyright (C) 2010 by Phil Sutter ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++struct test_params { ++ bool tflag; ++ bool nflag; ++ bool mflag; ++ bool aflag; ++ int tvalue; ++ int nvalue; ++}; ++ ++const char usage_str[] = "Usage: %s [OPTION]... |\n" ++ "Run benchmark test for cipher or hash\n\n" ++ " -t \t" "time to run each test (default 10 secs)\n" ++ " -n \t" "size of the test buffer\n" ++ " -m\t\t" "output in a machine readable format\n" ++ " -a\t\t" "run the async tests (default sync)\n" ++ " -h\t\t" "show this help\n\n" ++ "Note: SEC driver is configured to support buffers smaller than 512K\n" ++; ++ ++int run_null(int fdc, struct test_params tp); ++int run_aes_128_cbc(int fdc, struct test_params tp); ++int run_aes_256_xts(int fdc, struct test_params tp); ++int run_crc32c(int fdc, struct test_params tp); ++int run_sha1(int fdc, struct test_params tp); ++int run_sha256(int fdc, struct test_params tp); ++ ++#define ALG_COUNT 6 ++struct { ++ char *name; ++ int (*func)(int, struct test_params); ++} ciphers[ALG_COUNT] = { ++ {"null", run_null}, ++ {"aes-128-cbc", run_aes_128_cbc}, ++ {"aes-256-xts", run_aes_256_xts}, ++ {"crc32c", run_crc32c}, ++ {"sha1", run_sha1}, ++ {"sha256", run_sha256}, ++}; ++ ++static double udifftimeval(struct timeval start, struct timeval end) ++{ ++ return (double)(end.tv_usec - start.tv_usec) + ++ (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; ++} ++ ++static volatile int must_finish; ++static volatile int must_exit; ++static struct pollfd pfd; ++ ++static void alarm_handler(int signo) ++{ ++ must_finish = 1; ++ pfd.events = POLLIN; ++} ++ ++static void exit_handler(int signo) ++{ ++ must_exit = 1; ++ printf("\nexit requested by user through ctrl+c \n"); ++} ++ ++static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; ++ ++static void value2human(uint64_t bytes, double time, double* data, double* speed,char* metric) ++{ ++ int unit = 0; ++ ++ *data = bytes; ++ while (*data > 1024 && units[unit + 1]) { ++ *data /= 1024; ++ unit++; ++ } ++ *speed = *data / time; ++ sprintf(metric, "%sB", units[unit]); ++} ++ ++static void value2machine(uint64_t bytes, double time, double* speed) ++{ ++ *speed = bytes / time; ++} ++ ++int get_alignmask(int fdc, struct session_op *sess) ++{ ++ int alignmask; ++ int min_alignmask = sizeof(void*) - 1; ++ ++#ifdef CIOCGSESSINFO ++ struct session_info_op siop; ++ ++ siop.ses = sess->ses; ++ if (ioctl(fdc, CIOCGSESSINFO, &siop)) { ++ perror("ioctl(CIOCGSESSINFO)"); ++ return -EINVAL; ++ } ++ alignmask = siop.alignmask; ++ if (alignmask < min_alignmask) { ++ alignmask = min_alignmask; ++ } ++#else ++ alignmask = 0; ++#endif ++ ++ return alignmask; ++} ++ ++int encrypt_async(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ struct crypt_op cop; ++ char *buffer[64], iv[32]; ++ uint8_t mac[64][HASH_MAX_LEN]; ++ static int val = 23; ++ struct timeval start, end; ++ uint64_t total = 0; ++ double secs, ddata, dspeed; ++ char metric[16]; ++ int rc, wqueue = 0, bufidx = 0; ++ int alignmask; ++ ++ memset(iv, 0x23, 32); ++ ++ if (!tp.mflag) { ++ printf("\tBuffer size %d bytes: ", tp.nvalue); ++ fflush(stdout); ++ } ++ ++ alignmask = get_alignmask(fdc, sess); ++ for (rc = 0; rc < 64; rc++) { ++ if (alignmask) { ++ if (posix_memalign((void **)(buffer + rc), alignmask + 1, tp.nvalue)) { ++ printf("posix_memalign() failed!\n"); ++ return 1; ++ } ++ } else { ++ if (!(buffer[rc] = malloc(tp.nvalue))) { ++ perror("malloc()"); ++ return 1; ++ } ++ } ++ memset(buffer[rc], val++, tp.nvalue); ++ } ++ pfd.fd = fdc; ++ pfd.events = POLLOUT | POLLIN; ++ ++ must_finish = 0; ++ alarm(tp.tvalue); ++ ++ gettimeofday(&start, NULL); ++ do { ++ if ((rc = poll(&pfd, 1, 100)) < 0) { ++ if (errno & (ERESTART | EINTR)) ++ continue; ++ fprintf(stderr, "errno = %d ", errno); ++ perror("poll()"); ++ return 1; ++ } ++ ++ if (pfd.revents & POLLOUT) { ++ memset(&cop, 0, sizeof(cop)); ++ cop.ses = sess->ses; ++ cop.len = tp.nvalue; ++ cop.iv = (unsigned char *)iv; ++ cop.op = COP_ENCRYPT; ++ cop.src = cop.dst = (unsigned char *)buffer[bufidx]; ++ cop.mac = mac[bufidx]; ++ bufidx = (bufidx + 1) % 64; ++ ++ if (ioctl(fdc, CIOCASYNCCRYPT, &cop)) { ++ perror("ioctl(CIOCASYNCCRYPT)"); ++ return 1; ++ } ++ wqueue++; ++ } ++ if (pfd.revents & POLLIN) { ++ if (ioctl(fdc, CIOCASYNCFETCH, &cop)) { ++ perror("ioctl(CIOCASYNCFETCH)"); ++ return 1; ++ } ++ wqueue--; ++ total += cop.len; ++ } ++ } while(!must_finish || wqueue); ++ gettimeofday(&end, NULL); ++ ++ secs = udifftimeval(start, end)/ 1000000.0; ++ ++ if (tp.mflag) { ++ value2machine(total, secs, &dspeed); ++ printf("%" PRIu64 "\t%.2f\t%.2f\n", total, secs, dspeed); ++ } else { ++ value2human(total, secs, &ddata, &dspeed, metric); ++ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); ++ printf ("%.2f %s/sec\n", dspeed, metric); ++ } ++ ++ for (rc = 0; rc < 64; rc++) ++ free(buffer[rc]); ++ return 0; ++} ++ ++ ++static int encrypt_sync(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ struct crypt_op cop; ++ char *buffer, iv[32]; ++ char mac[HASH_MAX_LEN]; ++ static int val = 23; ++ struct timeval start, end; ++ uint64_t total = 0; ++ double secs, ddata, dspeed; ++ char metric[16]; ++ int alignmask; ++ int min_alignmask = sizeof(void*) - 1; ++ ++ memset(iv, 0x23, 32); ++ ++ if (!tp.mflag) { ++ printf("\tBuffer size %d bytes: ", tp.nvalue); ++ fflush(stdout); ++ } ++ ++ alignmask = get_alignmask(fdc, sess); ++ if (alignmask) { ++ alignmask = ((alignmask < min_alignmask) ? min_alignmask : alignmask); ++ if (posix_memalign((void **)(&buffer), alignmask + 1, tp.nvalue)) { ++ printf("posix_memalign() failed!\n"); ++ return 1; ++ } ++ } else { ++ if (!(buffer = malloc(tp.nvalue))) { ++ perror("malloc()"); ++ return 1; ++ } ++ } ++ memset(buffer, val++, tp.nvalue); ++ ++ must_finish = 0; ++ alarm(tp.tvalue); ++ ++ gettimeofday(&start, NULL); ++ do { ++ memset(&cop, 0, sizeof(cop)); ++ cop.ses = sess->ses; ++ cop.len = tp.nvalue; ++ cop.iv = (unsigned char *)iv; ++ cop.op = COP_ENCRYPT; ++ cop.src = cop.dst = (unsigned char *)buffer; ++ cop.mac = (unsigned char *)mac; ++ ++ if (ioctl(fdc, CIOCCRYPT, &cop)) { ++ perror("ioctl(CIOCCRYPT)"); ++ return 1; ++ } ++ total += cop.len; ++ } while(!must_finish); ++ gettimeofday(&end, NULL); ++ ++ secs = udifftimeval(start, end)/ 1000000.0; ++ ++ if (tp.mflag) { ++ value2machine(total, secs, &dspeed); ++ printf("%" PRIu64 "\t%.2f\t%.2f\n", total, secs, dspeed); ++ } else { ++ value2human(total, secs, &ddata, &dspeed, metric); ++ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); ++ printf ("%.2f %s/sec\n", dspeed, metric); ++ } ++ ++ free(buffer); ++ return 0; ++} ++ ++void usage(char *cmd_name) ++{ ++ printf(usage_str, cmd_name); ++} ++ ++int run_test(int id, struct test_params tp) ++{ ++ int fd; ++ int fdc; ++ int err; ++ ++ fd = open("/dev/crypto", O_RDWR, 0); ++ if (fd < 0) { ++ perror("open()"); ++ return fd; ++ } ++ if (ioctl(fd, CRIOGET, &fdc)) { ++ perror("ioctl(CRIOGET)"); ++ return -EINVAL; ++ } ++ ++ if (!tp.mflag) { ++ char *type; ++ type = tp.aflag ? "async" : "sync"; ++ ++ fprintf(stderr, "Testing %s %s:\n", type, ciphers[id].name); ++ } ++ err = ciphers[id].func(fdc, tp); ++ ++ close(fdc); ++ close(fd); ++ ++ return err; ++} ++ ++void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ int i; ++ int err; ++ ++ if (tp.nflag) { ++ if (tp.aflag) { ++ encrypt_async(fdc, tp, sess); ++ } else { ++ encrypt_sync(fdc, tp, sess); ++ } ++ } else { ++ for (i = 256; i <= (64 * 1024); i *= 2) { ++ if (must_exit) { ++ break; ++ } ++ ++ tp.nvalue = i; ++ if (tp.aflag) { ++ err = encrypt_async(fdc, tp, sess); ++ } else { ++ err = encrypt_sync(fdc, tp, sess); ++ } ++ ++ if (err != 0) { ++ break; ++ } ++ } ++ } ++} ++ ++ ++int run_null(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ ++ fprintf(stderr, "Testing NULL cipher: \n"); ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_NULL; ++ sess.keylen = 0; ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_aes_128_cbc(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AES_CBC; ++ sess.keylen = 16; ++ memset(keybuf, 0x42, 16); ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_aes_256_xts(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char keybuf[32]; ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AES_XTS; ++ sess.keylen = 32; ++ memset(keybuf, 0x42, sess.keylen); ++ sess.key = (unsigned char *)keybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_crc32c(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_CRC32C; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_sha1(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_SHA1; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int run_sha256(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.mac = CRYPTO_SHA2_256; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return 1; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ ++int main(int argc, char **argv) ++{ ++ int err = 0; ++ int i; ++ int c; ++ bool alg_flag; ++ char *alg_name; ++ struct test_params tp; ++ ++ tp.tflag = false; ++ tp.nflag = false; ++ tp.mflag = false; ++ tp.aflag = false; ++ alg_flag = false; ++ opterr = 0; ++ while ((c = getopt(argc, argv, "ahn:t:m")) != -1) { ++ switch (c) { ++ case 'n': ++ tp.nvalue = atoi(optarg); ++ tp.nflag = true; ++ break; ++ case 't': ++ tp.tvalue = atoi(optarg); ++ tp.tflag = true; ++ break; ++ case 'm': ++ tp.mflag = true; ++ break; ++ case 'a': ++ tp.aflag = true; ++ break; ++ case 'h': /* no break */ ++ default: ++ usage(argv[0]); ++ exit(1); ++ } ++ } ++ ++ /* the name of a specific test asked on the command line */ ++ if (optind < argc) { ++ alg_name = argv[optind]; ++ alg_flag = true; ++ } ++ ++ /* default test time */ ++ if (!tp.tflag) { ++ tp.tvalue = 5; ++ } ++ ++ signal(SIGALRM, alarm_handler); ++ signal(SIGINT, exit_handler); ++ ++ for (i = 0; i < ALG_COUNT; i++) { ++ if (must_exit) { ++ break; ++ } ++ ++ if (alg_flag) { ++ if (strcmp(alg_name, ciphers[i].name) == 0) { ++ err = run_test(i, tp); ++ } ++ } else { ++ err = run_test(i, tp); ++ if (err != 0) { ++ break; ++ } ++ } ++ } ++ ++ return err; ++} +diff --git a/tests/speed_multi.sh b/tests/speed_multi.sh +new file mode 100755 +index 0000000..b116483 +--- /dev/null ++++ b/tests/speed_multi.sh +@@ -0,0 +1,174 @@ ++#!/bin/bash ++# ++# Copyright 2016 NXP Semiconductors ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++ ++ ++# no user-configurable options below this line ++ ++NUM_CORES=$(nproc) ++CMD_BIN="speed" ++OUT_BASENAME="speed" ++MPSTAT_OUT="mpstat_out" ++ ++# A bigger hammer for mpstat to use ISO8601 time format (fixed in 11.2.2) ++export LC_TIME=en_GB.UTF-8 &> /dev/null ++ ++ ++function usage ++{ ++cat << EOF ++Usage: `basename $0` [OPTIONS] ++ ++ -m number of threads to run with (defaults to number of cores) ++ -t time to run each test (default 10 secs) ++ -n size of the test buffer (default 256 bytes) ++ -v make output more verbose (default tabular) ++ -a run async version of the benchmark (default sync) ++ -h show this help ++ ++alg_name: null, aes-128-cbc, aes-256-xts, sha1, sha256, crc32c ++ ++Note: SEC driver is configured to support buffers smaller than 512K ++EOF ++} ++ ++function SUM { ++ paste -sd+ - | bc -l ++} ++ ++function get_cpu_idle ++{ ++ header_line=$(grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g') ++ idle_column=$(echo $header_line | wc -w) ++ average_idle=$(grep Average ${MPSTAT_OUT} | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | tail -n 1) ++ ++ echo $average_idle ++} ++ ++function run_parallel ++{ ++ trap control_c SIGINT ++ ++ OPTIONS="-t $tvalue -n $nvalue -m $aflag" ++ CMD="$CMD_BIN $OPTIONS $alg_name" ++ ++ (sleep 1; S_TIME_FORMAT=ISO mpstat 1 $(($tvalue-2))) &> $MPSTAT_OUT & ++ MPSTAT_PID=$! ++ ++ PIDS="" ++ start=$(date +%s.%N) ++ ++ for i in $(seq 0 $(($mvalue-1))) ++ do ++ CMD_OUT="${OUT_BASENAME}_${i}" ++ ++ $CMD &> $CMD_OUT & ++ PID=$! ++ AFFINITY=$(($i % $NUM_CORES)) ++ taskset -pc $AFFINITY $PID > /dev/null ++ ++ PIDS="$PID $PIDS" ++ done ++ ++ wait $PIDS ++ end=$(date +%s.%N) ++ ++ wait $MPSTAT_PID ++ ++ grep "ioctl" ${OUT_BASENAME}_* &> /dev/null ++ if (($? == 0)) ++ then ++ echo "cryptodev is not built with -DENABLE_ASYNC flag" ++ exit 1 ++ fi ++ ++ runtime=$(echo "scale=2; ($end - $start) / 1" | bc -l ) ++ total_data=$(cat ${OUT_BASENAME}_* | cut -f 1 | SUM) ++ avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) ++ cpu_idle=$(get_cpu_idle) ++ ++ if [ ! -z "$vflag" ] ++ then ++ echo ++ echo "buffer size : $nvalue" ++ echo "running time : $runtime" ++ echo "avg_speed : $avg_speed GB/s" ++ echo "all_cpu idle : $cpu_idle %" ++ echo ++ else ++ echo -e "algorithm\t""threads\t""run time\t"\ ++ "buffer size\t""GB/s\t""%cpu idle" ++ echo -e "${alg_name}\t${mvalue}\t${runtime}\t"\ ++ "${nvalue}\t${avg_speed}\t${cpu_idle}%" ++ fi ++} ++ ++function control_c ++{ ++ killall $CMD_BIN > /dev/null ++ killall mpstat > /dev/null ++} ++ ++function main ++{ ++ [ ! -e "/dev/crypto" ] && ++ (sudo modprobe cryptodev || modprobe cryptodev || exit 1) ++ ++ $(which ${CMD_BIN} &> /dev/null) ++ if (($? != 0)) ++ then ++ echo "${CMD_BIN} test is not installed" ++ exit 1 ++ fi ++ ++ rm -f ${OUT_BASENAME}_* ++ rm -f ${MPSTAT_OUT} ++ ++ while getopts avhm:t:n: option ++ do ++ case "$option" in ++ m) mvalue="$OPTARG";; ++ t) tvalue="$OPTARG";; ++ n) nvalue="$OPTARG";; ++ v) vflag="verbose";; ++ a) aflag="-a";; ++ *) usage $0; exit 1;; ++ esac ++ done ++ ++ shift $((OPTIND-1)) ++ alg_name=$1 ++ ++ [ -z "$tvalue" ] && tvalue=10 # 10 seconds per test by default ++ [ -z "$mvalue" ] && mvalue=$NUM_CORES # thread count defaults to nproc ++ [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size ++ ++ [ "$tvalue" -lt 5 ] && tvalue=5 ++ ++ case "$alg_name" in ++ "null" |\ ++ "aes-128-cbc" |\ ++ "aes-256-xts" |\ ++ "sha1" |\ ++ "sha256" |\ ++ "crc32c" ) run_parallel;; ++ * ) usage && exit 1;; ++ esac ++} ++ ++main "$@" ++ +diff --git a/tests/sync_speed.c b/tests/sync_speed.c +deleted file mode 100644 +index ceae645..0000000 +--- a/tests/sync_speed.c ++++ /dev/null +@@ -1,400 +0,0 @@ +-/* cryptodev_test - simple benchmark tool for cryptodev +- * +- * Copyright (C) 2010 by Phil Sutter +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-struct test_params { +- bool tflag; +- bool nflag; +- int tvalue; +- int nvalue; +-}; +- +-const char usage_str[] = "Usage: %s [OPTION]... |\n" +- "Run benchmark test for cipher or hash\n\n" +- " -t \t" "time to run each test (default 10 secs)\n" +- " -n \t" "size of the test buffer\n" +- " -h\t\t" "show this help\n\n" +- "Note: SEC driver is configured to support buffers smaller than 512K\n" +-; +- +-int run_null(int fdc, struct test_params tp); +-int run_aes_128_cbc(int fdc, struct test_params tp); +-int run_aes_256_xts(int fdc, struct test_params tp); +-int run_crc32c(int fdc, struct test_params tp); +-int run_sha1(int fdc, struct test_params tp); +-int run_sha256(int fdc, struct test_params tp); +-int get_alignmask(int fdc, struct session_op *sess); +- +-#define ALG_COUNT 6 +-struct { +- char *name; +- int (*func)(int, struct test_params); +-} ciphers[ALG_COUNT] = { +- {"null", run_null}, +- {"aes-128-cbc", run_aes_128_cbc}, +- {"aes-256-xts", run_aes_256_xts}, +- {"crc32c", run_crc32c}, +- {"sha1", run_sha1}, +- {"sha256", run_sha256}, +-}; +- +-static double udifftimeval(struct timeval start, struct timeval end) +-{ +- return (double)(end.tv_usec - start.tv_usec) + +- (double)(end.tv_sec - start.tv_sec) * 1000 * 1000; +-} +- +-static volatile int must_finish; +-static volatile int must_exit; +- +-static void alarm_handler(int signo) +-{ +- must_finish = 1; +-} +- +-static void exit_handler(int signo) +-{ +- must_exit = 1; +- printf("\nexit requested by user through ctrl+c \n"); +-} +- +-static char *units[] = { "", "Ki", "Mi", "Gi", "Ti", 0}; +- +-static void value2human(double bytes, double time, double* data, double* speed,char* metric) +-{ +- int unit = 0; +- +- *data = bytes; +- while (*data > 1024 && units[unit + 1]) { +- *data /= 1024; +- unit++; +- } +- *speed = *data / time; +- sprintf(metric, "%sB", units[unit]); +-} +- +-static int encrypt_data(int fdc, struct test_params tp, struct session_op *sess) +-{ +- struct crypt_op cop; +- char *buffer, iv[32]; +- char mac[HASH_MAX_LEN]; +- static int val = 23; +- struct timeval start, end; +- double total = 0; +- double secs, ddata, dspeed; +- char metric[16]; +- int alignmask; +- int min_alignmask = sizeof(void*) - 1; +- +- memset(iv, 0x23, 32); +- +- printf("\tEncrypting in chunks of %d bytes: ", tp.nvalue); +- fflush(stdout); +- +- alignmask = get_alignmask(fdc, sess); +- if (alignmask) { +- alignmask = ((alignmask < min_alignmask) ? min_alignmask : alignmask); +- if (posix_memalign((void **)(&buffer), alignmask + 1, tp.nvalue)) { +- printf("posix_memalign() failed!\n"); +- return 1; +- } +- } else { +- if (!(buffer = malloc(tp.nvalue))) { +- perror("malloc()"); +- return 1; +- } +- } +- memset(buffer, val++, tp.nvalue); +- +- must_finish = 0; +- alarm(tp.tvalue); +- +- gettimeofday(&start, NULL); +- do { +- memset(&cop, 0, sizeof(cop)); +- cop.ses = sess->ses; +- cop.len = tp.nvalue; +- cop.iv = (unsigned char *)iv; +- cop.op = COP_ENCRYPT; +- cop.src = cop.dst = (unsigned char *)buffer; +- cop.mac = (unsigned char *)mac; +- +- if (ioctl(fdc, CIOCCRYPT, &cop)) { +- perror("ioctl(CIOCCRYPT)"); +- return 1; +- } +- total += cop.len; +- } while(!must_finish); +- gettimeofday(&end, NULL); +- +- secs = udifftimeval(start, end)/ 1000000.0; +- +- value2human(total, secs, &ddata, &dspeed, metric); +- printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); +- printf ("%.2f %s/sec\n", dspeed, metric); +- +- free(buffer); +- return 0; +-} +- +-void usage(char *cmd_name) +-{ +- printf(usage_str, cmd_name); +-} +- +-int run_test(int id, struct test_params tp) +-{ +- int fd; +- int fdc; +- +- fd = open("/dev/crypto", O_RDWR, 0); +- if (fd < 0) { +- perror("open()"); +- return fd; +- } +- if (ioctl(fd, CRIOGET, &fdc)) { +- perror("ioctl(CRIOGET)"); +- return -EINVAL; +- } +- +- ciphers[id].func(fdc, tp); +- +- close(fdc); +- close(fd); +- +- return 0; +-} +- +-int get_alignmask(int fdc, struct session_op *sess) +-{ +- int alignmask; +- +-#ifdef CIOCGSESSINFO +- struct session_info_op siop; +- +- siop.ses = sess->ses; +- if (ioctl(fdc, CIOCGSESSINFO, &siop)) { +- perror("ioctl(CIOCGSESSINFO)"); +- return -EINVAL; +- } +- alignmask = siop.alignmask; +-#else +- alignmask = 0; +-#endif +- +- return alignmask; +-} +- +-void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) +-{ +- int i; +- +- if (tp.nflag) { +- encrypt_data(fdc, tp, sess); +- } else { +- for (i = 256; i <= (64 * 1024); i *= 2) { +- if (must_exit) +- break; +- +- tp.nvalue = i; +- if (encrypt_data(fdc, tp, sess)) { +- break; +- } +- } +- } +-} +- +- +-int run_null(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- char keybuf[32]; +- +- fprintf(stderr, "Testing NULL cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_NULL; +- sess.keylen = 0; +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return -EINVAL; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_aes_128_cbc(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- char keybuf[32]; +- +- fprintf(stderr, "\nTesting AES-128-CBC cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_AES_CBC; +- sess.keylen = 16; +- memset(keybuf, 0x42, 16); +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return -EINVAL; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_aes_256_xts(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- char keybuf[32]; +- +- fprintf(stderr, "\nTesting AES-256-XTS cipher: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.cipher = CRYPTO_AES_XTS; +- sess.keylen = 32; +- memset(keybuf, 0x42, sess.keylen); +- sess.key = (unsigned char *)keybuf; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return -EINVAL; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_crc32c(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- +- fprintf(stderr, "\nTesting CRC32C hash: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_CRC32C; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_sha1(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- +- fprintf(stderr, "\nTesting SHA-1 hash: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_SHA1; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int run_sha256(int fdc, struct test_params tp) +-{ +- struct session_op sess; +- +- fprintf(stderr, "\nTesting SHA2-256 hash: \n"); +- memset(&sess, 0, sizeof(sess)); +- sess.mac = CRYPTO_SHA2_256; +- if (ioctl(fdc, CIOCGSESSION, &sess)) { +- perror("ioctl(CIOCGSESSION)"); +- return 1; +- } +- +- do_test_vectors(fdc, tp, &sess); +- return 0; +-} +- +-int main(int argc, char **argv) +-{ +- int i; +- int c; +- bool alg_flag; +- char *alg_name; +- struct test_params tp; +- +- tp.tflag = false; +- tp.nflag = false; +- alg_flag = false; +- opterr = 0; +- while ((c = getopt(argc, argv, "hn:t:")) != -1) { +- switch (c) { +- case 'n': +- tp.nvalue = atoi(optarg); +- tp.nflag = true; +- break; +- case 't': +- tp.tvalue = atoi(optarg); +- tp.tflag = true; +- break; +- case 'h': /* no break */ +- default: +- usage(argv[0]); +- exit(1); +- } +- } +- +- /* the name of a specific test asked on the command line */ +- if (optind < argc) { +- alg_name = argv[optind]; +- alg_flag = true; +- } +- +- /* default test time */ +- if (!tp.tflag) { +- tp.tvalue = 5; +- } +- +- signal(SIGALRM, alarm_handler); +- signal(SIGINT, exit_handler); +- +- for (i = 0; i < ALG_COUNT; i++) { +- if (must_exit) +- break; +- +- if (alg_flag) { +- if (strcmp(alg_name, ciphers[i].name) == 0) { +- run_test(i, tp); +- } +- } else { +- run_test(i, tp); +- } +- } +- +- return 0; +-} +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0089-add-async-option-to-run_crypto_tests.sh.patch b/recipes-kernel/cryptodev/sdk_patches/0089-add-async-option-to-run_crypto_tests.sh.patch new file mode 100644 index 0000000..50799f8 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0089-add-async-option-to-run_crypto_tests.sh.patch @@ -0,0 +1,62 @@ +From bccc3add64bfd4a048bf7e5a2935b2fc719d8e13 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 1 Nov 2016 13:28:40 +0200 +Subject: [PATCH 089/104] add -async option to run_crypto_tests.sh + +Signed-off-by: Cristian Stoica +--- + tests/run_crypto_tests.sh | 31 ++++++++++++++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +diff --git a/tests/run_crypto_tests.sh b/tests/run_crypto_tests.sh +index e128637..321b013 100644 +--- a/tests/run_crypto_tests.sh ++++ b/tests/run_crypto_tests.sh +@@ -4,6 +4,31 @@ + BUF_SIZE="8192 16384 65536 131072 262144" + THREAD_CNT="1 8 12" + ALG_NAMES="aes-128-cbc aes-256-xts sha1 sha256 crc32c" ++TIME=10 ++ ++############################ ++ ++function usage ++{ ++cat << EOF ++Usage: `basename $0` [OPTIONS] ++ ++ -a run async version of the benchmark (default sync) ++ -h show this help ++ ++Run in sequence benchmarks for several crypto algorithms: ++$ALG_NAMES ++EOF ++} ++ ++while getopts ah option ++do ++ case "$option" in ++ a) aflag="-a";; ++ *) usage $0; exit 1;; ++ esac ++done ++ + + #restool dpseci create --num-queues=8 --priorities=1,2,3,4,5,6,7,8 + #restool dprc assign dprc.1 --object=dpseci.0 --plugged=1 +@@ -16,7 +41,11 @@ do + do + for bsize in ${BUF_SIZE} + do +- speed_multi.sh -t 10 -n $bsize -m ${multi} ${alg_name} | ++ speed_multi.sh -t ${TIME}\ ++ -n ${bsize}\ ++ -m ${multi}\ ++ ${aflag}\ ++ ${alg_name} | + tail -n 1 + done + done +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0090-Adjust-to-recent-user-page-API-changes.patch b/recipes-kernel/cryptodev/sdk_patches/0090-Adjust-to-recent-user-page-API-changes.patch new file mode 100644 index 0000000..9595929 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0090-Adjust-to-recent-user-page-API-changes.patch @@ -0,0 +1,55 @@ +From d40bcfdfb2c2c5aa4c47b5653fdea3ee317d234b Mon Sep 17 00:00:00 2001 +From: Michael Weiser +Date: Fri, 5 Aug 2016 18:43:55 +0200 +Subject: [PATCH 090/104] Adjust to recent user page API changes + +4.6.0 basically renamed get_user_pages() to get_user_pages_remote() and +introduced a new get_user_pages() that always works on the current +task.[1] Distinguish the two APIs based on kernel version we're +compiling for. + +Also, there seems to have been a massive cleansing of +page_cache_release(page) in favour of put_page(page)[2] which was an +alias for put_page(page)[3] since 2.6.0. Before that beginning with +2.4.0 both page_cache_release(page) and put_page(page) have been aliases +for __free_page(page). So using put_page() instead of +page_cache_release(page) will produce identical code for anything after +2.4.0. + +[1] https://lkml.org/lkml/2016/2/10/555 +[2] https://www.spinics.net/lists/linux-fsdevel/msg95923.html +[3] https://www.spinics.net/lists/linux-fsdevel/msg95922.html +--- + zc.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/zc.c b/zc.c +index 29b0501..a97b49f 100644 +--- a/zc.c ++++ b/zc.c +@@ -59,7 +59,12 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + } + + down_read(&mm->mmap_sem); +- ret = get_user_pages(task, mm, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)) ++ ret = get_user_pages_remote( ++#else ++ ret = get_user_pages( ++#endif ++ task, mm, + (unsigned long)addr, pgcount, write, 0, pg, NULL); + up_read(&mm->mmap_sem); + if (ret != pgcount) +@@ -119,7 +124,7 @@ void release_user_pages(struct csession *ses) + else + ses->readonly_pages--; + +- page_cache_release(ses->pages[i]); ++ put_page(ses->pages[i]); + } + ses->used_pages = 0; + } +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0091-Fix-test-compile-time-warnings.patch b/recipes-kernel/cryptodev/sdk_patches/0091-Fix-test-compile-time-warnings.patch new file mode 100644 index 0000000..639fe0f --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0091-Fix-test-compile-time-warnings.patch @@ -0,0 +1,65 @@ +From a715480416b33b0bacd2b58ec42b9c64bdb21c0c Mon Sep 17 00:00:00 2001 +From: Michael Weiser +Date: Fri, 19 Aug 2016 10:24:40 +0100 +Subject: [PATCH 091/104] Fix test compile time warnings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +A number of tests cause compiler warnings like this: + +hashcrypt_speed.c: In function ‘hash_data’: +hashcrypt_speed.c:101:2: warning: implicit declaration of function ‘alarm’ [-Wimplicit-function-declaration] + alarm(5); + ^~~~~ +hashcrypt_speed.c: In function ‘main’: +hashcrypt_speed.c:203:2: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration] + close(fdc); + ^~~~~ + +Fix by including unistd.h. +--- + tests/hashcrypt_speed.c | 1 + + tests/sha_speed.c | 1 + + tests/speed.c | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/tests/hashcrypt_speed.c b/tests/hashcrypt_speed.c +index 045bf8e..10c9f00 100644 +--- a/tests/hashcrypt_speed.c ++++ b/tests/hashcrypt_speed.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/tests/sha_speed.c b/tests/sha_speed.c +index 9f2c8cc..30b40f5 100644 +--- a/tests/sha_speed.c ++++ b/tests/sha_speed.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +diff --git a/tests/speed.c b/tests/speed.c +index 3b36db1..fc38a63 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0092-Support-skcipher-in-addition-to-ablkcipher-API.patch b/recipes-kernel/cryptodev/sdk_patches/0092-Support-skcipher-in-addition-to-ablkcipher-API.patch new file mode 100644 index 0000000..4a82955 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0092-Support-skcipher-in-addition-to-ablkcipher-API.patch @@ -0,0 +1,281 @@ +From e41e73551c886366d741b5e401a3c4c661aa3020 Mon Sep 17 00:00:00 2001 +From: Michael Weiser +Date: Fri, 5 Aug 2016 17:26:27 +0200 +Subject: [PATCH 092/104] Support skcipher in addition to ablkcipher API + +The ablkcipher API is being phased out[1]. The unified skcipher API +seems to have made its entry with 4.3.[3, 4] By what can be seen from +migration patches[1.ff.], it's a drop-in replacement. + +Also, deallocators such as crypto_free_skcipher() are NULL-safe now[2]. + +Add a new header cipherapi.h to aid migration from ablkcipher to skcipher and +retain support for old kernels. Make it decide which API to use and provide +appropriate function calls and type definitions. Since the ablkcipher and +skcipher APIs are so similar, those are mainly defines for corresponding +pseudo-functions in namespace cryptodev_ derived directly from their API +counterparts. + +Compiles and works (i.e. checks pass) with Debian testing 4.6.4 kernel +as well as 4.8-rc2+ Linus git tree as of today. (Both require a fix for +changed page access API[5].) + +[1] https://www.spinics.net/lists/linux-crypto/msg18133.html +[2] https://www.spinics.net/lists/linux-crypto/msg18154.html, line 120 +[3] https://www.spinics.net/lists/linux-crypto/msg16373.html +[4] https://www.spinics.net/lists/linux-crypto/msg16294.html +[5] https://github.com/cryptodev-linux/cryptodev-linux/pull/14 +--- + cipherapi.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + cryptlib.c | 40 ++++++++++++++++++---------------------- + cryptlib.h | 6 ++++-- + ioctl.c | 4 ++-- + 4 files changed, 84 insertions(+), 26 deletions(-) + create mode 100644 cipherapi.h + +diff --git a/cipherapi.h b/cipherapi.h +new file mode 100644 +index 0000000..07d9923 +--- /dev/null ++++ b/cipherapi.h +@@ -0,0 +1,60 @@ ++#ifndef CIPHERAPI_H ++# define CIPHERAPI_H ++ ++#include ++ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) ++# include ++ ++typedef struct ablkcipher_alg cryptodev_blkcipher_alg_t; ++typedef struct crypto_ablkcipher cryptodev_crypto_blkcipher_t; ++typedef struct ablkcipher_request cryptodev_blkcipher_request_t; ++ ++# define cryptodev_crypto_alloc_blkcipher crypto_alloc_ablkcipher ++# define cryptodev_crypto_blkcipher_alg crypto_ablkcipher_alg ++# define cryptodev_crypto_blkcipher_blocksize crypto_ablkcipher_blocksize ++# define cryptodev_crypto_blkcipher_ivsize crypto_ablkcipher_ivsize ++# define cryptodev_crypto_blkcipher_alignmask crypto_ablkcipher_alignmask ++# define cryptodev_crypto_blkcipher_setkey crypto_ablkcipher_setkey ++ ++static inline void cryptodev_crypto_free_blkcipher(cryptodev_crypto_blkcipher_t *c) { ++ if (c) ++ crypto_free_ablkcipher(c); ++} ++ ++# define cryptodev_blkcipher_request_alloc ablkcipher_request_alloc ++# define cryptodev_blkcipher_request_set_callback ablkcipher_request_set_callback ++ ++static inline void cryptodev_blkcipher_request_free(cryptodev_blkcipher_request_t *r) { ++ if (r) ++ ablkcipher_request_free(r); ++} ++ ++# define cryptodev_blkcipher_request_set_crypt ablkcipher_request_set_crypt ++# define cryptodev_crypto_blkcipher_encrypt crypto_ablkcipher_encrypt ++# define cryptodev_crypto_blkcipher_decrypt crypto_ablkcipher_decrypt ++# define cryptodev_crypto_blkcipher_tfm crypto_ablkcipher_tfm ++#else ++#include ++ ++typedef struct skcipher_alg cryptodev_blkcipher_alg_t; ++typedef struct crypto_skcipher cryptodev_crypto_blkcipher_t; ++typedef struct skcipher_request cryptodev_blkcipher_request_t; ++ ++# define cryptodev_crypto_alloc_blkcipher crypto_alloc_skcipher ++# define cryptodev_crypto_blkcipher_alg crypto_skcipher_alg ++# define cryptodev_crypto_blkcipher_blocksize crypto_skcipher_blocksize ++# define cryptodev_crypto_blkcipher_ivsize crypto_skcipher_ivsize ++# define cryptodev_crypto_blkcipher_alignmask crypto_skcipher_alignmask ++# define cryptodev_crypto_blkcipher_setkey crypto_skcipher_setkey ++# define cryptodev_crypto_free_blkcipher crypto_free_skcipher ++# define cryptodev_blkcipher_request_alloc skcipher_request_alloc ++# define cryptodev_blkcipher_request_set_callback skcipher_request_set_callback ++# define cryptodev_blkcipher_request_free skcipher_request_free ++# define cryptodev_blkcipher_request_set_crypt skcipher_request_set_crypt ++# define cryptodev_crypto_blkcipher_encrypt crypto_skcipher_encrypt ++# define cryptodev_crypto_blkcipher_decrypt crypto_skcipher_decrypt ++# define cryptodev_crypto_blkcipher_tfm crypto_skcipher_tfm ++#endif ++ ++#endif +diff --git a/cryptlib.c b/cryptlib.c +index 5d1a5a9..558d4b8 100644 +--- a/cryptlib.c ++++ b/cryptlib.c +@@ -24,7 +24,6 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +-#include + #include + #include + #include +@@ -38,6 +37,7 @@ + #include + #include + #include "cryptodev_int.h" ++#include "cipherapi.h" + + + static void cryptodev_complete(struct crypto_async_request *req, int err) +@@ -129,15 +129,15 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + int ret; + + if (aead == 0) { +- struct ablkcipher_alg *alg; ++ cryptodev_blkcipher_alg_t *alg; + +- out->async.s = crypto_alloc_ablkcipher(alg_name, 0, 0); ++ out->async.s = cryptodev_crypto_alloc_blkcipher(alg_name, 0, 0); + if (unlikely(IS_ERR(out->async.s))) { + ddebug(1, "Failed to load cipher %s", alg_name); + return -EINVAL; + } + +- alg = crypto_ablkcipher_alg(out->async.s); ++ alg = cryptodev_crypto_blkcipher_alg(out->async.s); + if (alg != NULL) { + /* Was correct key length supplied? */ + if (alg->max_keysize > 0 && +@@ -150,11 +150,11 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + } + } + +- out->blocksize = crypto_ablkcipher_blocksize(out->async.s); +- out->ivsize = crypto_ablkcipher_ivsize(out->async.s); +- out->alignmask = crypto_ablkcipher_alignmask(out->async.s); ++ out->blocksize = cryptodev_crypto_blkcipher_blocksize(out->async.s); ++ out->ivsize = cryptodev_crypto_blkcipher_ivsize(out->async.s); ++ out->alignmask = cryptodev_crypto_blkcipher_alignmask(out->async.s); + +- ret = crypto_ablkcipher_setkey(out->async.s, keyp, keylen); ++ ret = cryptodev_crypto_blkcipher_setkey(out->async.s, keyp, keylen); + } else { + out->async.as = crypto_alloc_aead(alg_name, 0, 0); + if (unlikely(IS_ERR(out->async.as))) { +@@ -181,14 +181,14 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + init_completion(&out->async.result.completion); + + if (aead == 0) { +- out->async.request = ablkcipher_request_alloc(out->async.s, GFP_KERNEL); ++ out->async.request = cryptodev_blkcipher_request_alloc(out->async.s, GFP_KERNEL); + if (unlikely(!out->async.request)) { + derr(1, "error allocating async crypto request"); + ret = -ENOMEM; + goto error; + } + +- ablkcipher_request_set_callback(out->async.request, 0, ++ cryptodev_blkcipher_request_set_callback(out->async.request, 0, + cryptodev_complete, &out->async.result); + } else { + out->async.arequest = aead_request_alloc(out->async.as, GFP_KERNEL); +@@ -206,10 +206,8 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + return 0; + error: + if (aead == 0) { +- if (out->async.request) +- ablkcipher_request_free(out->async.request); +- if (out->async.s) +- crypto_free_ablkcipher(out->async.s); ++ cryptodev_blkcipher_request_free(out->async.request); ++ cryptodev_crypto_free_blkcipher(out->async.s); + } else { + if (out->async.arequest) + aead_request_free(out->async.arequest); +@@ -224,10 +222,8 @@ void cryptodev_cipher_deinit(struct cipher_data *cdata) + { + if (cdata->init) { + if (cdata->aead == 0) { +- if (cdata->async.request) +- ablkcipher_request_free(cdata->async.request); +- if (cdata->async.s) +- crypto_free_ablkcipher(cdata->async.s); ++ cryptodev_blkcipher_request_free(cdata->async.request); ++ cryptodev_crypto_free_blkcipher(cdata->async.s); + } else { + if (cdata->async.arequest) + aead_request_free(cdata->async.arequest); +@@ -274,10 +270,10 @@ ssize_t cryptodev_cipher_encrypt(struct cipher_data *cdata, + reinit_completion(&cdata->async.result.completion); + + if (cdata->aead == 0) { +- ablkcipher_request_set_crypt(cdata->async.request, ++ cryptodev_blkcipher_request_set_crypt(cdata->async.request, + (struct scatterlist *)src, dst, + len, cdata->async.iv); +- ret = crypto_ablkcipher_encrypt(cdata->async.request); ++ ret = cryptodev_crypto_blkcipher_encrypt(cdata->async.request); + } else { + aead_request_set_crypt(cdata->async.arequest, + (struct scatterlist *)src, dst, +@@ -296,10 +292,10 @@ ssize_t cryptodev_cipher_decrypt(struct cipher_data *cdata, + + reinit_completion(&cdata->async.result.completion); + if (cdata->aead == 0) { +- ablkcipher_request_set_crypt(cdata->async.request, ++ cryptodev_blkcipher_request_set_crypt(cdata->async.request, + (struct scatterlist *)src, dst, + len, cdata->async.iv); +- ret = crypto_ablkcipher_decrypt(cdata->async.request); ++ ret = cryptodev_crypto_blkcipher_decrypt(cdata->async.request); + } else { + aead_request_set_crypt(cdata->async.arequest, + (struct scatterlist *)src, dst, +diff --git a/cryptlib.h b/cryptlib.h +index d8e8046..8200a1d 100644 +--- a/cryptlib.h ++++ b/cryptlib.h +@@ -11,6 +11,8 @@ struct cryptodev_result { + int err; + }; + ++#include "cipherapi.h" ++ + struct cipher_data { + int init; /* 0 uninitialized */ + int blocksize; +@@ -20,8 +22,8 @@ struct cipher_data { + int alignmask; + struct { + /* block ciphers */ +- struct crypto_ablkcipher *s; +- struct ablkcipher_request *request; ++ cryptodev_crypto_blkcipher_t *s; ++ cryptodev_blkcipher_request_t *request; + + /* AEAD ciphers */ + struct crypto_aead *as; +diff --git a/ioctl.c b/ioctl.c +index 2e2bdeb..e3b8af1 100644 +--- a/ioctl.c ++++ b/ioctl.c +@@ -35,7 +35,6 @@ + */ + + #include +-#include + #include + #include + #include +@@ -54,6 +53,7 @@ + #include "cryptodev_int.h" + #include "zc.h" + #include "version.h" ++#include "cipherapi.h" + + MODULE_AUTHOR("Nikos Mavrogiannopoulos "); + MODULE_DESCRIPTION("CryptoDev driver"); +@@ -1052,7 +1052,7 @@ static int get_session_info(struct fcrypt *fcr, struct session_info_op *siop) + + if (ses_ptr->cdata.init) { + if (ses_ptr->cdata.aead == 0) +- tfm = crypto_ablkcipher_tfm(ses_ptr->cdata.async.s); ++ tfm = cryptodev_crypto_blkcipher_tfm(ses_ptr->cdata.async.s); + else + tfm = crypto_aead_tfm(ses_ptr->cdata.async.as); + tfm_info_to_alg_info(&siop->cipher_info, tfm); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0093-Fix-ablkcipher-algorithms-usage-in-v4.8-kernels.patch b/recipes-kernel/cryptodev/sdk_patches/0093-Fix-ablkcipher-algorithms-usage-in-v4.8-kernels.patch new file mode 100644 index 0000000..fcf2a3e --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0093-Fix-ablkcipher-algorithms-usage-in-v4.8-kernels.patch @@ -0,0 +1,147 @@ +From 871ecc5c5ebfbb9c6e1b17a7ff7a531ed1fab644 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Horia=20Geant=C4=83?= +Date: Wed, 16 Nov 2016 15:38:39 +0200 +Subject: [PATCH 093/104] Fix ablkcipher algorithms usage in v4.8+ kernels +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +ablkcipher API is not completely removed from kernels <= v4.9. +Thus it's still valid to use ablkcipher algorithms. + +Fix the case when implementers register ablkcipher algorithms +and cryptodev casts them to skcipher without checking their type. + +Note: alg returned by crypto_ablkcipher_alg() is no longer checked +to be non-NULL. This is guaranteed by the fact that ablkcipher_tfm +(out->async.s) is valid. + +Fixes: cb186f682679 ("Support skcipher in addition to ablkcipher API") +Signed-off-by: Horia Geantă +--- + cipherapi.h | 4 ---- + cryptlib.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------------ + 2 files changed, 44 insertions(+), 16 deletions(-) + +diff --git a/cipherapi.h b/cipherapi.h +index 07d9923..b6ed6c2 100644 +--- a/cipherapi.h ++++ b/cipherapi.h +@@ -6,12 +6,10 @@ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)) + # include + +-typedef struct ablkcipher_alg cryptodev_blkcipher_alg_t; + typedef struct crypto_ablkcipher cryptodev_crypto_blkcipher_t; + typedef struct ablkcipher_request cryptodev_blkcipher_request_t; + + # define cryptodev_crypto_alloc_blkcipher crypto_alloc_ablkcipher +-# define cryptodev_crypto_blkcipher_alg crypto_ablkcipher_alg + # define cryptodev_crypto_blkcipher_blocksize crypto_ablkcipher_blocksize + # define cryptodev_crypto_blkcipher_ivsize crypto_ablkcipher_ivsize + # define cryptodev_crypto_blkcipher_alignmask crypto_ablkcipher_alignmask +@@ -37,12 +35,10 @@ static inline void cryptodev_blkcipher_request_free(cryptodev_blkcipher_request_ + #else + #include + +-typedef struct skcipher_alg cryptodev_blkcipher_alg_t; + typedef struct crypto_skcipher cryptodev_crypto_blkcipher_t; + typedef struct skcipher_request cryptodev_blkcipher_request_t; + + # define cryptodev_crypto_alloc_blkcipher crypto_alloc_skcipher +-# define cryptodev_crypto_blkcipher_alg crypto_skcipher_alg + # define cryptodev_crypto_blkcipher_blocksize crypto_skcipher_blocksize + # define cryptodev_crypto_blkcipher_ivsize crypto_skcipher_ivsize + # define cryptodev_crypto_blkcipher_alignmask crypto_skcipher_alignmask +diff --git a/cryptlib.c b/cryptlib.c +index 558d4b8..dcac3ec 100644 +--- a/cryptlib.c ++++ b/cryptlib.c +@@ -39,6 +39,7 @@ + #include "cryptodev_int.h" + #include "cipherapi.h" + ++extern const struct crypto_type crypto_givcipher_type; + + static void cryptodev_complete(struct crypto_async_request *req, int err) + { +@@ -122,6 +123,19 @@ error: + return ret; + } + ++/* Was correct key length supplied? */ ++static int check_key_size(size_t keylen, const char *alg_name, ++ unsigned int min_keysize, unsigned int max_keysize) ++{ ++ if (max_keysize > 0 && unlikely((keylen < min_keysize) || ++ (keylen > max_keysize))) { ++ ddebug(1, "Wrong keylen '%zu' for algorithm '%s'. Use %u to %u.", ++ keylen, alg_name, min_keysize, max_keysize); ++ return -EINVAL; ++ } ++ ++ return 0; ++} + + int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + uint8_t *keyp, size_t keylen, int stream, int aead) +@@ -129,7 +143,12 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + int ret; + + if (aead == 0) { +- cryptodev_blkcipher_alg_t *alg; ++ unsigned int min_keysize, max_keysize; ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) ++ struct crypto_tfm *tfm; ++#else ++ struct ablkcipher_alg *alg; ++#endif + + out->async.s = cryptodev_crypto_alloc_blkcipher(alg_name, 0, 0); + if (unlikely(IS_ERR(out->async.s))) { +@@ -137,18 +156,31 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name, + return -EINVAL; + } + +- alg = cryptodev_crypto_blkcipher_alg(out->async.s); +- if (alg != NULL) { +- /* Was correct key length supplied? */ +- if (alg->max_keysize > 0 && +- unlikely((keylen < alg->min_keysize) || +- (keylen > alg->max_keysize))) { +- ddebug(1, "Wrong keylen '%zu' for algorithm '%s'. Use %u to %u.", +- keylen, alg_name, alg->min_keysize, alg->max_keysize); +- ret = -EINVAL; +- goto error; +- } ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)) ++ tfm = crypto_skcipher_tfm(out->async.s); ++ if ((tfm->__crt_alg->cra_type == &crypto_ablkcipher_type) || ++ (tfm->__crt_alg->cra_type == &crypto_givcipher_type)) { ++ struct ablkcipher_alg *alg; ++ ++ alg = &tfm->__crt_alg->cra_ablkcipher; ++ min_keysize = alg->min_keysize; ++ max_keysize = alg->max_keysize; ++ } else { ++ struct skcipher_alg *alg; ++ ++ alg = crypto_skcipher_alg(out->async.s); ++ min_keysize = alg->min_keysize; ++ max_keysize = alg->max_keysize; + } ++#else ++ alg = crypto_ablkcipher_alg(out->async.s); ++ min_keysize = alg->min_keysize; ++ max_keysize = alg->max_keysize; ++#endif ++ ret = check_key_size(keylen, alg_name, min_keysize, ++ max_keysize); ++ if (ret) ++ goto error; + + out->blocksize = cryptodev_crypto_blkcipher_blocksize(out->async.s); + out->ivsize = cryptodev_crypto_blkcipher_ivsize(out->async.s); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0094-Adjust-to-another-change-in-the-user-page-API.patch b/recipes-kernel/cryptodev/sdk_patches/0094-Adjust-to-another-change-in-the-user-page-API.patch new file mode 100644 index 0000000..9483d0c --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0094-Adjust-to-another-change-in-the-user-page-API.patch @@ -0,0 +1,36 @@ +From b7783948df06674da12352ff4f55c6e7c4213026 Mon Sep 17 00:00:00 2001 +From: Michael Weiser +Date: Fri, 11 Nov 2016 18:09:32 +0100 +Subject: [PATCH 094/104] Adjust to another change in the user page API + +4.9.0 will replace the write and force flags of get_user_pages_remote() +with a gup_flags parameter[1]. Distinguish the two APIs based on kernel +version we're compiling for. + +[1] https://github.com/torvalds/linux/commit/9beae1ea89305a9667ceaab6d0bf46a045ad71e7 +--- + zc.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/zc.c b/zc.c +index a97b49f..e766ee3 100644 +--- a/zc.c ++++ b/zc.c +@@ -65,7 +65,13 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + ret = get_user_pages( + #endif + task, mm, +- (unsigned long)addr, pgcount, write, 0, pg, NULL); ++ (unsigned long)addr, pgcount, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) ++ write ? FOLL_WRITE : 0, ++#else ++ write, 0, ++#endif ++ pg, NULL); + up_read(&mm->mmap_sem); + if (ret != pgcount) + return -EINVAL; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch b/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch new file mode 100644 index 0000000..d2784b1 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0095-rename-header-file-to-clarify-purpose.patch @@ -0,0 +1,173 @@ +From 1fff269afd1925f4e4c7e37cc8c52187c407bc56 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 29 Nov 2016 13:37:21 +0200 +Subject: [PATCH 095/104] rename header file to clarify purpose + +testhelper.h suggests a common repository of utility functions but +current content targets only async tests. If we include it in non-async +tests we are forced to include as well. + +Rename this header file to clarify that it targets only async tests + +Signed-off-by: Cristian Stoica +--- + tests/async_cipher.c | 2 +- + tests/async_hmac.c | 2 +- + tests/asynchelper.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ + tests/testhelper.h | 57 ---------------------------------------------------- + 4 files changed, 56 insertions(+), 59 deletions(-) + create mode 100644 tests/asynchelper.h + delete mode 100644 tests/testhelper.h + +diff --git a/tests/async_cipher.c b/tests/async_cipher.c +index dd08403..db6fb06 100644 +--- a/tests/async_cipher.c ++++ b/tests/async_cipher.c +@@ -13,7 +13,7 @@ + #include + #include + +-#include "testhelper.h" ++#include "asynchelper.h" + + #ifdef ENABLE_ASYNC + +diff --git a/tests/async_hmac.c b/tests/async_hmac.c +index 85d19c6..1bdaad3 100644 +--- a/tests/async_hmac.c ++++ b/tests/async_hmac.c +@@ -14,7 +14,7 @@ + #include + #include + +-#include "testhelper.h" ++#include "asynchelper.h" + + #ifdef ENABLE_ASYNC + +diff --git a/tests/asynchelper.h b/tests/asynchelper.h +new file mode 100644 +index 0000000..b5ab16c +--- /dev/null ++++ b/tests/asynchelper.h +@@ -0,0 +1,54 @@ ++#ifndef __ASYNCHELPER_H ++#define __ASYNCHELPER_H ++ ++/* poll until POLLOUT, then call CIOCASYNCCRYPT */ ++inline int do_async_crypt(int cfd, struct crypt_op *cryp) ++{ ++ struct pollfd pfd; ++ ++ pfd.fd = cfd; ++ pfd.events = POLLOUT; ++ ++ if (poll(&pfd, 1, -1) < 1) { ++ perror("poll()"); ++ return 1; ++ } ++ ++ if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) { ++ perror("ioctl(CIOCCRYPT)"); ++ return 1; ++ } ++ return 0; ++} ++ ++/* poll until POLLIN, then call CIOCASYNCFETCH */ ++inline int do_async_fetch(int cfd, struct crypt_op *cryp) ++{ ++ struct pollfd pfd; ++ ++ pfd.fd = cfd; ++ pfd.events = POLLIN; ++ ++ if (poll(&pfd, 1, -1) < 1) { ++ perror("poll()"); ++ return 1; ++ } ++ ++ if (ioctl(cfd, CIOCASYNCFETCH, cryp)) { ++ perror("ioctl(CIOCCRYPT)"); ++ return 1; ++ } ++ return 0; ++} ++ ++/* Check return value of stmt for identity with goodval. If they ++ * don't match, call return with the value of stmt. */ ++#define DO_OR_DIE(stmt, goodval) { \ ++ int __rc_val; \ ++ if ((__rc_val = stmt) != goodval) { \ ++ perror("DO_OR_DIE(" #stmt "," #goodval ")"); \ ++ return __rc_val; \ ++ } \ ++} ++ ++#endif /* __ASYNCHELPER_H */ +diff --git a/tests/testhelper.h b/tests/testhelper.h +deleted file mode 100644 +index ea0b100..0000000 +--- a/tests/testhelper.h ++++ /dev/null +@@ -1,57 +0,0 @@ +-/* +- * Some helper stuff shared between the sample programs. +- */ +-#ifndef _TESTHELPER_H +-#define _TESTHELPER_H +- +-/* poll until POLLOUT, then call CIOCASYNCCRYPT */ +-inline int do_async_crypt(int cfd, struct crypt_op *cryp) +-{ +- struct pollfd pfd; +- +- pfd.fd = cfd; +- pfd.events = POLLOUT; +- +- if (poll(&pfd, 1, -1) < 1) { +- perror("poll()"); +- return 1; +- } +- +- if (ioctl(cfd, CIOCASYNCCRYPT, cryp)) { +- perror("ioctl(CIOCCRYPT)"); +- return 1; +- } +- return 0; +-} +- +-/* poll until POLLIN, then call CIOCASYNCFETCH */ +-inline int do_async_fetch(int cfd, struct crypt_op *cryp) +-{ +- struct pollfd pfd; +- +- pfd.fd = cfd; +- pfd.events = POLLIN; +- +- if (poll(&pfd, 1, -1) < 1) { +- perror("poll()"); +- return 1; +- } +- +- if (ioctl(cfd, CIOCASYNCFETCH, cryp)) { +- perror("ioctl(CIOCCRYPT)"); +- return 1; +- } +- return 0; +-} +- +-/* Check return value of stmt for identity with goodval. If they +- * don't match, call return with the value of stmt. */ +-#define DO_OR_DIE(stmt, goodval) { \ +- int __rc_val; \ +- if ((__rc_val = stmt) != goodval) { \ +- perror("DO_OR_DIE(" #stmt "," #goodval ")"); \ +- return __rc_val; \ +- } \ +-} +- +-#endif /* _TESTHELPER_H */ +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch b/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch new file mode 100644 index 0000000..83d0be1 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0096-use-buf_align-macro-to-reduce-code-duplication.patch @@ -0,0 +1,248 @@ +From 6f4589ae57d141ea6257ae16df1709781d0fb8e4 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 29 Nov 2016 13:37:22 +0200 +Subject: [PATCH 096/104] use buf_align macro to reduce code duplication + +Signed-off-by: Cristian Stoica +--- + tests/async_cipher.c | 9 +++++---- + tests/cipher-aead-srtp.c | 13 +++++++------ + tests/cipher-aead.c | 13 +++++++------ + tests/cipher-gcm.c | 17 +++++------------ + tests/cipher.c | 9 +++++---- + tests/testhelper.h | 9 +++++++++ + 6 files changed, 38 insertions(+), 32 deletions(-) + create mode 100644 tests/testhelper.h + +diff --git a/tests/async_cipher.c b/tests/async_cipher.c +index db6fb06..7a184e5 100644 +--- a/tests/async_cipher.c ++++ b/tests/async_cipher.c +@@ -14,6 +14,7 @@ + #include + + #include "asynchelper.h" ++#include "testhelper.h" + + #ifdef ENABLE_ASYNC + +@@ -62,8 +63,8 @@ test_crypto(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + #else + plaintext = plaintext_raw; + ciphertext = ciphertext_raw; +@@ -162,7 +163,7 @@ static int test_aes(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop1.alignmask) & ~siop1.alignmask); ++ plaintext1 = buf_align(plaintext1_raw, siop1.alignmask); + #else + plaintext1 = plaintext1_raw; + #endif +@@ -185,7 +186,7 @@ static int test_aes(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop2.alignmask) & ~siop2.alignmask); ++ plaintext2 = buf_align(plaintext2_raw, siop2.alignmask); + #else + plaintext2 = plaintext2_raw; + #endif +diff --git a/tests/cipher-aead-srtp.c b/tests/cipher-aead-srtp.c +index c44877d..578d2f7 100644 +--- a/tests/cipher-aead-srtp.c ++++ b/tests/cipher-aead-srtp.c +@@ -12,6 +12,7 @@ + + #include + #include ++#include "testhelper.h" + + #define DATA_SIZE (8*1024) + #define HEADER_SIZE 193 +@@ -122,8 +123,8 @@ test_crypto(int cfd) + printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, HEADER_SIZE); /* header */ + memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */ +@@ -265,8 +266,8 @@ test_encrypt_decrypt(int cfd) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, HEADER_SIZE); /* header */ + memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */ +@@ -407,8 +408,8 @@ test_encrypt_decrypt_error(int cfd, int err) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, HEADER_SIZE); /* header */ + memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */ +diff --git a/tests/cipher-aead.c b/tests/cipher-aead.c +index da43aa6..b329d12 100644 +--- a/tests/cipher-aead.c ++++ b/tests/cipher-aead.c +@@ -12,6 +12,7 @@ + + #include + #include ++#include "testhelper.h" + + #define DATA_SIZE (8*1024) + #define AUTH_SIZE 31 +@@ -133,8 +134,8 @@ test_crypto(int cfd) + printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + memset(plaintext, 0x15, DATA_SIZE); + + if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) { +@@ -285,8 +286,8 @@ test_encrypt_decrypt(int cfd) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); + +@@ -434,8 +435,8 @@ test_encrypt_decrypt_error(int cfd, int err) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + memset(plaintext, 0x15, DATA_SIZE); + + if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) { +diff --git a/tests/cipher-gcm.c b/tests/cipher-gcm.c +index 3f6cc7b..d5f8486 100644 +--- a/tests/cipher-gcm.c ++++ b/tests/cipher-gcm.c +@@ -12,6 +12,7 @@ + + #include + #include ++#include "testhelper.h" + + #define DATA_SIZE (8*1024) + #define AUTH_SIZE 31 +@@ -232,12 +233,8 @@ static int test_encrypt_decrypt(int cfd) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = +- (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) & +- ~siop.alignmask); +- ciphertext = +- (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) & +- ~siop.alignmask); ++ plaintext = (__u8 *)buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = (__u8 *)buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); + +@@ -385,12 +382,8 @@ static int test_encrypt_decrypt_error(int cfd, int err) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = +- (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) & +- ~siop.alignmask); +- ciphertext = +- (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) & +- ~siop.alignmask); ++ plaintext = (__u8 *)buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = (__u8 *)buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); + memcpy(ciphertext, plaintext, DATA_SIZE); +diff --git a/tests/cipher.c b/tests/cipher.c +index f3ca2f0..222f095 100644 +--- a/tests/cipher.c ++++ b/tests/cipher.c +@@ -12,6 +12,7 @@ + + #include + #include ++#include "testhelper.h" + + static int debug = 0; + +@@ -58,8 +59,8 @@ test_crypto(int cfd) + printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask); +- ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext = buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = buf_align(ciphertext_raw, siop.alignmask); + #else + plaintext = plaintext_raw; + ciphertext = ciphertext_raw; +@@ -177,7 +178,7 @@ static int test_aes(int cfd) + perror("ioctl(CIOCGSESSINFO)"); + return 1; + } +- plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext1 = buf_align(plaintext1_raw, siop.alignmask); + #else + plaintext1 = plaintext1_raw; + #endif +@@ -227,7 +228,7 @@ static int test_aes(int cfd) + printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n", + siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop.alignmask) & ~siop.alignmask); ++ plaintext2 = buf_align(plaintext2_raw, siop.alignmask); + #else + plaintext2 = plaintext2_raw; + #endif +diff --git a/tests/testhelper.h b/tests/testhelper.h +new file mode 100644 +index 0000000..800d10d +--- /dev/null ++++ b/tests/testhelper.h +@@ -0,0 +1,9 @@ ++/* ++ * Some helper stuff shared between the sample programs. ++ */ ++#ifndef __TESTHELPER_H ++#define __TESTHELPER_H ++ ++#define buf_align(buf, align) (void *)(((unsigned long)(buf) + (align)) & ~(align)) ++ ++#endif /* __TESTHELPER_H */ +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0097-avoid-implicit-conversion-between-signed-and-unsigne.patch b/recipes-kernel/cryptodev/sdk_patches/0097-avoid-implicit-conversion-between-signed-and-unsigne.patch new file mode 100644 index 0000000..afd9751 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0097-avoid-implicit-conversion-between-signed-and-unsigne.patch @@ -0,0 +1,304 @@ +From 4843f76a74558b85944dbf923cf699bfd5b354eb Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 29 Nov 2016 13:37:23 +0200 +Subject: [PATCH 097/104] avoid implicit conversion between signed and unsigned + char + +Use uint8_t type for all variables with this problem and avoid casting +from char in assignments. With uint8_t we also convey the information +that we're using small numbers rather than strings. + +Although cryptodev.h uses the synonym type __u8, we use uint8_t +for consistency with other files in tests directory and also because it +is a standard POSIX type. + +Signed-off-by: Cristian Stoica +--- + tests/async_hmac.c | 12 ++++++------ + tests/cipher-aead.c | 10 +++++----- + tests/cipher-gcm.c | 40 ++++++++++++++++++++-------------------- + tests/cipher.c | 1 - + tests/fullspeed.c | 1 + + tests/hmac.c | 12 ++++++------ + 6 files changed, 38 insertions(+), 38 deletions(-) + +diff --git a/tests/async_hmac.c b/tests/async_hmac.c +index 1bdaad3..014b8ed 100644 +--- a/tests/async_hmac.c ++++ b/tests/async_hmac.c +@@ -61,7 +61,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = (uint8_t*)"what do ya want for nothing?"; ++ cryp.src = (uint8_t *)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + +@@ -88,7 +88,7 @@ test_crypto(int cfd) + memset(mac, 0, sizeof(mac)); + + sess.cipher = 0; +- sess.mackey = (uint8_t*)"Jefe"; ++ sess.mackey = (uint8_t *)"Jefe"; + sess.mackeylen = 4; + sess.mac = CRYPTO_MD5_HMAC; + if (ioctl(cfd, CIOCGSESSION, &sess)) { +@@ -98,7 +98,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = (uint8_t*)"what do ya want for nothing?"; ++ cryp.src = (uint8_t *)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + +@@ -127,7 +127,7 @@ test_crypto(int cfd) + sess.keylen = KEY_SIZE; + sess.key = data.key; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); + return 1; +@@ -206,7 +206,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do")-1; +- cryp.src = (uint8_t*)"what do"; ++ cryp.src = (uint8_t *)"what do"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_UPDATE; +@@ -216,7 +216,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof(" ya want for nothing?")-1; +- cryp.src = (uint8_t*)" ya want for nothing?"; ++ cryp.src = (uint8_t *)" ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_FINAL; +diff --git a/tests/cipher-aead.c b/tests/cipher-aead.c +index b329d12..305b720 100644 +--- a/tests/cipher-aead.c ++++ b/tests/cipher-aead.c +@@ -118,7 +118,7 @@ test_crypto(int cfd) + + sess.mac = CRYPTO_SHA1_HMAC; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +@@ -271,7 +271,7 @@ test_encrypt_decrypt(int cfd) + + sess.mac = CRYPTO_SHA1_HMAC; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +@@ -329,7 +329,7 @@ test_encrypt_decrypt(int cfd) + sess.key = key; + sess.mac = CRYPTO_SHA1_HMAC; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +@@ -420,7 +420,7 @@ test_encrypt_decrypt_error(int cfd, int err) + + sess.mac = CRYPTO_SHA1_HMAC; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +@@ -477,7 +477,7 @@ test_encrypt_decrypt_error(int cfd, int err) + sess.key = key; + sess.mac = CRYPTO_SHA1_HMAC; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); +diff --git a/tests/cipher-gcm.c b/tests/cipher-gcm.c +index d5f8486..36c827a 100644 +--- a/tests/cipher-gcm.c ++++ b/tests/cipher-gcm.c +@@ -46,45 +46,45 @@ struct aes_gcm_vectors_st { + + struct aes_gcm_vectors_st aes_gcm_vectors[] = { + { +- .key = (uint8_t*) ++ .key = (uint8_t *) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .auth = NULL, + .auth_size = 0, +- .plaintext = (uint8_t*) ++ .plaintext = (uint8_t *) + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", + .plaintext_size = 16, +- .ciphertext = (uint8_t*) ++ .ciphertext = (uint8_t *) + "\x03\x88\xda\xce\x60\xb6\xa3\x92\xf3\x28\xc2\xb9\x71\xb2\xfe\x78", +- .iv = (uint8_t*)"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", +- .tag = (uint8_t*) ++ .iv = (uint8_t *)"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", ++ .tag = (uint8_t *) + "\xab\x6e\x47\xd4\x2c\xec\x13\xbd\xf5\x3a\x67\xb2\x12\x57\xbd\xdf" + }, + { +- .key = (uint8_t*) ++ .key = (uint8_t *) + "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08", + .auth = NULL, + .auth_size = 0, +- .plaintext = (uint8_t*) ++ .plaintext = (uint8_t *) + "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39\x1a\xaf\xd2\x55", + .plaintext_size = 64, +- .ciphertext = (uint8_t*) ++ .ciphertext = (uint8_t *) + "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91\x47\x3f\x59\x85", +- .iv = (uint8_t*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", +- .tag = (uint8_t*)"\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4" ++ .iv = (uint8_t *)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", ++ .tag = (uint8_t *)"\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4" + }, + { +- .key = (uint8_t*) ++ .key = (uint8_t *) + "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08", +- .auth = (uint8_t*) ++ .auth = (uint8_t *) + "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef\xab\xad\xda\xd2", + .auth_size = 20, +- .plaintext = (uint8_t*) ++ .plaintext = (uint8_t *) + "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39", + .plaintext_size = 60, +- .ciphertext = (uint8_t*) ++ .ciphertext = (uint8_t *) + "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91", +- .iv = (uint8_t*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", +- .tag = (uint8_t*) ++ .iv = (uint8_t *)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", ++ .tag = (uint8_t *) + "\x5b\xc9\x4f\xbc\x32\x21\xa5\xdb\x94\xfa\xe9\x5a\xe7\x12\x1a\x47" + } + }; +@@ -233,8 +233,8 @@ static int test_encrypt_decrypt(int cfd) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (__u8 *)buf_align(plaintext_raw, siop.alignmask); +- ciphertext = (__u8 *)buf_align(ciphertext_raw, siop.alignmask); ++ plaintext = (uint8_t *)buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = (uint8_t *)buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); + +@@ -382,8 +382,8 @@ static int test_encrypt_decrypt_error(int cfd, int err) + // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n", + // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name); + +- plaintext = (__u8 *)buf_align(plaintext_raw, siop.alignmask); +- ciphertext = (__u8 *)buf_align(ciphertext_raw, siop.alignmask); ++ plaintext = (uint8_t *)buf_align(plaintext_raw, siop.alignmask); ++ ciphertext = (uint8_t *)buf_align(ciphertext_raw, siop.alignmask); + + memset(plaintext, 0x15, DATA_SIZE); + memcpy(ciphertext, plaintext, DATA_SIZE); +diff --git a/tests/cipher.c b/tests/cipher.c +index 222f095..fab3de6 100644 +--- a/tests/cipher.c ++++ b/tests/cipher.c +@@ -9,7 +9,6 @@ + #include + #include + #include +- + #include + #include + #include "testhelper.h" +diff --git a/tests/fullspeed.c b/tests/fullspeed.c +index c025130..ae873e2 100644 +--- a/tests/fullspeed.c ++++ b/tests/fullspeed.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + +diff --git a/tests/hmac.c b/tests/hmac.c +index 3b248f3..8d6492e 100644 +--- a/tests/hmac.c ++++ b/tests/hmac.c +@@ -69,7 +69,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = (uint8_t*)"what do ya want for nothing?"; ++ cryp.src = (uint8_t *)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + if (ioctl(cfd, CIOCCRYPT, &cryp)) { +@@ -92,7 +92,7 @@ test_crypto(int cfd) + memset(mac, 0, sizeof(mac)); + + sess.cipher = 0; +- sess.mackey = (uint8_t*)"Jefe"; ++ sess.mackey = (uint8_t *)"Jefe"; + sess.mackeylen = 4; + sess.mac = CRYPTO_MD5_HMAC; + if (ioctl(cfd, CIOCGSESSION, &sess)) { +@@ -113,7 +113,7 @@ test_crypto(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do ya want for nothing?")-1; +- cryp.src = (uint8_t*)"what do ya want for nothing?"; ++ cryp.src = (uint8_t *)"what do ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + if (ioctl(cfd, CIOCCRYPT, &cryp)) { +@@ -138,7 +138,7 @@ test_crypto(int cfd) + sess.keylen = KEY_SIZE; + sess.key = data.key; + sess.mackeylen = 16; +- sess.mackey = (uint8_t*)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; ++ sess.mackey = (uint8_t *)"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"; + if (ioctl(cfd, CIOCGSESSION, &sess)) { + perror("ioctl(CIOCGSESSION)"); + return 1; +@@ -244,7 +244,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof("what do")-1; +- cryp.src = (uint8_t*)"what do"; ++ cryp.src = (uint8_t *)"what do"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_UPDATE; +@@ -255,7 +255,7 @@ test_extras(int cfd) + + cryp.ses = sess.ses; + cryp.len = sizeof(" ya want for nothing?")-1; +- cryp.src = (uint8_t*)" ya want for nothing?"; ++ cryp.src = (uint8_t *)" ya want for nothing?"; + cryp.mac = mac; + cryp.op = COP_ENCRYPT; + cryp.flags = COP_FLAG_FINAL; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0098-reduce-tests-Makefile-distance-with-upstream.patch b/recipes-kernel/cryptodev/sdk_patches/0098-reduce-tests-Makefile-distance-with-upstream.patch new file mode 100644 index 0000000..42b5cbe --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0098-reduce-tests-Makefile-distance-with-upstream.patch @@ -0,0 +1,25 @@ +From badd002fe5bdcaf7a7d856f174e2abb10b939467 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 29 Nov 2016 13:37:24 +0200 +Subject: [PATCH 098/104] reduce tests/Makefile distance with upstream + +Signed-off-by: Cristian Stoica +--- + tests/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/Makefile b/tests/Makefile +index 88f5040..5a09414 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -1,5 +1,5 @@ +-CRYPTODEV_CFLAGS += -DENABLE_ASYNC -std=gnu90 -Wall -Werror +-CFLAGS += -I.. $(CRYPTODEV_CFLAGS) ++CRYPTODEV_CFLAGS += -DENABLE_ASYNC -std=gnu90 ++CFLAGS += -I.. $(CRYPTODEV_CFLAGS) -Wall -Werror + + comp_progs := cipher_comp hash_comp hmac_comp + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0099-add-support-for-authenc-hmac-sha1-cbc-aes-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0099-add-support-for-authenc-hmac-sha1-cbc-aes-speed-test.patch new file mode 100644 index 0000000..f65979a --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0099-add-support-for-authenc-hmac-sha1-cbc-aes-speed-test.patch @@ -0,0 +1,288 @@ +From d2cb6745bb166818b6bd9e9011990453fedbccef Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Fri, 9 Dec 2016 15:25:20 +0200 +Subject: [PATCH 099/104] add support for authenc(hmac(sha1), cbc(aes)) speed + tests + +Signed-off-by: Alexe Radu +--- + crypto/cryptodev.h | 1 + + ioctl.c | 5 ++ + tests/speed.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++------ + 3 files changed, 146 insertions(+), 15 deletions(-) + +diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h +index 05221a4..05dc57b 100644 +--- a/crypto/cryptodev.h ++++ b/crypto/cryptodev.h +@@ -62,6 +62,7 @@ enum cryptodev_crypto_op_t { + CRYPTO_TLS12_3DES_CBC_HMAC_SHA1, + CRYPTO_TLS12_AES_CBC_HMAC_SHA1, + CRYPTO_TLS12_AES_CBC_HMAC_SHA256, ++ CRYPTO_AUTHENC_HMAC_SHA1_CBC_AES, + CRYPTO_ALGORITHM_ALL, /* Keep updated - see below */ + }; + +diff --git a/ioctl.c b/ioctl.c +index e3b8af1..7288ffc 100644 +--- a/ioctl.c ++++ b/ioctl.c +@@ -222,6 +222,11 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) + stream = 0; + aead = 1; + break; ++ case CRYPTO_AUTHENC_HMAC_SHA1_CBC_AES: ++ alg_name = "authenc(hmac(sha1),cbc(aes))"; ++ stream = 0; ++ aead = 1; ++ break; + case CRYPTO_NULL: + alg_name = "ecb(cipher_null)"; + stream = 1; +diff --git a/tests/speed.c b/tests/speed.c +index fc38a63..61259b9 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -33,12 +33,15 @@ + #include + #include + ++#define AUTH_SIZE 31 ++#define TAG_LEN 20 + + struct test_params { + bool tflag; + bool nflag; + bool mflag; + bool aflag; ++ bool authflag; + int tvalue; + int nvalue; + }; +@@ -59,8 +62,9 @@ int run_aes_256_xts(int fdc, struct test_params tp); + int run_crc32c(int fdc, struct test_params tp); + int run_sha1(int fdc, struct test_params tp); + int run_sha256(int fdc, struct test_params tp); ++int run_authenc(int fdc, struct test_params tp); + +-#define ALG_COUNT 6 ++#define ALG_COUNT 7 + struct { + char *name; + int (*func)(int, struct test_params); +@@ -71,6 +75,7 @@ struct { + {"crc32c", run_crc32c}, + {"sha1", run_sha1}, + {"sha256", run_sha256}, ++ {"authenc", run_authenc}, + }; + + static double udifftimeval(struct timeval start, struct timeval end) +@@ -269,7 +274,7 @@ static int encrypt_sync(int fdc, struct test_params tp, struct session_op *sess) + } + memset(buffer, val++, tp.nvalue); + +- must_finish = 0; ++ must_finish = 1; + alarm(tp.tvalue); + + gettimeofday(&start, NULL); +@@ -305,6 +310,84 @@ static int encrypt_sync(int fdc, struct test_params tp, struct session_op *sess) + return 0; + } + ++static int encrypt_auth(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ struct crypt_auth_op cao; ++ char *buffer, iv[32]; ++ uint8_t auth[AUTH_SIZE]; ++ static int val = 23; ++ struct timeval start, end; ++ uint64_t total = 0; ++ double secs, ddata, dspeed; ++ char metric[16]; ++ int alignmask; ++ int min_alignmask = sizeof(void*) - 1; ++ int alloc_size; ++ ++ memset(iv, 0x23, 32); ++ memset(auth, 0xf1, sizeof(auth)); ++ ++ if (!tp.mflag) { ++ printf("\tBuffer size %d bytes: ", tp.nvalue); ++ fflush(stdout); ++ } ++ ++ alloc_size = tp.nvalue + TAG_LEN; ++ alignmask = get_alignmask(fdc, sess); ++ if (alignmask) { ++ alignmask = ((alignmask < min_alignmask) ? min_alignmask : alignmask); ++ if (posix_memalign((void **)(&buffer), alignmask + 1, alloc_size)) { ++ printf("posix_memalign() failed!\n"); ++ return 1; ++ } ++ } else { ++ if (!(buffer = malloc(alloc_size))) { ++ perror("malloc()"); ++ return 1; ++ } ++ } ++ memset(buffer, val++, tp.nvalue); ++ ++ must_finish = 0; ++ alarm(tp.tvalue); ++ ++ gettimeofday(&start, NULL); ++ do { ++ memset(&cao, 0, sizeof(cao)); ++ cao.ses = sess->ses; ++ cao.auth_src = auth; ++ cao.auth_len = sizeof(auth); ++ cao.len = tp.nvalue; ++ cao.iv = (unsigned char *)iv; ++ cao.op = COP_ENCRYPT; ++ cao.src = (unsigned char *)buffer; ++ cao.dst = cao.src; ++ cao.tag_len = TAG_LEN; ++ cao.flags = COP_FLAG_AEAD_TLS_TYPE; ++ ++ if (ioctl(fdc, CIOCAUTHCRYPT, &cao)) { ++ perror("ioctl(CIOCAUTHCRYPT)"); ++ return 1; ++ } ++ total += cao.len; ++ } while(!must_finish); ++ gettimeofday(&end, NULL); ++ ++ secs = udifftimeval(start, end)/ 1000000.0; ++ ++ if (tp.mflag) { ++ value2machine(total, secs, &dspeed); ++ printf("%" PRIu64 "\t%.2f\t%.2f\n", total, secs, dspeed); ++ } else { ++ value2human(total, secs, &ddata, &dspeed, metric); ++ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); ++ printf ("%.2f %s/sec\n", dspeed, metric); ++ } ++ ++ free(buffer); ++ return 0; ++} ++ + void usage(char *cmd_name) + { + printf(usage_str, cmd_name); +@@ -326,11 +409,19 @@ int run_test(int id, struct test_params tp) + return -EINVAL; + } + ++ if (strcmp("authenc", ciphers[id].name) == 0) { ++ tp.authflag = true; ++ } ++ + if (!tp.mflag) { +- char *type; +- type = tp.aflag ? "async" : "sync"; ++ if (tp.authflag) { ++ fprintf(stderr, "Testing %s:\n", ciphers[id].name); ++ } else { ++ char *type; ++ type = tp.aflag ? "async" : "sync"; + +- fprintf(stderr, "Testing %s %s:\n", type, ciphers[id].name); ++ fprintf(stderr, "Testing %s %s:\n", type, ciphers[id].name); ++ } + } + err = ciphers[id].func(fdc, tp); + +@@ -340,17 +431,30 @@ int run_test(int id, struct test_params tp) + return err; + } + +-void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) ++static int start_test (int fdc, struct test_params tp, struct session_op *sess) + { +- int i; + int err; + +- if (tp.nflag) { ++ if (tp.authflag) { ++ err = encrypt_auth(fdc, tp, sess); ++ } else { + if (tp.aflag) { +- encrypt_async(fdc, tp, sess); ++ err = encrypt_async(fdc, tp, sess); + } else { +- encrypt_sync(fdc, tp, sess); ++ err = encrypt_sync(fdc, tp, sess); + } ++ } ++ ++ return err; ++} ++ ++void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) ++{ ++ int i; ++ int err; ++ ++ if (tp.nflag) { ++ err = start_test(fdc, tp, sess); + } else { + for (i = 256; i <= (64 * 1024); i *= 2) { + if (must_exit) { +@@ -358,11 +462,7 @@ void do_test_vectors(int fdc, struct test_params tp, struct session_op *sess) + } + + tp.nvalue = i; +- if (tp.aflag) { +- err = encrypt_async(fdc, tp, sess); +- } else { +- err = encrypt_sync(fdc, tp, sess); +- } ++ err = start_test(fdc, tp, sess); + + if (err != 0) { + break; +@@ -474,6 +574,30 @@ int run_sha256(int fdc, struct test_params tp) + return 0; + } + ++int run_authenc(int fdc, struct test_params tp) ++{ ++ struct session_op sess; ++ char *mkeybuf = "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00\x00\x00\x00\x00" ++ "\x00\x00\x00\x00"; ++ char *ckeybuf = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b" ++ "\x51\x2e\x03\xd5\x34\x12\x00\x06"; ++ ++ memset(&sess, 0, sizeof(sess)); ++ sess.cipher = CRYPTO_AUTHENC_HMAC_SHA1_CBC_AES; ++ sess.keylen = 16; ++ sess.key = (unsigned char *)ckeybuf; ++ sess.mackeylen = 20; ++ sess.mackey = (unsigned char *)mkeybuf; ++ if (ioctl(fdc, CIOCGSESSION, &sess)) { ++ perror("ioctl(CIOCGSESSION)"); ++ return -EINVAL; ++ } ++ ++ do_test_vectors(fdc, tp, &sess); ++ return 0; ++} ++ + int main(int argc, char **argv) + { + int err = 0; +@@ -487,6 +611,7 @@ int main(int argc, char **argv) + tp.nflag = false; + tp.mflag = false; + tp.aflag = false; ++ tp.authflag = false; + alg_flag = false; + opterr = 0; + while ((c = getopt(argc, argv, "ahn:t:m")) != -1) { +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0100-close-the-session-after-every-test.patch b/recipes-kernel/cryptodev/sdk_patches/0100-close-the-session-after-every-test.patch new file mode 100644 index 0000000..a108b9d --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0100-close-the-session-after-every-test.patch @@ -0,0 +1,108 @@ +From 3ca93181fbcaa0acac01588738eb50270cf4999a Mon Sep 17 00:00:00 2001 +From: Alexe Radu +Date: Fri, 9 Dec 2016 16:05:56 +0200 +Subject: [PATCH 100/104] close the session after every test + +Signed-off-by: Alexe Radu +--- + tests/speed.c | 42 ++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/tests/speed.c b/tests/speed.c +index 61259b9..99ef75b 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -488,6 +488,12 @@ int run_null(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -507,6 +513,12 @@ int run_aes_128_cbc(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -526,6 +538,12 @@ int run_aes_256_xts(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -541,6 +559,12 @@ int run_crc32c(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -556,6 +580,12 @@ int run_sha1(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -571,6 +601,12 @@ int run_sha256(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +@@ -595,6 +631,12 @@ int run_authenc(int fdc, struct test_params tp) + } + + do_test_vectors(fdc, tp, &sess); ++ ++ if (ioctl(fdc, CIOCFSESSION, &sess)) { ++ perror("ioctl(CIOCFSESSION)"); ++ return -EINVAL; ++ } ++ + return 0; + } + +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0101-add-support-for-rsa-speed-tests.patch b/recipes-kernel/cryptodev/sdk_patches/0101-add-support-for-rsa-speed-tests.patch new file mode 100644 index 0000000..a70f368 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0101-add-support-for-rsa-speed-tests.patch @@ -0,0 +1,179 @@ +From d67b28fb68f1ea56fdf794f516816b6c3ef5649a Mon Sep 17 00:00:00 2001 +From: Radu Alexe +Date: Thu, 12 Jan 2017 19:44:57 +0200 +Subject: [PATCH 101/104] add support for rsa speed tests + +Tests are only for rsa 1024 and 2048 and only sync variant. + +Signed-off-by: Radu Alexe +--- + tests/speed.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 137 insertions(+), 1 deletion(-) + +diff --git a/tests/speed.c b/tests/speed.c +index 99ef75b..b52938c 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -63,8 +63,9 @@ int run_crc32c(int fdc, struct test_params tp); + int run_sha1(int fdc, struct test_params tp); + int run_sha256(int fdc, struct test_params tp); + int run_authenc(int fdc, struct test_params tp); ++int run_rsa(int fdc, struct test_params tp); + +-#define ALG_COUNT 7 ++#define ALG_COUNT 8 + struct { + char *name; + int (*func)(int, struct test_params); +@@ -76,6 +77,7 @@ struct { + {"sha1", run_sha1}, + {"sha256", run_sha256}, + {"authenc", run_authenc}, ++ {"rsa", run_rsa}, + }; + + static double udifftimeval(struct timeval start, struct timeval end) +@@ -640,6 +642,140 @@ int run_authenc(int fdc, struct test_params tp) + return 0; + } + ++char *n_2048 = "\xFA\xBE\x23\x01\x5D\x11\x50\xAA\xAB\xED\x50\xA7\x9B\x93\x7B\xCE" ++ "\x1E\x11\xAE\xC1\x05\xAF\xBA\x57\x18\x6B\xE3\x27\x85\x3A\xFA\xB9" ++ "\x15\x5A\x39\xB2\x38\x60\xB8\x5B\xDF\xD0\x8F\xA3\x37\xEE\xE5\xFD" ++ "\xE2\x98\xF9\x40\xD2\x0A\xE9\x15\x69\x8A\x9D\xBC\x1F\x00\x0B\x95" ++ "\x5A\x19\x14\x4C\x14\x19\x38\x47\x30\x96\x17\xCB\x28\x1C\x1C\x09" ++ "\x14\x79\x55\x26\xAF\x6E\x38\x41\x91\x9D\xF5\x31\x6C\xFB\xCC\x68" ++ "\x08\xA2\x60\xA2\xA4\xE0\x68\x59\x24\xF5\xEB\x57\x88\x5C\x3D\xA3" ++ "\x41\x95\xFF\xD1\x03\xBA\xAE\x18\x55\x5D\xF4\x93\x57\x4D\x02\x11" ++ "\x66\xD8\x44\xF8\x63\x9D\x70\xBE\x98\x93\x43\xE0\x1F\x80\x7A\xE1" ++ "\x6D\xA0\x5D\xC3\xE5\x56\x1C\xDA\x96\x16\xB1\xD8\xBD\x62\x1E\x51" ++ "\x28\xF7\x06\xB7\x6D\xB0\x5A\x5F\x09\x28\xEF\x9B\x33\xA3\x04\x02" ++ "\x08\x4D\xD7\x2C\x22\x77\x3D\x9B\x2E\x45\xE7\x78\x5C\x64\x50\xF3" ++ "\x5B\x98\x6E\x0F\xDE\xA6\xDC\x19\x4D\xFF\xAB\xBE\x6D\xC7\xB1\x55" ++ "\x36\xDD\x40\x07\xEF\x78\xCC\xA1\x8D\x96\x6B\xDA\x48\x4C\x40\x29" ++ "\x46\x7C\xF0\x1A\x6B\xC5\xBB\x8B\xD1\xB0\x6F\x9B\xB7\xC0\x06\xF5" ++ "\x3B\x6F\x2B\x45\xEA\x17\x4C\x16\x2A\xC5\x5E\xB6\x1C\xCB\x3B\xFB"; ++ ++char *f_2048 = "\x69\xeb\xb3\xb3\x68\xc1\xbf\x17\x57\x63\xca\xa2\x21\xee\x1f\x56" ++ "\x8c\xee\x58\x96\x86\x86\x95\x44\xc7\xff\x75\xeb\xb4\xe8\xf6\x55" ++ "\x20\xa0\xad\x62\x50\xe4\x83\x07\x31\xe9\x41\x03\xf3\x69\x9b\x9b" ++ "\x0d\x68\xf3\x6e\x21\x02\x79\xc5\xa4\xd1\xe5\x11\x56\x9a\x2c\xb8" ++ "\xf5\x76\xab\x04\x03\xcc\x6d\xa3\xf1\xa3\x6a\x57\xfd\x6e\x87\x82" ++ "\xcf\x19\xf8\x0f\x97\x4d\x6e\xb5\xa0\x10\x27\x40\x12\x8b\x9f\x24" ++ "\xb4\x4a\x95\xbe\x6a\x49\x49\x67\xb0\x8f\x77\x5f\x1d\x56\x22\xc6" ++ "\x7d\xb3\x2f\x9e\x62\x4a\x0b\xf2\xca\x9e\xd1\x57\xf8\xf4\x25\x36" ++ "\x54\xe9\x4a\xcd\x4d\x9b\x14\xd5\xe5\x35\x59\x6b\xf5\xd0\x50\x69" ++ "\x5c\xde\x21\x32\xc9\x31\x8f\x21\x66\xda\x32\xb8\x45\x18\x18\x57" ++ "\xb0\x37\xff\xea\xee\x7a\xd5\x01\x36\x72\xb3\xfb\x23\xe2\x5c\xa2" ++ "\x10\xb9\xf3\x8b\xda\x37\x46\x7e\xac\xf5\x6c\xae\x18\x69\xbc\x9d" ++ "\x6e\xd7\x61\x7c\x85\x63\x41\x5e\x8b\xab\x12\xbe\x37\x1a\x67\xdd" ++ "\x86\xf2\xf9\xc8\x3a\xd7\xcd\x92\x72\xaf\xad\x46\xb0\x5b\x33\xd9" ++ "\x1c\x32\x02\x3c\xae\xe0\x5d\x87\xde\x95\x59\x10\x4e\xa7\xdf\x7f" ++ "\x94\x2d\xea\x9b\x7a\x53\x54\xc7\xf9\x66\xd1\x14\x0b\xd7\xef\x00"; ++ ++char *n_1024 = "\xF8\x99\x5E\xC7\xED\x60\x4B\xBA\x77\x0A\x52\xD0\xFF\xE6\x45\x47" ++ "\x04\xDE\xB3\x40\x16\x23\xB4\x58\x0A\xFF\xAF\x0D\x26\x1B\x5E\x0D" ++ "\x61\xA2\x4A\x7B\x2E\x70\x2A\x54\x21\xCB\x01\x31\xBC\xBE\xAE\xC9" ++ "\x5B\x3B\x20\x0B\x95\x06\x41\x03\xDB\xEF\x81\xE2\xFB\x42\xE8\x02" ++ "\x1D\xD2\xA7\xFD\xC3\xA0\x3F\x74\x6D\x99\x8D\x60\xBA\x43\x82\x6C" ++ "\x96\x24\x1D\xE5\xE3\x2C\xB7\x66\xAB\x2B\x4C\xFD\x23\xFF\xE0\x09" ++ "\x17\x3E\x01\xCB\xDC\xB2\xD2\xA9\x98\x99\x01\x91\x16\xAB\x77\xD7" ++ "\x97\x52\xBD\x49\xB2\xAF\x61\x95\xE8\xA2\x34\x9C\xC4\x00\xCC\x17"; ++ ++char *f_1024 = "\x8f\x2d\x06\x83\xee\x08\x97\xa4\x86\x3a\xf2\xa3\xd1\x6d\x33\x10" ++ "\x49\x1d\xb6\xd0\xe3\x7b\x16\x5a\x1a\x5c\x98\x36\xab\xd2\xa9\x82" ++ "\x5c\x1b\xc1\x9e\xdc\x50\x45\x05\xe0\x2e\x14\x83\x86\x47\x21\xc5" ++ "\x27\xad\xb1\x74\x5d\x7b\xe2\x92\xfc\x15\xf0\x14\x6c\x8d\x80\xe5" ++ "\x85\x72\x26\xc7\xa3\xd8\xc7\x5a\x10\xcd\x64\xde\x5d\x82\xc1\x53" ++ "\xd7\x2e\x03\xe0\xe2\xe6\xc6\x85\xcc\x07\x25\xa9\x61\xf7\x52\x3f" ++ "\x63\xb1\x54\x6e\x23\xbe\xf0\x6c\xa4\x93\x8c\x39\xe2\xdb\xcb\x1c" ++ "\x4b\x95\x3d\x57\x06\xc9\xce\x44\xe5\xaf\xac\x6b\x67\xdb\x92\x00"; ++ ++int run_rsa(int fdc, struct test_params tp) ++{ ++ struct timeval start, end; ++ double secs, ddata, dspeed; ++ uint64_t total = 0; ++ char metric[16]; ++ struct crypt_kop kop; ++ char *n, *f; ++ char *e = "\x01\x00\x01"; ++ char g[256]; ++ ++ if (!tp.nflag) ++ tp.nvalue = 2048; ++ ++ switch (tp.nvalue) { ++ case 2048: ++ n = n_2048; ++ f = f_2048; ++ break; ++ ++ case 1024: ++ n = n_1024; ++ f = f_1024; ++ break; ++ ++ default: ++ if (!tp.mflag) { ++ printf("Error: rsa-%d not supported\n", tp.nvalue); ++ fflush(stdout); ++ } ++ ++ return 1; ++ } ++ ++ kop.crk_op = CRK_MOD_EXP; ++ kop.crk_iparams = 3; ++ kop.crk_oparams = 1; ++ ++ kop.crk_param[0].crp_p = (__u8*)f; ++ kop.crk_param[0].crp_nbits = tp.nvalue; ++ ++ kop.crk_param[1].crp_p = (__u8*)e; ++ kop.crk_param[1].crp_nbits = 24; ++ ++ kop.crk_param[2].crp_p = (__u8*)n; ++ kop.crk_param[2].crp_nbits = tp.nvalue; ++ ++ kop.crk_param[3].crp_p = (__u8*)g; ++ kop.crk_param[3].crp_nbits = sizeof(g) << 3; ++ ++ if (!tp.mflag) { ++ printf("\trsa %d: ", tp.nvalue); ++ fflush(stdout); ++ } ++ ++ must_finish = 0; ++ alarm(tp.tvalue); ++ ++ gettimeofday(&start, NULL); ++ do { ++ if (ioctl(fdc, CIOCKEY, &kop)) { ++ perror("ioctl(CIOCKEY)"); ++ return -EINVAL; ++ } ++ total += (tp.nvalue >> 3); ++ } while (!must_finish); ++ gettimeofday(&end, NULL); ++ ++ secs = udifftimeval(start, end)/ 1000000.0; ++ ++ if (tp.mflag) { ++ value2machine(total, secs, &dspeed); ++ printf("%" PRIu64 "\t%.2f\t%.2f\n", total, secs, dspeed); ++ } else { ++ value2human(total, secs, &ddata, &dspeed, metric); ++ printf ("done. %.2f %s in %.2f secs: ", ddata, metric, secs); ++ printf ("%.2f %s/sec\n", dspeed, metric); ++ } ++ ++ return 0; ++} ++ + int main(int argc, char **argv) + { + int err = 0; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0102-adjust-to-API-changes-in-kernel-4.10.patch b/recipes-kernel/cryptodev/sdk_patches/0102-adjust-to-API-changes-in-kernel-4.10.patch new file mode 100644 index 0000000..5ffc450 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0102-adjust-to-API-changes-in-kernel-4.10.patch @@ -0,0 +1,57 @@ +From 008516c6a1dd0afe0eadff3ad00c1200c198983f Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Wed, 8 Feb 2017 10:19:34 +0200 +Subject: [PATCH 102/104] adjust to API changes in kernel >=4.10 + +There are many changes related to get_user_pages and the code is rewritten +for clarity. + +Signed-off-by: Cristian Stoica +--- + zc.c | 28 +++++++++++++++++----------- + 1 file changed, 17 insertions(+), 11 deletions(-) + +diff --git a/zc.c b/zc.c +index e766ee3..2f4ea99 100644 +--- a/zc.c ++++ b/zc.c +@@ -59,19 +59,25 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + } + + down_read(&mm->mmap_sem); +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)) +- ret = get_user_pages_remote( ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) ++ ret = get_user_pages(task, mm, ++ (unsigned long)addr, pgcount, write, 0, pg, NULL); + #else +- ret = get_user_pages( +-#endif +- task, mm, +- (unsigned long)addr, pgcount, +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) +- write ? FOLL_WRITE : 0, +-#else +- write, 0, +-#endif ++# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) ++ ret = get_user_pages_remote(task, mm, ++ (unsigned long)addr, pgcount, write, 0, pg, NULL); ++# else ++# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) ++ ret = get_user_pages_remote(task, mm, ++ (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL); ++# else ++ ret = get_user_pages_remote(task, mm, ++ (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, ++ pg, NULL, NULL); ++# endif ++# endif ++#endif + up_read(&mm->mmap_sem); + if (ret != pgcount) + return -EINVAL; +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0103-zc-Use-the-power-of-elif.patch b/recipes-kernel/cryptodev/sdk_patches/0103-zc-Use-the-power-of-elif.patch new file mode 100644 index 0000000..5c12107 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0103-zc-Use-the-power-of-elif.patch @@ -0,0 +1,51 @@ +From e2fa367d968926500584912e98cf7b17bd9487a6 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Thu, 9 Feb 2017 11:40:46 +0100 +Subject: [PATCH 103/104] zc: Use the power of #elif + +While here, get rid of that trailing newline as well. + +Fixes: 2b29be8ac4141 ("adjust to API changes in kernel >=4.10") +Suggested-by: Frediano Ziglio +Signed-off-by: Phil Sutter +--- + zc.c | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/zc.c b/zc.c +index 2f4ea99..ae464ff 100644 +--- a/zc.c ++++ b/zc.c +@@ -62,21 +62,17 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)) + ret = get_user_pages(task, mm, + (unsigned long)addr, pgcount, write, 0, pg, NULL); +-#else +-# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)) + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write, 0, pg, NULL); +-# else +-# if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)) + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL); +-# else ++#else + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL, NULL); +-# endif +-# endif + #endif + up_read(&mm->mmap_sem); + if (ret != pgcount) +@@ -222,4 +218,3 @@ int get_userbuf(struct csession *ses, + } + return 0; + } +- +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0104-fix-reset-finish-condition-before-test-start.patch b/recipes-kernel/cryptodev/sdk_patches/0104-fix-reset-finish-condition-before-test-start.patch new file mode 100644 index 0000000..1038bed --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0104-fix-reset-finish-condition-before-test-start.patch @@ -0,0 +1,29 @@ +From a4b33ea30c86fb727c1d3ac3531c5548b6c194ba Mon Sep 17 00:00:00 2001 +From: Radu Alexe +Date: Tue, 14 Feb 2017 12:52:33 +0200 +Subject: [PATCH 104/104] fix: reset finish condition before test start + +Typo from previous commit: ba494703 +"add support for authenc(hmac(sha1), cbc(aes)) speed tests" + +Signed-off-by: Radu Alexe +--- + tests/speed.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/speed.c b/tests/speed.c +index b52938c..ae0b658 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -276,7 +276,7 @@ static int encrypt_sync(int fdc, struct test_params tp, struct session_op *sess) + } + memset(buffer, val++, tp.nvalue); + +- must_finish = 1; ++ must_finish = 0; + alarm(tp.tvalue); + + gettimeofday(&start, NULL); +-- +2.10.2 + diff --git a/recipes-kernel/cryptodev/sdk_patches/0105-update-copyright-notes.patch b/recipes-kernel/cryptodev/sdk_patches/0105-update-copyright-notes.patch new file mode 100644 index 0000000..f2cd906 --- /dev/null +++ b/recipes-kernel/cryptodev/sdk_patches/0105-update-copyright-notes.patch @@ -0,0 +1,77 @@ +From 6c2b61c17681d0e6ddc44b0438c9712fb2810ba6 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica +Date: Tue, 28 Mar 2017 13:16:14 +0300 +Subject: [PATCH] update copyright notes + +Signed-off-by: Cristian Stoica +--- + tests/run_crypto_tests.sh | 16 ++++++++++++++++ + tests/sha_speed.c | 1 + + tests/speed.c | 1 + + zc.c | 1 + + 4 files changed, 19 insertions(+) + +diff --git a/tests/run_crypto_tests.sh b/tests/run_crypto_tests.sh +index 321b013..225ad7a 100644 +--- a/tests/run_crypto_tests.sh ++++ b/tests/run_crypto_tests.sh +@@ -1,4 +1,20 @@ + #!/bin/bash ++# ++# Copyright 2016 NXP Semiconductors ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ + + + BUF_SIZE="8192 16384 65536 131072 262144" +diff --git a/tests/sha_speed.c b/tests/sha_speed.c +index 30b40f5..e6a2ac5 100644 +--- a/tests/sha_speed.c ++++ b/tests/sha_speed.c +@@ -1,6 +1,7 @@ + /* sha_speed - simple SHA benchmark tool for cryptodev + * + * Copyright (C) 2011 by Phil Sutter ++ * Copyright 2016 NXP + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +diff --git a/tests/speed.c b/tests/speed.c +index ae0b658..6e18960 100644 +--- a/tests/speed.c ++++ b/tests/speed.c +@@ -1,6 +1,7 @@ + /* cryptodev_test - simple benchmark tool for cryptodev + * + * Copyright (C) 2010 by Phil Sutter ++ * Copyright 2016-2017 NXP + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +diff --git a/zc.c b/zc.c +index ae464ff..63e7c23 100644 +--- a/zc.c ++++ b/zc.c +@@ -4,6 +4,7 @@ + * Copyright (c) 2009-2013 Nikos Mavrogiannopoulos + * Copyright (c) 2010 Phil Sutter + * Copyright (c) 2011, 2012 OpenSSL Software Foundation, Inc. ++ * Copyright 2017 NXP + * + * This file is part of linux cryptodev. + * +-- +1.9.2 + diff --git a/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch b/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch index 6d8db4e..35aad60 100644 --- a/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch +++ b/recipes-kernel/cryptodev/yocto_patches/0001-Disable-installing-header-file-provided-by-another-p.patch @@ -8,22 +8,15 @@ Subject: [PATCH 1/2] Disable installing header file provided by another Signed-off-by: Cristian Stoica Upstream-Status: Inappropriate [ OE specific ] ---- - Makefile | 1 - - 1 file changed, 1 deletion(-) -diff --git a/Makefile b/Makefile -index 9871a8e..06202bd 100644 ---- a/Makefile -+++ b/Makefile -@@ -33,7 +33,6 @@ install: modules_install + +--- a/Makefileold 2017-04-18 14:54:40.588438842 +0800 ++++ b/Makefile 2017-04-18 14:55:40.308436774 +0800 +@@ -33,7 +33,6 @@ modules_install: - $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules_install + $(MAKE) $(KERNEL_MAKE_OPTS) modules_install - install -m 644 -D crypto/cryptodev.h $(DESTDIR)/$(includedir)/crypto/cryptodev.h clean: - $(MAKE) -C $(KERNEL_DIR) M=$(PWD) clean --- -2.7.0 - + $(MAKE) $(KERNEL_MAKE_OPTS) clean diff --git a/recipes-kernel/cryptodev/yocto_patches/0003-update-the-install-path-for-cryptodev-tests.patch b/recipes-kernel/cryptodev/yocto_patches/0003-update-the-install-path-for-cryptodev-tests.patch new file mode 100644 index 0000000..4f92dba --- /dev/null +++ b/recipes-kernel/cryptodev/yocto_patches/0003-update-the-install-path-for-cryptodev-tests.patch @@ -0,0 +1,28 @@ +From 5b0d2cf5abaaa3bffb4a9e874dba88bdab15b69d Mon Sep 17 00:00:00 2001 +From: Ting Liu +Date: Mon, 20 Feb 2017 22:43:00 +0800 +Subject: [PATCH] update the install path for cryptodev tests + +Signed-off-by: Ting Liu +--- + tests/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/Makefile b/tests/Makefile +index dd7d5ff..e1c5039 100644 +--- a/tests/Makefile ++++ b/tests/Makefile +@@ -37,8 +37,8 @@ install: + for prog in $(hostprogs); do \ + install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \ + done +- install -m 755 speed_multi.sh $(DESTDIR)/$(bindir) +- install -m 755 run_crypto_tests.sh $(DESTDIR)/$(bindir) ++ install -m 755 speed_multi.sh $(DESTDIR)/$(bindir)/tests_cryptodev/ ++ install -m 755 run_crypto_tests.sh $(DESTDIR)/$(bindir)/tests_cryptodev/ + + clean: + rm -f *.o *~ $(hostprogs) +-- +1.9.2 + -- 1.9.0