comparison dss.c @ 435:337c45621e81

merge of 'a9b0496634cdd25647b65e585cc3240f3fa699ee' and 'c22be8b8f570b48e9662dac32c7b3e7148a42206'
author Matt Johnston <matt@ucc.asn.au>
date Thu, 22 Feb 2007 14:53:49 +0000
parents a124aff0cbf1
children b50f0107e505 76097ec1a29a
comparison
equal deleted inserted replaced
434:0aaaf68e97dc 435:337c45621e81
88 } 88 }
89 89
90 key->x = m_malloc(sizeof(mp_int)); 90 key->x = m_malloc(sizeof(mp_int));
91 m_mp_init(key->x); 91 m_mp_init(key->x);
92 ret = buf_getmpint(buf, key->x); 92 ret = buf_getmpint(buf, key->x);
93 if (ret == DROPBEAR_FAILURE) {
94 m_free(key->x);
95 }
93 96
94 return ret; 97 return ret;
95 } 98 }
96 99
97 100
336 sha512_done(&hs, proto_k); 339 sha512_done(&hs, proto_k);
337 340
338 /* generate k */ 341 /* generate k */
339 m_mp_init(&dss_protok); 342 m_mp_init(&dss_protok);
340 bytes_to_mp(&dss_protok, proto_k, SHA512_HASH_SIZE); 343 bytes_to_mp(&dss_protok, proto_k, SHA512_HASH_SIZE);
341 mp_mod(&dss_protok, key->q, &dss_k); 344 if (mp_mod(&dss_protok, key->q, &dss_k) != MP_OKAY) {
345 dropbear_exit("dss error");
346 }
342 mp_clear(&dss_protok); 347 mp_clear(&dss_protok);
343 m_burn(proto_k, SHA512_HASH_SIZE); 348 m_burn(proto_k, SHA512_HASH_SIZE);
344 #else /* DSS_PROTOK not defined*/ 349 #else /* DSS_PROTOK not defined*/
345 gen_random_mpint(key->q, &dss_k); 350 gen_random_mpint(key->q, &dss_k);
346 #endif 351 #endif