diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 2ea7fc40e..8e61df836 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -672,6 +672,21 @@ count_bits (const unsigned char *a, size_t len) return n; } +static unsigned int +count_sos_bits (const unsigned char *a, size_t len) +{ + unsigned int n = len * 8; + int i; + + if (len == 0 || *a == 0) + return n; + + for (i=7; i && !(*a & (1<> 8; *p++ = nbits; } + else if (i == 1) + { + nbits = count_sos_bits (m[i], mlen[i]); + *p++ = nbits >> 8; + *p++ = nbits; + } memcpy (p, m[i], mlen[i]); p += mlen[i]; }