ECDSA – I can help with code

Advertisement

Ivan83
Joined:
Posts:
5
Location:
Russia, Moscow

ECDSA – I can help with code

Hi!

I wrote the code to work with ECDSA.
BSD License.
ECDSA can help with your project.

Reply with quote

Advertisement

Ivan83
Joined:
Posts:
5
Location:
Russia, Moscow

<invalid hyperlink removed by admin>
<invalid hyperlink removed by admin>

#include "ec.h"
 
...
 
size_t rsize;
uint8_t rnd[70], priv_key[70], pub_key_x[70], pub_key_y[70], sign_r[70], sign_s[70];
ec_curve_t curve;
/*  SHA-1("abc") = "a9993e364706816aba3e25717850c26c9cd0d89d" */ uint8_t hash_abc[20] = {0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d};
 
/* Get curve params by name. */
if (0 != ec_curve_from_str(ec_curve_str_get_by_name((uint8_t*)"secp192r1", 9), &curve))
   return (-1);
 
/* Generating keys. */
memset(rnd, 173, sizeof(rnd));/* XXX rand!!! */
if (0 != ec_key_gen(rnd, sizeof(rnd), &curve, priv_key, pub_key_x, pub_key_y, &rsize))
   return (-1); /* Error! */
 
/* Sign */
memset(rnd, 73, sizeof(rnd));/* XXX rand!!! */
if (0 != ec_sign((uint8_t*)hash_abc, 20, priv_key, rsize, rnd, sizeof(rnd), &curve, sign_r, sign_s, &rsize))
   return (-1); /* Error! */
 
/* Verify */
if (0 != ec_verify(&curve, pub_key_x, pub_key_y, rsize, (uint8_t*)hash_abc, 20, sign_r, sign_s, rsize))
   return (-1); /* Error! */

Reply with quote

Advertisement

Ivan83
Joined:
Posts:
5
Location:
Russia, Moscow

There are many different parameters of elliptic curves.
Some appeared in the work in 1998.
There are parameters of elliptic curves generated not in the United States .
There are Russian version where in the formulas are slightly different coefficients and parameters of their curves.
All formulas and algorithms have long existed and analyzing it is described how to generate the most options for elliptic curves.
However, 25519 appeared not long ago, the formula calculations there several others, and I have not seen this work on cryptanalysis "works of art". And almost all implementations in assembler.
So if anyone does not believe it is 25519. This is my personal opinion.

Reply with quote