diff options
Diffstat (limited to 'src/engine/gnump/gnump_pk.cpp')
-rw-r--r-- | src/engine/gnump/gnump_pk.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/engine/gnump/gnump_pk.cpp b/src/engine/gnump/gnump_pk.cpp index 758e73520..25735fe55 100644 --- a/src/engine/gnump/gnump_pk.cpp +++ b/src/engine/gnump/gnump_pk.cpp @@ -38,7 +38,7 @@ class GMP_DH_KA_Operation : public PK_Ops::Key_Agreement GMP_DH_KA_Operation(const DH_PrivateKey& dh) : x(dh.get_x()), p(dh.group_p()) {} - SecureVector<byte> agree(const byte w[], u32bit w_len) + SecureVector<byte> agree(const byte w[], size_t w_len) { GMP_MPZ z(w, w_len); mpz_powm(z.value, z.value, x.value, p.value); @@ -62,22 +62,22 @@ class GMP_DSA_Signature_Operation : public PK_Ops::Signature g(dsa.group_g()), q_bits(dsa.group_q().bits()) {} - u32bit message_parts() const { return 2; } - u32bit message_part_size() const { return (q_bits + 7) / 8; } - u32bit max_input_bits() const { return q_bits; } + size_t message_parts() const { return 2; } + size_t message_part_size() const { return (q_bits + 7) / 8; } + size_t max_input_bits() const { return q_bits; } - SecureVector<byte> sign(const byte msg[], u32bit msg_len, + SecureVector<byte> sign(const byte msg[], size_t msg_len, RandomNumberGenerator& rng); private: const GMP_MPZ x, p, q, g; - u32bit q_bits; + size_t q_bits; }; SecureVector<byte> -GMP_DSA_Signature_Operation::sign(const byte msg[], u32bit msg_len, +GMP_DSA_Signature_Operation::sign(const byte msg[], size_t msg_len, RandomNumberGenerator& rng) { - const u32bit q_bytes = (q_bits + 7) / 8; + const size_t q_bytes = (q_bits + 7) / 8; rng.add_entropy(msg, msg_len); @@ -120,23 +120,23 @@ class GMP_DSA_Verification_Operation : public PK_Ops::Verification g(dsa.group_g()), q_bits(dsa.group_q().bits()) {} - u32bit message_parts() const { return 2; } - u32bit message_part_size() const { return (q_bits + 7) / 8; } - u32bit max_input_bits() const { return q_bits; } + size_t message_parts() const { return 2; } + size_t message_part_size() const { return (q_bits + 7) / 8; } + size_t max_input_bits() const { return q_bits; } bool with_recovery() const { return false; } - bool verify(const byte msg[], u32bit msg_len, - const byte sig[], u32bit sig_len); + bool verify(const byte msg[], size_t msg_len, + const byte sig[], size_t sig_len); private: const GMP_MPZ y, p, q, g; - u32bit q_bits; + size_t q_bits; }; -bool GMP_DSA_Verification_Operation::verify(const byte msg[], u32bit msg_len, - const byte sig[], u32bit sig_len) +bool GMP_DSA_Verification_Operation::verify(const byte msg[], size_t msg_len, + const byte sig[], size_t sig_len) { - const u32bit q_bytes = q.bytes(); + const size_t q_bytes = q.bytes(); if(sig_len != 2*q_bytes || msg_len > q_bytes) return false; @@ -190,9 +190,9 @@ class GMP_RSA_Private_Operation : public PK_Ops::Signature, n_bits(rsa.get_n().bits()) {} - u32bit max_input_bits() const { return (n_bits - 1); } + size_t max_input_bits() const { return (n_bits - 1); } - SecureVector<byte> sign(const byte msg[], u32bit msg_len, + SecureVector<byte> sign(const byte msg[], size_t msg_len, RandomNumberGenerator&) { BigInt m(msg, msg_len); @@ -200,7 +200,7 @@ class GMP_RSA_Private_Operation : public PK_Ops::Signature, return BigInt::encode_1363(x, (n_bits + 7) / 8); } - SecureVector<byte> decrypt(const byte msg[], u32bit msg_len) + SecureVector<byte> decrypt(const byte msg[], size_t msg_len) { BigInt m(msg, msg_len); return BigInt::encode(private_op(m)); @@ -210,7 +210,7 @@ class GMP_RSA_Private_Operation : public PK_Ops::Signature, BigInt private_op(const BigInt& m) const; GMP_MPZ mod, p, q, d1, d2, c; - u32bit n_bits; + size_t n_bits; }; BigInt GMP_RSA_Private_Operation::private_op(const BigInt& m) const @@ -235,17 +235,17 @@ class GMP_RSA_Public_Operation : public PK_Ops::Verification, n(rsa.get_n()), e(rsa.get_e()), mod(rsa.get_n()) {} - u32bit max_input_bits() const { return (n.bits() - 1); } + size_t max_input_bits() const { return (n.bits() - 1); } bool with_recovery() const { return true; } - SecureVector<byte> encrypt(const byte msg[], u32bit msg_len, + SecureVector<byte> encrypt(const byte msg[], size_t msg_len, RandomNumberGenerator&) { BigInt m(msg, msg_len); return BigInt::encode_1363(public_op(m), n.bytes()); } - SecureVector<byte> verify_mr(const byte msg[], u32bit msg_len) + SecureVector<byte> verify_mr(const byte msg[], size_t msg_len) { BigInt m(msg, msg_len); return BigInt::encode(public_op(m)); |