Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions gost_gost2015.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ int gost2015_acpkm_omac_init(int nid, int enc, const unsigned char *inkey,
if (md == NULL)
return 0;

if (enc) {
if (RAND_bytes(kdf_seed, 8) != 1)
return 0;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так где сейчас берётся случайный IV?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (gost_kdftree2012_256(keys, 64, inkey, 32,
(const unsigned char *)"kdf tree", 8, kdf_seed, 8, 1) <= 0)
return 0;
Expand Down
29 changes: 21 additions & 8 deletions gost_grasshopper_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,31 +871,44 @@ static int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, v
}
}
return -1;
#if 0
case EVP_CTRL_AEAD_GET_TAG:
case EVP_CTRL_AEAD_SET_TAG:
{
int taglen = arg;
unsigned char *tag = ptr;

gost_grasshopper_cipher_ctx *c = EVP_CIPHER_CTX_get_cipher_data(ctx);
if (c->c.type != GRASSHOPPER_CIPHER_MGM)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MGM тоже нужен. Или этого #define не сохранилось?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот код был под #if 0

gost_grasshopper_cipher_ctx_ctr *c = EVP_CIPHER_CTX_get_cipher_data(ctx);
if (c->c.type != GRASSHOPPER_CIPHER_CTRACPKMOMAC)
return -1;

if (taglen > KUZNYECHIK_MAC_MAX_SIZE) {
CRYPTOCOMerr(CRYPTOCOM_F_GOST_GRASSHOPPER_CIPHER_CTL,
CRYPTOCOM_R_INVALID_TAG_LENGTH);
GOSTerr(GOST_F_GOST_GRASSHOPPER_CIPHER_CTL, GOST_R_BAD_MAC);
return -1;
}

if (type == EVP_CTRL_AEAD_GET_TAG)
memcpy(tag, c->final_tag, taglen);
memcpy(tag, c->tag, taglen);
else
memcpy(c->final_tag, tag, taglen);
memcpy(c->tag, tag, taglen);

return 1;
}
#endif
case EVP_CTRL_AEAD_TLS1_AAD: {
gost_grasshopper_cipher_ctx_ctr *c = EVP_CIPHER_CTX_get_cipher_data(ctx);
if (!ptr || c->c.type != GRASSHOPPER_CIPHER_CTRACPKMOMAC)
return -1;
if (arg != 0)
return 0;
*(int *) ptr = KUZNYECHIK_MAC_MAX_SIZE;
return 1;
}
case EVP_CTRL_PBE_PRF_NID: {
if (ptr) {
*((int *)ptr) = NID_id_tc26_hmac_gost_3411_2012_512;
return 1;
}
return 0;
}
case EVP_CTRL_PROCESS_UNPROTECTED:
{
STACK_OF(X509_ATTRIBUTE) *x = ptr;
Expand Down