[Skiboot] [PATCH] libstb: Fix build in OpenSSL 1.1
Russell Currey
ruscur at russell.cc
Wed May 17 16:14:55 AEST 2017
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 <ruscur at russell.cc>
---
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);
--
2.13.0
More information about the Skiboot
mailing list