X-Git-Url: https://wagner.pp.ru/gitweb/?a=blobdiff_plain;ds=sidebyside;f=gost_ameth.c;h=0ea1583aa4742c5cc47847b0f0aeeb24aadbfb5d;hb=7f0bd904ca97985ad989fe10d65568c9d6c5b2b3;hp=f967283dff04529398fe9c3ec0bc59437385d6fb;hpb=096f193c98ffbe23686f10c834b2c42092b65954;p=openssl-gost%2Fengine.git diff --git a/gost_ameth.c b/gost_ameth.c index f967283..0ea1583 100644 --- a/gost_ameth.c +++ b/gost_ameth.c @@ -34,22 +34,6 @@ int store_bignum(BIGNUM *bn, unsigned char *buf, int len) return 1; } -/* Convert byte buffer to bignum, skipping leading zeros*/ -BIGNUM *getbnfrombuf(const unsigned char *buf, size_t len) -{ - BIGNUM *b; - - while (*buf == 0 && len > 0) { - buf++; - len--; - } - if (len) - return BN_bin2bn(buf, len, NULL); - b = BN_new(); - BN_zero(b); - return b; -} - static int pkey_bits_gost(const EVP_PKEY *pk) { if (!pk) @@ -684,8 +668,8 @@ static int pub_decode_gost_ec(EVP_PKEY *pk, X509_PUBKEY *pub) len = octet->length / 2; ASN1_OCTET_STRING_free(octet); - Y = getbnfrombuf(databuf, len); - X = getbnfrombuf(databuf + len, len); + Y = BN_bin2bn(databuf, len, NULL); + X = BN_bin2bn(databuf + len, len, NULL); OPENSSL_free(databuf); pub_key = EC_POINT_new(group); if (!EC_POINT_set_affine_coordinates_GFp(group, pub_key, X, Y, NULL)) {