summaryrefslogtreecommitdiff
path: root/host/lib/util_misc.c
diff options
context:
space:
mode:
authorDaniel Kurtz <djkurtz@chromium.org>2017-06-30 11:45:08 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-07-07 00:57:17 -0700
commitbce7904376beee2912932433a4634c1c25afe2f5 (patch)
treebba8df33dab5fb6d3c64b13ac3a290e8da03c780 /host/lib/util_misc.c
parent06beb42e11733670eb1894f12586443a37a5af7c (diff)
downloadvboot-bce7904376beee2912932433a4634c1c25afe2f5.tar.gz
Update for openssl 1.1
OpenSSL 1.1 has made significant non-backwards compatible changes to its API as outlined in: https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes BRANCH=none BUG=chromium:738114 TEST=cros_workon --host start vboot_reference TEST=w/ openssl-1.0.2k: sudo emerge vboot_reference TEST=w/ openssl-1.1.0e: sudo emerge vboot_reference => both build ok $ futility version => command runs without error TEST=cros_workon --board=soraka start vboot_reference coreboot TEST=w/ openssl-1.0.2k: emerge-soraka vboot_reference coreboot TEST=w/ openssl-1.1.0e: emerge-soraka vboot_reference coreboot => All build ok Change-Id: I37cfc8cbb04a092eab7b0b3224f475b82609447c Reviewed-on: https://chromium-review.googlesource.com/557739 Commit-Ready: Daniel Kurtz <djkurtz@chromium.org> Tested-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'host/lib/util_misc.c')
-rw-r--r--host/lib/util_misc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/host/lib/util_misc.c b/host/lib/util_misc.c
index 95acecb9..d2e694d0 100644
--- a/host/lib/util_misc.c
+++ b/host/lib/util_misc.c
@@ -18,6 +18,7 @@
#include "2common.h"
#include "2sha.h"
#include "host_common.h"
+#include "openssl_compat.h"
#include "util_misc.h"
#include "vb2_common.h"
#include "host_key2.h"
@@ -73,6 +74,7 @@ int vb_keyb_from_rsa(struct rsa_st *rsa_private_key,
BIGNUM *N0inv = NULL, *R = NULL, *RR = NULL;
BIGNUM *RRTemp = NULL, *NnumBits = NULL;
BIGNUM *n = NULL, *rr = NULL;
+ const BIGNUM *rsa_private_key_n;
BN_CTX *bn_ctx = BN_CTX_new();
uint32_t n0invout;
uint32_t bufsize;
@@ -80,7 +82,7 @@ int vb_keyb_from_rsa(struct rsa_st *rsa_private_key,
int retval = 1;
/* Size of RSA key in 32-bit words */
- nwords = BN_num_bits(rsa_private_key->n) / 32;
+ nwords = RSA_size(rsa_private_key) / 4;
bufsize = (2 + nwords + nwords) * sizeof(uint32_t);
outbuf = malloc(bufsize);
@@ -109,7 +111,8 @@ int vb_keyb_from_rsa(struct rsa_st *rsa_private_key,
NEW_BIGNUM(B);
#undef NEW_BIGNUM
- BN_copy(N, rsa_private_key->n);
+ RSA_get0_key(rsa_private_key, &rsa_private_key_n, NULL, NULL);
+ BN_copy(N, rsa_private_key_n);
BN_set_word(Big1, 1L);
BN_set_word(Big2, 2L);
BN_set_word(Big32, 32L);