openssl-pkcs11/openssl-pkcs11-0.4.8-improve-code-readability.patch
Anderson Toshiyuki Sasaki 889aab18fc openssl-pkcs11-0.4.8-2
- Require OpenSSL >= 1.0.2
- Fixed missing declaration of ERR_get_CKR_code()
- Add support to use EC keys and tests (#1619184)
- Exposed check_fork() API
- Fixed memory leak of RSA objects in pkcs11_store_key()
- Updated OpenSSL license in eng_front.c
- Fixed build for old C dialects
- Allow engine to use private key without PIN
- Require DEBUG to be defined to print debug messages
- Changed package description (#1614699)
2018-09-18 10:02:33 +02:00

44 lines
1.1 KiB
Diff

From 1462a0a25286d36cf85acb4bab189ae6cc8eabd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Trojnara?= <Michal.Trojnara@stunnel.org>
Date: Fri, 31 Aug 2018 08:45:16 +0200
Subject: [PATCH 14/23] Improved code readability
---
src/p11_slot.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/p11_slot.c b/src/p11_slot.c
index 94ec378..c5140c1 100644
--- a/src/p11_slot.c
+++ b/src/p11_slot.c
@@ -119,19 +119,20 @@ PKCS11_SLOT *pkcs11_find_token(PKCS11_CTX *ctx, PKCS11_SLOT *slots, unsigned int
*/
PKCS11_SLOT *pkcs11_find_next_token(PKCS11_CTX *ctx, PKCS11_SLOT *slots, unsigned int nslots, PKCS11_SLOT *current)
{
+ int offset;
+
if (slots == NULL)
return NULL;
if (current) {
- if (slots > current || (current - slots) > nslots)
+ offset = current + 1 - slots;
+ if (offset < 1 || (unsigned int)offset >= nslots)
return NULL;
-
- current++;
- nslots -= (current - slots);
- slots = current;
+ } else {
+ offset = 0;
}
- return pkcs11_find_token(ctx, slots, nslots);
+ return pkcs11_find_token(ctx, slots+offset, nslots-offset);
}
/*
--
2.17.1