File: 0001-Fix-RSA_set0_key-usage-to-make-verify-work-with-Open.patch

package info (click to toggle)
simple-tpm-pk11 0.06-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 448 kB
  • sloc: cpp: 2,623; makefile: 119; exp: 48; sh: 7
file content (33 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Thomas Habets <habets@google.com>
Date: Thu, 2 Aug 2018 12:32:33 +0100
Subject: Fix RSA_set0_key() usage to make verify work with OpenSSL 1.1

Fixes #43
---
 src/common.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/common.cc b/src/common.cc
index 56d910a..b6f573e 100644
--- a/src/common.cc
+++ b/src/common.cc
@@ -57,7 +57,7 @@ RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
   rsa->n = n;
   rsa->e = e;
   rsa->d = d;
-  return 0;
+  return 1;
 }
 #endif
 #ifndef HAVE_RSA_GET0_KEY
@@ -803,8 +803,8 @@ public_decrypt(const Key& key, const std::string& sig)
 {
   // Load key.
   RSAWrap rsa;
-  if (RSA_set0_key(rsa.get(), string2bn(key.modulus), string2bn(key.exponent),
-                   NULL)) {
+  if (!RSA_set0_key(rsa.get(), string2bn(key.modulus), string2bn(key.exponent),
+                    NULL)) {
     throw std::runtime_error("RSA_set0_key failed");
   }