Merge pull request #1287 from rckclmbr/fix_serial_size

Fix getting long serial numbers for openssl < 1.1
This commit is contained in:
Tatsuhiro Tsujikawa 2019-01-05 09:48:36 +09:00 committed by GitHub
commit dbb5f00d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -2046,9 +2046,9 @@ StringRef get_x509_serial(BlockAllocator &balloc, X509 *x) {
return StringRef{}; return StringRef{};
} }
std::array<uint8_t, 8> b; std::array<uint8_t, 20> b;
auto n = BN_bn2bin(bn, b.data()); auto n = BN_bn2bin(bn, b.data());
assert(n == b.size()); assert(n <= 20);
return util::format_hex(balloc, StringRef{std::begin(b), std::end(b)}); return util::format_hex(balloc, StringRef{std::begin(b), std::end(b)});
#endif // !OPENSSL_1_1_API #endif // !OPENSSL_1_1_API