aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-09 15:13:28 +0000
committerlloyd <[email protected]>2011-02-09 15:13:28 +0000
commit75eff6cba7ac959f0d3b5292aa5ca7e321bf2e0d (patch)
treead44e3ce741c7d2c83c46a21f0242be4eec33402
parent5fa1a353fcdfc5fc83618f07a89b3d320596ae07 (diff)
Convert the BER/DER coders to use size_t instead of u32bit for small
integer values. Update callers.
-rw-r--r--src/asn1/ber_dec.cpp4
-rw-r--r--src/asn1/ber_dec.h4
-rw-r--r--src/asn1/der_enc.cpp4
-rw-r--r--src/asn1/der_enc.h4
-rw-r--r--src/cert/cvc/cvc_cert.cpp2
-rw-r--r--src/cert/cvc/cvc_req.cpp2
-rw-r--r--src/cert/pkcs10/pkcs10.cpp2
-rw-r--r--src/cert/x509ca/x509_ca.cpp4
-rw-r--r--src/cert/x509cert/x509_ext.cpp8
-rw-r--r--src/cert/x509cert/x509_ext.h14
-rw-r--r--src/cert/x509cert/x509cert.cpp6
-rw-r--r--src/cert/x509crl/x509_crl.cpp2
-rw-r--r--src/cert/x509self/x509opt.cpp2
-rw-r--r--src/cert/x509self/x509self.cpp2
-rw-r--r--src/cert/x509self/x509self.h4
-rw-r--r--src/cms/cms_algo.cpp4
-rw-r--r--src/cms/cms_comp.cpp4
-rw-r--r--src/cms/cms_dalg.cpp6
-rw-r--r--src/cms/cms_ealg.cpp14
-rw-r--r--src/pbe/pbes1/pbes1.h2
-rw-r--r--src/pbe/pbes2/pbes2.h2
-rw-r--r--src/pubkey/ec_dompar/ec_dompar.cpp4
-rw-r--r--src/pubkey/ecc_key/ecc_key.cpp4
-rw-r--r--src/pubkey/if_algo/if_algo.cpp4
-rw-r--r--src/pubkey/pkcs8.cpp4
-rw-r--r--src/pubkey/pubkey_enums.h6
26 files changed, 58 insertions, 60 deletions
diff --git a/src/asn1/ber_dec.cpp b/src/asn1/ber_dec.cpp
index e98ab3b61..b31c7b903 100644
--- a/src/asn1/ber_dec.cpp
+++ b/src/asn1/ber_dec.cpp
@@ -343,7 +343,7 @@ BER_Decoder& BER_Decoder::decode(bool& out)
/*
* Decode a small BER encoded INTEGER
*/
-BER_Decoder& BER_Decoder::decode(u32bit& out)
+BER_Decoder& BER_Decoder::decode(size_t& out)
{
return decode(out, INTEGER, UNIVERSAL);
}
@@ -383,7 +383,7 @@ BER_Decoder& BER_Decoder::decode(bool& out,
/*
* Decode a small BER encoded INTEGER
*/
-BER_Decoder& BER_Decoder::decode(u32bit& out,
+BER_Decoder& BER_Decoder::decode(size_t& out,
ASN1_Tag type_tag, ASN1_Tag class_tag)
{
BigInt integer;
diff --git a/src/asn1/ber_dec.h b/src/asn1/ber_dec.h
index 8dddcb7f4..5f79d3fc1 100644
--- a/src/asn1/ber_dec.h
+++ b/src/asn1/ber_dec.h
@@ -33,12 +33,12 @@ class BOTAN_DLL BER_Decoder
BER_Decoder& decode_null();
BER_Decoder& decode(bool&);
- BER_Decoder& decode(u32bit&);
+ BER_Decoder& decode(size_t&);
BER_Decoder& decode(class BigInt&);
BER_Decoder& decode(MemoryRegion<byte>&, ASN1_Tag);
BER_Decoder& decode(bool&, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
- BER_Decoder& decode(u32bit&, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ BER_Decoder& decode(size_t&, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
BER_Decoder& decode(class BigInt&,
ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
BER_Decoder& decode(MemoryRegion<byte>&, ASN1_Tag,
diff --git a/src/asn1/der_enc.cpp b/src/asn1/der_enc.cpp
index c6ceaf86d..a14b3c5e2 100644
--- a/src/asn1/der_enc.cpp
+++ b/src/asn1/der_enc.cpp
@@ -214,7 +214,7 @@ DER_Encoder& DER_Encoder::encode(bool is_true)
/*
* DER encode a small INTEGER
*/
-DER_Encoder& DER_Encoder::encode(u32bit n)
+DER_Encoder& DER_Encoder::encode(size_t n)
{
return encode(BigInt(n), INTEGER, UNIVERSAL);
}
@@ -259,7 +259,7 @@ DER_Encoder& DER_Encoder::encode(bool is_true,
/*
* DER encode a small INTEGER
*/
-DER_Encoder& DER_Encoder::encode(u32bit n,
+DER_Encoder& DER_Encoder::encode(size_t n,
ASN1_Tag type_tag, ASN1_Tag class_tag)
{
return encode(BigInt(n), type_tag, class_tag);
diff --git a/src/asn1/der_enc.h b/src/asn1/der_enc.h
index b3fce389d..f80c518b3 100644
--- a/src/asn1/der_enc.h
+++ b/src/asn1/der_enc.h
@@ -35,13 +35,13 @@ class BOTAN_DLL DER_Encoder
DER_Encoder& encode_null();
DER_Encoder& encode(bool);
- DER_Encoder& encode(u32bit);
+ DER_Encoder& encode(size_t);
DER_Encoder& encode(const BigInt&);
DER_Encoder& encode(const MemoryRegion<byte>&, ASN1_Tag);
DER_Encoder& encode(const byte[], size_t, ASN1_Tag);
DER_Encoder& encode(bool, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
- DER_Encoder& encode(u32bit, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
+ DER_Encoder& encode(size_t, ASN1_Tag, ASN1_Tag = CONTEXT_SPECIFIC);
DER_Encoder& encode(const BigInt&, ASN1_Tag,
ASN1_Tag = CONTEXT_SPECIFIC);
DER_Encoder& encode(const MemoryRegion<byte>&, ASN1_Tag,
diff --git a/src/cert/cvc/cvc_cert.cpp b/src/cert/cvc/cvc_cert.cpp
index 536520b37..54f72ecfc 100644
--- a/src/cert/cvc/cvc_cert.cpp
+++ b/src/cert/cvc/cvc_cert.cpp
@@ -35,7 +35,7 @@ void EAC1_1_CVC::force_decode()
{
SecureVector<byte> enc_pk;
SecureVector<byte> enc_chat_val;
- u32bit cpi;
+ size_t cpi;
BER_Decoder tbs_cert(tbs_bits);
tbs_cert.decode(cpi, ASN1_Tag(41), APPLICATION)
.decode(m_car)
diff --git a/src/cert/cvc/cvc_req.cpp b/src/cert/cvc/cvc_req.cpp
index 0a33d4dca..ad9e2f4ca 100644
--- a/src/cert/cvc/cvc_req.cpp
+++ b/src/cert/cvc/cvc_req.cpp
@@ -21,7 +21,7 @@ void EAC1_1_Req::force_decode()
{
SecureVector<byte> enc_pk;
BER_Decoder tbs_cert(tbs_bits);
- u32bit cpi;
+ size_t cpi;
tbs_cert.decode(cpi, ASN1_Tag(41), APPLICATION)
.start_cons(ASN1_Tag(73))
.raw_bytes(enc_pk)
diff --git a/src/cert/pkcs10/pkcs10.cpp b/src/cert/pkcs10/pkcs10.cpp
index 539022d08..784318d3d 100644
--- a/src/cert/pkcs10/pkcs10.cpp
+++ b/src/cert/pkcs10/pkcs10.cpp
@@ -41,7 +41,7 @@ void PKCS10_Request::force_decode()
{
BER_Decoder cert_req_info(tbs_bits);
- u32bit version;
+ size_t version;
cert_req_info.decode(version);
if(version != 0)
throw Decoding_Error("Unknown version code in PKCS #10 request: " +
diff --git a/src/cert/x509ca/x509_ca.cpp b/src/cert/x509ca/x509_ca.cpp
index 57307d67e..9cb4c0a7f 100644
--- a/src/cert/x509ca/x509_ca.cpp
+++ b/src/cert/x509ca/x509_ca.cpp
@@ -97,7 +97,7 @@ X509_Certificate X509_CA::make_cert(PK_Signer* signer,
const X509_DN& subject_dn,
const Extensions& extensions)
{
- const u32bit X509_CERT_VERSION = 3;
+ const size_t X509_CERT_VERSION = 3;
const size_t SERIAL_BITS = 256;
BigInt serial_no(rng, SERIAL_BITS);
@@ -166,7 +166,7 @@ X509_CRL X509_CA::make_crl(const std::vector<CRL_Entry>& revoked,
u32bit crl_number, u32bit next_update,
RandomNumberGenerator& rng) const
{
- const u32bit X509_CRL_VERSION = 2;
+ const size_t X509_CRL_VERSION = 2;
if(next_update == 0)
next_update = timespec_to_u32bit("7d");
diff --git a/src/cert/x509cert/x509_ext.cpp b/src/cert/x509cert/x509_ext.cpp
index 88cab96c5..462b29669 100644
--- a/src/cert/x509cert/x509_ext.cpp
+++ b/src/cert/x509cert/x509_ext.cpp
@@ -166,7 +166,7 @@ namespace Cert_Extension {
/*
* Checked accessor for the path_limit member
*/
-u32bit Basic_Constraints::get_path_limit() const
+size_t Basic_Constraints::get_path_limit() const
{
if(!is_ca)
throw Invalid_State("Basic_Constraints::get_path_limit: Not a CA");
@@ -505,7 +505,7 @@ void Certificate_Policies::contents_to(Data_Store& info, Data_Store&) const
/*
* Checked accessor for the crl_number member
*/
-u32bit CRL_Number::get_crl_number() const
+size_t CRL_Number::get_crl_number() const
{
if(!has_value)
throw Invalid_State("CRL_Number::get_crl_number: Not set");
@@ -552,7 +552,7 @@ void CRL_Number::contents_to(Data_Store& info, Data_Store&) const
MemoryVector<byte> CRL_ReasonCode::encode_inner() const
{
return DER_Encoder()
- .encode(static_cast<u32bit>(reason), ENUMERATED, UNIVERSAL)
+ .encode(static_cast<size_t>(reason), ENUMERATED, UNIVERSAL)
.get_contents();
}
@@ -561,7 +561,7 @@ MemoryVector<byte> CRL_ReasonCode::encode_inner() const
*/
void CRL_ReasonCode::decode_inner(const MemoryRegion<byte>& in)
{
- u32bit reason_code = 0;
+ size_t reason_code = 0;
BER_Decoder(in).decode(reason_code, ENUMERATED, UNIVERSAL);
reason = static_cast<CRL_Code>(reason_code);
}
diff --git a/src/cert/x509cert/x509_ext.h b/src/cert/x509cert/x509_ext.h
index 213a077a2..c32e39fdc 100644
--- a/src/cert/x509cert/x509_ext.h
+++ b/src/cert/x509cert/x509_ext.h
@@ -93,14 +93,16 @@ namespace Cert_Extension {
class BOTAN_DLL Basic_Constraints : public Certificate_Extension
{
public:
+ static const size_t NO_CERT_PATH_LIMIT = 0xFFFFFFF0;
+
Basic_Constraints* copy() const
{ return new Basic_Constraints(is_ca, path_limit); }
- Basic_Constraints(bool ca = false, u32bit limit = 0) :
+ Basic_Constraints(bool ca = false, size_t limit = 0) :
is_ca(ca), path_limit(limit) {}
bool get_is_ca() const { return is_ca; }
- u32bit get_path_limit() const;
+ size_t get_path_limit() const;
private:
std::string config_id() const { return "basic_constraints"; }
std::string oid_name() const { return "X509v3.BasicConstraints"; }
@@ -110,7 +112,7 @@ class BOTAN_DLL Basic_Constraints : public Certificate_Extension
void contents_to(Data_Store&, Data_Store&) const;
bool is_ca;
- u32bit path_limit;
+ size_t path_limit;
};
/**
@@ -292,9 +294,9 @@ class BOTAN_DLL CRL_Number : public Certificate_Extension
CRL_Number* copy() const;
CRL_Number() : has_value(false), crl_number(0) {}
- CRL_Number(u32bit n) : has_value(true), crl_number(n) {}
+ CRL_Number(size_t n) : has_value(true), crl_number(n) {}
- u32bit get_crl_number() const;
+ size_t get_crl_number() const;
private:
std::string config_id() const { return "crl_number"; }
std::string oid_name() const { return "X509v3.CRLNumber"; }
@@ -305,7 +307,7 @@ class BOTAN_DLL CRL_Number : public Certificate_Extension
void contents_to(Data_Store&, Data_Store&) const;
bool has_value;
- u32bit crl_number;
+ size_t crl_number;
};
/**
diff --git a/src/cert/x509cert/x509cert.cpp b/src/cert/x509cert/x509cert.cpp
index 4eef215f8..71ad8af82 100644
--- a/src/cert/x509cert/x509cert.cpp
+++ b/src/cert/x509cert/x509cert.cpp
@@ -66,7 +66,7 @@ X509_Certificate::X509_Certificate(const std::string& in) :
*/
void X509_Certificate::force_decode()
{
- u32bit version;
+ size_t version;
BigInt serial_bn;
AlgorithmIdentifier sig_algo_inner;
X509_DN dn_issuer, dn_subject;
@@ -141,7 +141,9 @@ void X509_Certificate::force_decode()
if(is_CA_cert() &&
!subject.has_value("X509v3.BasicConstraints.path_constraint"))
{
- u32bit limit = (x509_version() < 3) ? NO_CERT_PATH_LIMIT : 0;
+ const size_t limit = (x509_version() < 3) ?
+ Cert_Extension::Basic_Constraints::NO_CERT_PATH_LIMIT : 0;
+
subject.add("X509v3.BasicConstraints.path_constraint", limit);
}
}
diff --git a/src/cert/x509crl/x509_crl.cpp b/src/cert/x509crl/x509_crl.cpp
index f6a344dba..01fce4c52 100644
--- a/src/cert/x509crl/x509_crl.cpp
+++ b/src/cert/x509crl/x509_crl.cpp
@@ -39,7 +39,7 @@ void X509_CRL::force_decode()
{
BER_Decoder tbs_crl(tbs_bits);
- u32bit version;
+ size_t version;
tbs_crl.decode_optional(version, INTEGER, UNIVERSAL);
if(version != 0 && version != 1)
diff --git a/src/cert/x509self/x509opt.cpp b/src/cert/x509self/x509opt.cpp
index 0702ebf19..345df1fe0 100644
--- a/src/cert/x509self/x509opt.cpp
+++ b/src/cert/x509self/x509opt.cpp
@@ -55,7 +55,7 @@ void X509_Cert_Options::add_ex_constraint(const std::string& oid_str)
/*
* Mark this certificate for CA usage
*/
-void X509_Cert_Options::CA_key(u32bit limit)
+void X509_Cert_Options::CA_key(size_t limit)
{
is_CA = true;
path_limit = limit;
diff --git a/src/cert/x509self/x509self.cpp b/src/cert/x509self/x509self.cpp
index e420ca503..a2f89159f 100644
--- a/src/cert/x509self/x509self.cpp
+++ b/src/cert/x509self/x509self.cpp
@@ -103,7 +103,7 @@ PKCS10_Request create_cert_req(const X509_Cert_Options& opts,
std::auto_ptr<PK_Signer> signer(choose_sig_format(key, hash_fn, sig_algo));
load_info(opts, subject_dn, subject_alt);
- const u32bit PKCS10_VERSION = 0;
+ const size_t PKCS10_VERSION = 0;
Extensions extensions;
diff --git a/src/cert/x509self/x509self.h b/src/cert/x509self/x509self.h
index df5731050..2850096c8 100644
--- a/src/cert/x509self/x509self.h
+++ b/src/cert/x509self/x509self.h
@@ -102,7 +102,7 @@ class BOTAN_DLL X509_Cert_Options
/**
* Indicates the BasicConstraints path limit
*/
- u32bit path_limit;
+ size_t path_limit;
/**
* The key constraints for the subject public key
@@ -123,7 +123,7 @@ class BOTAN_DLL X509_Cert_Options
* Mark the certificate as a CA certificate and set the path limit.
* @param limit the path limit to be set in the BasicConstraints extension.
*/
- void CA_key(u32bit limit = 1);
+ void CA_key(size_t limit = 1);
/**
* Set the notBefore of the certificate.
diff --git a/src/cms/cms_algo.cpp b/src/cms/cms_algo.cpp
index a02f7e737..50384d85a 100644
--- a/src/cms/cms_algo.cpp
+++ b/src/cms/cms_algo.cpp
@@ -123,7 +123,7 @@ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher,
if(cipher == "RC2")
{
encoder.start_cons(SEQUENCE).
- encode((u32bit)RC2::EKB_code(8*key.length())).
+ encode(static_cast<size_t>(RC2::EKB_code(8*key.length()))).
encode(iv.bits_of(), OCTET_STRING).
end_cons();
return encoder.get_contents();
@@ -134,7 +134,7 @@ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher,
{
encoder.start_cons(SEQUENCE).
encode(iv.bits_of(), OCTET_STRING).
- encode(u32bit(8*key.length())).
+ encode(8*key.length()).
end_cons();
}
else
diff --git a/src/cms/cms_comp.cpp b/src/cms/cms_comp.cpp
index b11cf909b..3d9108e13 100644
--- a/src/cms/cms_comp.cpp
+++ b/src/cms/cms_comp.cpp
@@ -41,7 +41,7 @@ void CMS_Encoder::compress(const std::string& algo)
DER_Encoder encoder;
encoder.start_cons(SEQUENCE).
- encode((u32bit)0).
+ encode(static_cast<size_t>(0)).
encode(AlgorithmIdentifier("Compression." + algo,
MemoryVector<byte>())).
raw_bytes(make_econtent(compressed, type)).
@@ -71,7 +71,7 @@ bool CMS_Encoder::can_compress_with(const std::string& algo)
*/
void CMS_Decoder::decompress(BER_Decoder& decoder)
{
- u32bit version;
+ size_t version;
AlgorithmIdentifier comp_algo;
BER_Decoder comp_info = decoder.start_cons(SEQUENCE);
diff --git a/src/cms/cms_dalg.cpp b/src/cms/cms_dalg.cpp
index 8b168902b..2935f3070 100644
--- a/src/cms/cms_dalg.cpp
+++ b/src/cms/cms_dalg.cpp
@@ -175,7 +175,7 @@ void CMS_Decoder::decode_layer()
decompress(decoder);
else if(type == OIDS::lookup("CMS.DigestedData"))
{
- u32bit version;
+ size_t version;
AlgorithmIdentifier hash_algo;
SecureVector<byte> digest;
@@ -198,7 +198,7 @@ void CMS_Decoder::decode_layer()
#if 1
throw Internal_Error("FIXME: not implemented");
#else
- u32bit version;
+ size_t version;
BER_Decoder sig_info = BER::get_subsequence(decoder);
BER::decode(sig_info, version);
@@ -213,7 +213,7 @@ void CMS_Decoder::decode_layer()
{
AlgorithmIdentifier sig_algo, hash_algo;
SecureVector<byte> signature, digest;
- u32bit version;
+ size_t version;
BER_Decoder signer_info = BER::get_subsequence(signer_infos);
BER::decode(signer_info, version);
diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp
index 262c74b86..4aee8afd8 100644
--- a/src/cms/cms_ealg.cpp
+++ b/src/cms/cms_ealg.cpp
@@ -140,10 +140,10 @@ void CMS_Encoder::encrypt_ktri(RandomNumberGenerator& rng,
DER_Encoder encoder;
encoder.start_cons(SEQUENCE)
- .encode((u32bit)0)
+ .encode(static_cast<size_t>(0))
.start_cons(SET)
.start_cons(SEQUENCE)
- .encode((u32bit)0);
+ .encode(static_cast<size_t>(0));
encode_si(encoder, to)
.encode(alg_id)
.encode(encryptor.encrypt(cek.bits_of(), rng), OCTET_STRING)
@@ -203,9 +203,9 @@ void CMS_Encoder::encrypt(RandomNumberGenerator& rng,
DER_Encoder encoder;
encoder.start_cons(SEQUENCE)
- .encode((u32bit)2)
+ .encode(static_cast<size_t>(2))
.start_explicit(ASN1_Tag(2))
- .encode((u32bit)4)
+ .encode(static_cast<size_t>(4))
.start_cons(SEQUENCE)
.encode(kek_id, OCTET_STRING)
.end_cons()
@@ -302,8 +302,8 @@ void CMS_Encoder::sign(const X509_Certificate& cert,
SecureVector<byte> signature = signer.signature(rng);
signed_attr[0] = 0xA0;
- const u32bit SI_VERSION = cert.subject_key_id().size() ? 3 : 1;
- const u32bit CMS_VERSION = (type != "CMS.DataContent") ? 3 : SI_VERSION;
+ const size_t SI_VERSION = cert.subject_key_id().size() ? 3 : 1;
+ const size_t CMS_VERSION = (type != "CMS.DataContent") ? 3 : SI_VERSION;
DER_Encoder encoder;
@@ -347,7 +347,7 @@ void CMS_Encoder::digest(const std::string& user_hash)
if(!OIDS::have_oid(hash))
throw Encoding_Error("CMS: No OID assigned for " + hash);
- const u32bit VERSION = (type != "CMS.DataContent") ? 2 : 0;
+ const size_t VERSION = (type != "CMS.DataContent") ? 2 : 0;
DER_Encoder encoder;
encoder.start_cons(SEQUENCE)
diff --git a/src/pbe/pbes1/pbes1.h b/src/pbe/pbes1/pbes1.h
index dd991a515..e10cbbb53 100644
--- a/src/pbe/pbes1/pbes1.h
+++ b/src/pbe/pbes1/pbes1.h
@@ -51,7 +51,7 @@ class BOTAN_DLL PBE_PKCS5v15 : public PBE
HashFunction* hash_function;
SecureVector<byte> salt, key, iv;
- u32bit iterations;
+ size_t iterations;
Pipe pipe;
};
diff --git a/src/pbe/pbes2/pbes2.h b/src/pbe/pbes2/pbes2.h
index 1c7119e3a..7b82980e5 100644
--- a/src/pbe/pbes2/pbes2.h
+++ b/src/pbe/pbes2/pbes2.h
@@ -59,7 +59,7 @@ class BOTAN_DLL PBE_PKCS5v20 : public PBE
BlockCipher* block_cipher;
HashFunction* hash_function;
SecureVector<byte> salt, key, iv;
- u32bit iterations, key_length;
+ size_t iterations, key_length;
Pipe pipe;
};
diff --git a/src/pubkey/ec_dompar/ec_dompar.cpp b/src/pubkey/ec_dompar/ec_dompar.cpp
index f27185e84..deb512518 100644
--- a/src/pubkey/ec_dompar/ec_dompar.cpp
+++ b/src/pubkey/ec_dompar/ec_dompar.cpp
@@ -68,7 +68,7 @@ EC_Domain_Params::EC_Domain_Params(const MemoryRegion<byte>& ber_data)
BER_Decoder(ber_data)
.start_cons(SEQUENCE)
- .decode_and_check<u32bit>(1, "Unknown ECC param version code")
+ .decode_and_check<size_t>(1, "Unknown ECC param version code")
.start_cons(SEQUENCE)
.decode_and_check(OID("1.2.840.10045.1.1"),
"Only prime ECC fields supported")
@@ -96,7 +96,7 @@ EC_Domain_Params::DER_encode(EC_Domain_Params_Encoding form) const
{
if(form == EC_DOMPAR_ENC_EXPLICIT)
{
- const u32bit ecpVers1 = 1;
+ const size_t ecpVers1 = 1;
OID curve_type("1.2.840.10045.1.1");
const size_t p_bytes = curve.get_p().bytes();
diff --git a/src/pubkey/ecc_key/ecc_key.cpp b/src/pubkey/ecc_key/ecc_key.cpp
index bf221aad0..bd04e3197 100644
--- a/src/pubkey/ecc_key/ecc_key.cpp
+++ b/src/pubkey/ecc_key/ecc_key.cpp
@@ -108,7 +108,7 @@ MemoryVector<byte> EC_PrivateKey::pkcs8_private_key() const
{
return DER_Encoder()
.start_cons(SEQUENCE)
- .encode(static_cast<u32bit>(1))
+ .encode(static_cast<size_t>(1))
.encode(BigInt::encode_1363(private_key, private_key.bytes()),
OCTET_STRING)
.end_cons()
@@ -123,7 +123,7 @@ EC_PrivateKey::EC_PrivateKey(const AlgorithmIdentifier& alg_id,
BER_Decoder(key_bits)
.start_cons(SEQUENCE)
- .decode_and_check<u32bit>(1, "Unknown version code for ECC key")
+ .decode_and_check<size_t>(1, "Unknown version code for ECC key")
.decode_octet_string_bigint(private_key)
.verify_end()
.end_cons();
diff --git a/src/pubkey/if_algo/if_algo.cpp b/src/pubkey/if_algo/if_algo.cpp
index eb58874ee..6e75bc276 100644
--- a/src/pubkey/if_algo/if_algo.cpp
+++ b/src/pubkey/if_algo/if_algo.cpp
@@ -53,7 +53,7 @@ MemoryVector<byte> IF_Scheme_PrivateKey::pkcs8_private_key() const
{
return DER_Encoder()
.start_cons(SEQUENCE)
- .encode(static_cast<u32bit>(0))
+ .encode(static_cast<size_t>(0))
.encode(n)
.encode(e)
.encode(d)
@@ -72,7 +72,7 @@ IF_Scheme_PrivateKey::IF_Scheme_PrivateKey(RandomNumberGenerator& rng,
{
BER_Decoder(key_bits)
.start_cons(SEQUENCE)
- .decode_and_check<u32bit>(0, "Unknown PKCS #1 key format version")
+ .decode_and_check<size_t>(0, "Unknown PKCS #1 key format version")
.decode(n)
.decode(e)
.decode(d)
diff --git a/src/pubkey/pkcs8.cpp b/src/pubkey/pkcs8.cpp
index 4a43f4402..16440b648 100644
--- a/src/pubkey/pkcs8.cpp
+++ b/src/pubkey/pkcs8.cpp
@@ -107,7 +107,7 @@ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui,
BER_Decoder(key)
.start_cons(SEQUENCE)
- .decode_and_check<u32bit>(0, "Unknown PKCS #8 version number")
+ .decode_and_check<size_t>(0, "Unknown PKCS #8 version number")
.decode(pk_alg_id)
.decode(key, OCTET_STRING)
.discard_remaining()
@@ -133,7 +133,7 @@ SecureVector<byte> PKCS8_decode(DataSource& source, const User_Interface& ui,
*/
SecureVector<byte> BER_encode(const Private_Key& key)
{
- const u32bit PKCS8_VERSION = 0;
+ const size_t PKCS8_VERSION = 0;
return DER_Encoder()
.start_cons(SEQUENCE)
diff --git a/src/pubkey/pubkey_enums.h b/src/pubkey/pubkey_enums.h
index 53e319f38..99f804e0a 100644
--- a/src/pubkey/pubkey_enums.h
+++ b/src/pubkey/pubkey_enums.h
@@ -66,12 +66,6 @@ enum CRL_Code {
*/
enum X509_Encoding { RAW_BER, PEM };
-/**
-* Value to encode in case of no path limit in the X509
-* BasicConstraints extension.
-*/
-static const u32bit NO_CERT_PATH_LIMIT = 0xFFFFFFF0;
-
}
#endif