From eeca39ae50bcb7dfb1089b37658de4f02a0c1f9a Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 8 May 2009 15:07:45 +0000 Subject: More support for Netkey cards. Small changes to teh CCID driver. Support 2048 bit OpenPGP cards. --- scd/app-help.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'scd/app-help.c') diff --git a/scd/app-help.c b/scd/app-help.c index 83b34c64e..3d9c605f6 100644 --- a/scd/app-help.c +++ b/scd/app-help.c @@ -1,5 +1,5 @@ /* app-help.c - Application helper functions - * Copyright (C) 2004 Free Software Foundation, Inc. + * Copyright (C) 2004, 2009 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -28,6 +28,30 @@ #include "iso7816.h" #include "tlv.h" + +/* Count the number of bits, assuming the A represents an unsigned big + integer of length LEN bytes. If A is NULL a length of 0 is + returned. */ +unsigned int +app_help_count_bits (const unsigned char *a, size_t len) +{ + unsigned int n = len * 8; + int i; + + if (!a) + return 0; + + for (; len && !*a; len--, a++, n -=8) + ; + if (len) + { + for (i=7; i && !(*a & (1<