| 7 | #include <stdio.h> |
| 8 | |
| 9 | unsigned int DERLengthEncode(unsigned int length, byte *output) |
| 10 | { |
| 11 | unsigned int i=0; |
| 12 | if (length <= 0x7f) |
| 13 | { |
| 14 | output[i++] = byte(length); |
| 15 | } |
| 16 | else |
| 17 | { |
| 18 | output[i++] = byte(BytePrecision(length) | 0x80); |
| 19 | for (int j=BytePrecision(length); j; --j) |
| 20 | { |
| 21 | output[i++] = byte (length >> (j-1)*8); |
| 22 | } |
| 23 | } |
| 24 | return i; |
| 25 | } |
| 26 | |
| 27 | unsigned int DERLengthEncode(unsigned int length, BufferedTransformation &bt) |
| 28 | { |
no test coverage detected