aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-07-24 13:13:30 -0400
committerJack Lloyd <[email protected]>2018-07-24 13:13:30 -0400
commit19e5fd686c6aa9961d32fb71c93e245bb69011d6 (patch)
treeeec483c31ce2861545b1a58cddc2a71da144fb55 /src/lib/pubkey
parent68462e5824c83436d7340c4ca901efdd34632eb3 (diff)
Fix bad assert in Goppa decoding
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r--src/lib/pubkey/mce/goppa_code.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/pubkey/mce/goppa_code.cpp b/src/lib/pubkey/mce/goppa_code.cpp
index e28e3b9b0..3cb92aaca 100644
--- a/src/lib/pubkey/mce/goppa_code.cpp
+++ b/src/lib/pubkey/mce/goppa_code.cpp
@@ -90,14 +90,15 @@ secure_vector<gf2m> goppa_decode(const polyn_gf2m & syndrom_polyn,
// sigma = u^2+z*v^2
polyn_gf2m sigma ( t , g.get_sp_field());
- const size_t u_deg = u.get_degree();
- for(size_t i = 0; i <= u_deg; ++i)
+ const int u_deg = u.get_degree();
+ BOTAN_ASSERT(u_deg >= 0, "Valid degree");
+ for(int i = 0; i <= u_deg; ++i)
{
sigma.set_coef(2*i, sp_field->gf_square(u.get_coef(i)));
}
const int v_deg = v.get_degree();
- BOTAN_ASSERT(v_deg > 0, "Valid degree");
+ BOTAN_ASSERT(v_deg >= 0, "Valid degree");
for(int i = 0; i <= v_deg; ++i)
{
sigma.set_coef(2*i+1, sp_field->gf_square(v.get_coef(i)));