aboutsummaryrefslogtreecommitdiffstats
path: root/scd/app-openpgp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-08-27 14:42:52 +0000
committerWerner Koch <[email protected]>2017-08-27 14:42:52 +0000
commit45d5f5800afe6613f338a26f361cb5e03e861129 (patch)
tree3c9be60f53c850081965f8c033bfb7816d7db798 /scd/app-openpgp.c
parentgpg: Fix memory leak while running --check-trustdb. (diff)
downloadgnupg-45d5f5800afe6613f338a26f361cb5e03e861129.tar.gz
gnupg-45d5f5800afe6613f338a26f361cb5e03e861129.zip
scd: Convey the correct length for Le
* scd/app-openpgp.c (determine_rsa_response): Round bits up. -- Co-authored-by: Arnaud Fontaine <[email protected]> Arnaud wrote: Actually, when the incorrect expected response length (i.e. Le field) is transmitted to the card, the card's answer is missing a byte (i.e. ... 6101) so an additional command has to be sent to the card to retrieve the last byte. Using the correct length avoids to send the additional command to retrieve the missing byte, when the computed length is wrong. Note that an value of 65537 for E is pretty standard and thus we can avoid the 6101 return code inmost cases. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'scd/app-openpgp.c')
-rw-r--r--scd/app-openpgp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c
index 365f24649..f9d07ac46 100644
--- a/scd/app-openpgp.c
+++ b/scd/app-openpgp.c
@@ -943,8 +943,8 @@ determine_rsa_response (app_t app, int keyno)
int size;
size = 2 + 3 /* header */
- + 4 /* tag+len */ + app->app_local->keyattr[keyno].rsa.n_bits/8
- + 2 /* tag+len */ + app->app_local->keyattr[keyno].rsa.e_bits/8;
+ + 4 /* tag+len */ + (app->app_local->keyattr[keyno].rsa.n_bits+7)/8
+ + 2 /* tag+len */ + (app->app_local->keyattr[keyno].rsa.e_bits+7)/8;
return size;
}