From patchwork Wed May 17 06:14:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 763348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wSPF01MsZz9s82 for ; Wed, 17 May 2017 16:15:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="DnYnfuXv"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wSPF00JVtzDqZQ for ; Wed, 17 May 2017 16:15:16 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="DnYnfuXv"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wSPDp0LxpzDqY7 for ; Wed, 17 May 2017 16:15:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="DnYnfuXv"; dkim-atps=neutral Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 89BC0208E2; Wed, 17 May 2017 02:15:01 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Wed, 17 May 2017 02:15:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=Tv+H5DJrtb3N73b9Vc msEr+h2QfyJMw3MzUz4JtxwM8=; b=DnYnfuXv0JrBcrEA+4NM7TWuoLyg7Vvlld NToW/fMuIeqsaDXlrOmG4yZ/6G+/3sYZQRV4sIq18kuK6muNic9I0GxmJlH4jreU KdegVOGXDaD6nrb3BG4OYL6xQ6fNMLUaVjC/BCvB9J/07Gcwc5vfnI2oB2wdcod2 mIZyP8amSis11vPyn0i48YFrcMeapf0IiSX61QKts33S+RXhf5plTYw4wjsCUM+Q cG/hcrHqT0k1slADZb4pJj5MVvRPaxNeqGljrKyVt5drJg/sF6Akw1VDUZmRtAlq tDW/mmgSd54m1gmIlcI392CzoY/aPwo/0WOr9JkO4fPkXGwEfR3Q== X-ME-Sender: X-Sasl-enc: DibtsBc44zLc2GxRvLMDmpqr9xJ3FvPLiJL1N02SEFYt 1495001700 Received: from snap.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 5D4F32475D; Wed, 17 May 2017 02:15:00 -0400 (EDT) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Wed, 17 May 2017 16:14:55 +1000 Message-Id: <20170517061455.4513-1-ruscur@russell.cc> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] libstb: Fix build in OpenSSL 1.1 X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" OpenSSL has some API changes which causes a build break in libstb. Specifically, directly accessing some members of a signature now requires using a helper. This fixes things in OpenSSL 1.1 and has no effect on OpenSSL 1.0. The build failure was as follows: [ HOSTCC ] libstb/create-container.c In file included from /usr/include/openssl/asn1.h:24:0, from /usr/include/openssl/ec.h:30, from libstb/create-container.c:36: libstb/create-container.c: In function ‘getSigRaw’: libstb/create-container.c:104:31: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’ rlen = BN_num_bytes(signature->r); ^ Signed-off-by: Russell Currey --- libstb/create-container.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libstb/create-container.c b/libstb/create-container.c index 437a425c..5cf80a06 100644 --- a/libstb/create-container.c +++ b/libstb/create-container.c @@ -88,6 +88,7 @@ void getSigRaw(ecc_signature_t *sigraw, char *inFile) void *infile; unsigned char outbuf[2*EC_COORDBYTES]; int r, rlen, roff, slen, soff; + const BIGNUM *sr, *ss; fdin = open(inFile, O_RDONLY); assert(fdin > 0); @@ -101,13 +102,19 @@ void getSigRaw(ecc_signature_t *sigraw, char *inFile) memset(&outbuf, 0, sizeof(outbuf)); - rlen = BN_num_bytes(signature->r); +#if OPENSSL_VERSION_NUMBER >= 0x10100000L + ECDSA_SIG_get0(signature, &sr, &ss); +#else + sr = signature->r; + ss = signature->s; +#endif + rlen = BN_num_bytes(sr); roff = 66 - rlen; - BN_bn2bin(signature->r, &outbuf[roff]); + BN_bn2bin(sr, &outbuf[roff]); - slen = BN_num_bytes(signature->s); + slen = BN_num_bytes(ss); soff = 66 + (66 - slen); - BN_bn2bin(signature->s, &outbuf[soff]); + BN_bn2bin(sr, &outbuf[soff]); if (debug) printBytes((char *)"sig (RAW) = ", outbuf, sizeof(outbuf), 32);