1From 8d2164a090f17286ea8291f30a123595cf447dc3 Mon Sep 17 00:00:00 2001
2From: Haiqing Bai <Haiqing.Bai@windriver.com>
3Date: Wed, 30 Nov 2016 10:27:36 +0800
4Subject: [PATCH] crda: fix issues when 'USE_OPENSSL=1'.
5
6Fxed the below issues if configured with 'USE_OPENSSL=1':
7a. keys-ssl.c uses BN_ULONG but doesn't include the openssl headers leading
8   to build failures:
9   keys-ssl.c:2:8: error: unknown type name 'BN_ULONG'
10   static BN_ULONG e_0[1] = {
11
12b. The large unqualified constants also break building:
13   keys-ssl.c:8:2: warning: overflow in implicit constant conversion [-Woverflow]
14     0x63a2705416a0d8e1, 0xdc9fca11c8ba757b,
15
16c. keys-ssl.c: error: 'keys' defined but not used [-Werror=unused-variable]
17   static struct pubkey keys[] = {
18
19Signed-off-by: Mike Frysinger <vapier@gentoo.org>
20Upstream-Status: Pending
21Signed-off-by: Haiqing Bai <Haiqing.Bai@windriver.com>
22---
23 utils/key2pub.py | 5 +++--
24 1 file changed, 3 insertions(+), 2 deletions(-)
25
26diff --git a/utils/key2pub.py b/utils/key2pub.py
27index 401d58a..3ae00b8 100755
28--- a/utils/key2pub.py
29+++ b/utils/key2pub.py
30@@ -24,7 +24,7 @@ def print_ssl_64(output, name, val):
31     for v1, v2, v3, v4, v5, v6, v7, v8 in vnew:
32         if not idx:
33             output.write('\t')
34-        output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x, ' % (ord(v1), ord(v2), ord(v3), ord(v4), ord(v5), ord(v6), ord(v7), ord(v8)))
35+        output.write('0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2xULL, ' % (ord(v1), ord(v2), ord(v3), ord(v4), ord(v5), ord(v6), ord(v7), ord(v8)))
36         idx += 1
37         if idx == 2:
38             idx = 0
39@@ -60,6 +60,7 @@ def print_ssl_32(output, name, val):
40 def print_ssl(output, name, val):
41     import os
42     output.write('#include <stdint.h>\n')
43+    output.write('#include <openssl/bn.h>\n')
44     if os.getenv('TARGET_BITS') == '64':
45         return print_ssl_64(output, name, val)
46     else:
47@@ -78,7 +79,7 @@ struct pubkey {
48
49 #define KEYS(e,n)	{ KEY(e), KEY(n), }
50
51-static struct pubkey keys[] = {
52+static struct pubkey keys[] __attribute__((unused))= {
53 ''')
54     for n in xrange(n + 1):
55         output.write('	KEYS(e_%d, n_%d),\n' % (n, n))
56--
571.9.1
58
59