]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_ec_sign.c
Merge branch 'no_gost94_sig' into gost12_algs
[openssl-gost/engine.git] / gost_ec_sign.c
index 38c50ac8cd668f0a7ddaebb3c3fccd36e696bb64..8821799db6b1e439917add2d368e3cf819356b99 100644 (file)
@@ -7,7 +7,6 @@
  *          Requires OpenSSL 1.0.0+ for compilation                   *
  **********************************************************************/
 #include "gost_lcl.h"
-#include "gost_params.h"
 #include <string.h>
 #include <openssl/rand.h>
 #include <openssl/ecdsa.h>
@@ -24,6 +23,21 @@ void dump_dsa_sig(const char *message, DSA_SIG *sig);
 # define dump_dsa_sig(a,b)
 #endif
 
+/* Convert little-endian byte array into bignum */
+BIGNUM *hashsum2bn(const unsigned char *dgst, int len)
+{
+    unsigned char buf[64];
+    int i;
+
+    if (len > sizeof(buf))
+        return NULL;
+
+    for (i = 0; i < len; i++) {
+        buf[len - i - 1] = dgst[i];
+    }
+    return getbnfrombuf(buf, len);
+}
+
 static R3410_ec_params *gost_nid2params(int nid)
 {
     R3410_ec_params *params;