X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_keyexpimp.c;h=ebd1fa1391e412124cfe757a47f523823446c4d4;hb=7b18cc37b96e8c6866ee80964e5f623cdd999081;hp=bfdefbcaf515f2df9aa09d4100f1470ec69d0a63;hpb=cd7f9c8e3c396cff87e1393df835c5f5f9fb661f;p=openssl-gost%2Fengine.git diff --git a/gost_keyexpimp.c b/gost_keyexpimp.c index bfdefbc..ebd1fa1 100644 --- a/gost_keyexpimp.c +++ b/gost_keyexpimp.c @@ -82,14 +82,19 @@ int gost_kexp15(const unsigned char *shared_key, const int shared_len, return ret; } +/* + * Function expects that shared_key is a preallocated buffer + * with length defined as expkeylen - mac_len defined by mac_nid + * */ int gost_kimp15(const unsigned char *expkey, const size_t expkeylen, int cipher_nid, const unsigned char *cipher_key, int mac_nid, unsigned char *mac_key, const unsigned char *iv, const size_t ivlen, - unsigned char *shared_key, size_t shared_len) + unsigned char *shared_key) { unsigned char iv_full[16], out[48], mac_buf[16]; unsigned int mac_len; + const size_t shared_len = 32; EVP_CIPHER_CTX *ciph = NULL; EVP_MD_CTX *mac = NULL; @@ -312,7 +317,7 @@ int main(void) ret = gost_kimp15(magma_export, 40, NID_magma_ctr, magma_key, - NID_magma_mac, mac_magma_key, magma_iv, 4, buf, 32); + NID_magma_mac, mac_magma_key, magma_iv, 4, buf); if (ret <= 0) ERR_print_errors_fp(stderr);