aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-08-14 21:42:42 -0400
committerJack Lloyd <[email protected]>2018-08-14 21:52:24 -0400
commit759d55886dcc1f5351c22e568c87b3a30644e055 (patch)
tree64fd9b69344152fa618983045bce7dd1b519c80b /src/lib/asn1
parentb100a4f1de538e120413d72f09fd2ab9e43d81b5 (diff)
Cleanup of BigInt encoding/decoding functions
Instigated by finding a bug where BigInt::encode with decimal output would often have a leading '0' char. Which is papered over in the IO operator, but was exposed by botan_mp_to_str which called BigInt::encode directly. Split BigInt::encode/decode into two versions, one taking the Base argument and the other using the (previously default) binary base. With a view of eventually deprecating the versions taking a base. Add BigInt::to_dec_string() and BigInt::to_hex_string()
Diffstat (limited to 'src/lib/asn1')
-rw-r--r--src/lib/asn1/asn1_print.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/asn1/asn1_print.cpp b/src/lib/asn1/asn1_print.cpp
index 1f9178266..5c05d6589 100644
--- a/src/lib/asn1/asn1_print.cpp
+++ b/src/lib/asn1/asn1_print.cpp
@@ -174,7 +174,7 @@ void ASN1_Formatter::decode(std::ostream& output,
data.decode(number, ENUMERATED, class_tag);
}
- std::vector<uint8_t> rep = BigInt::encode(number, BigInt::Binary);
+ std::vector<uint8_t> rep = BigInt::encode(number);
if(rep.empty()) // if zero
rep.resize(1);