diff --git a/Identity.cpp b/Identity.cpp index b5b72c43..a23185ed 100644 --- a/Identity.cpp +++ b/Identity.cpp @@ -102,7 +102,7 @@ namespace data memcpy (m_StandardIdentity.signingKey + padding, signingKey, i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH); break; } - case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_GOSTR3411: + case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_SHA256: case SIGNING_KEY_TYPE_GOSTR3410_2012_TC26_A_256_GOSTR3411: { // 256 @@ -386,7 +386,7 @@ namespace data UpdateVerifier (new i2p::crypto::EDDSA25519Verifier (m_StandardIdentity.signingKey + padding)); break; } - case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_GOSTR3411: + case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_SHA256 : { size_t padding = 128 - i2p::crypto::GOSTR3410_256_PUBLIC_KEY_LENGTH; // 64 = 128 - 64 UpdateVerifier (new i2p::crypto::GOSTR3410_2001_Verifier (i2p::crypto::eGOSTR3410CryptoProA, m_StandardIdentity.signingKey + padding)); @@ -545,7 +545,7 @@ namespace data case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: m_Signer.reset (new i2p::crypto::EDDSA25519Signer (m_SigningPrivateKey, m_Public->GetStandardIdentity ().certificate - i2p::crypto::EDDSA25519_PUBLIC_KEY_LENGTH)); break; - case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_GOSTR3411: + case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_SHA256: m_Signer.reset (new i2p::crypto::GOSTR3410_2001_Signer (i2p::crypto::eGOSTR3410CryptoProA, m_SigningPrivateKey)); break; case SIGNING_KEY_TYPE_GOSTR3410_2012_TC26_A_256_GOSTR3411: @@ -589,7 +589,7 @@ namespace data case SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: i2p::crypto::CreateEDDSA25519RandomKeys (keys.m_SigningPrivateKey, signingPublicKey); break; - case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_GOSTR3411: + case SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_SHA256: i2p::crypto::CreateGOSTR3410RandomKeys (i2p::crypto::eGOSTR3410CryptoProA, keys.m_SigningPrivateKey, signingPublicKey); break; case SIGNING_KEY_TYPE_GOSTR3410_2012_TC26_A_256_GOSTR3411: diff --git a/Identity.h b/Identity.h index 1c3c8c18..40a09d59 100644 --- a/Identity.h +++ b/Identity.h @@ -61,9 +61,9 @@ namespace data const uint16_t SIGNING_KEY_TYPE_RSA_SHA512_4096 = 6; const uint16_t SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519 = 7; // following signature type should never appear in netid=2 - const uint16_t SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_GOSTR3411 = 65280; // approved by FSB + const uint16_t SIGNING_KEY_TYPE_GOSTR3410_2001_CRYPTO_PRO_A_SHA256 = 65280; const uint16_t SIGNING_KEY_TYPE_GOSTR3410_2012_TC26_A_256_GOSTR3411 = 65281; - const uint16_t SIGNING_KEY_TYPE_GOSTR3410_2012_TC26_A_512_GOSTR3411 = 65282; + const uint16_t SIGNING_KEY_TYPE_GOSTR3410_2012_TC26_A_512_GOSTR3411 = 65282; // approved by FSB typedef uint16_t SigningKeyType; typedef uint16_t CryptoKeyType; diff --git a/Signature.h b/Signature.h index aee8c487..b6fef1ba 100644 --- a/Signature.h +++ b/Signature.h @@ -444,22 +444,12 @@ namespace crypto } - // ГОСТ Р 34.11 - struct GOSTR3411_2001_Hash - { - static void CalculateHash (const uint8_t * buf, size_t len, uint8_t * digest) - { - SHA256 (buf, len, digest); // TODO: implement GOST R 34.11 - 2001 - } - - enum { hashLen = 32 }; - }; - + // ГОСТ Р 34.11 struct GOSTR3411_2012_256_Hash { static void CalculateHash (const uint8_t * buf, size_t len, uint8_t * digest) { - SHA256 (buf, len, digest); // TODO: implement GOST R 34.11 - 2012 + GOSTR3411_2012_256 (buf, len, digest); } enum { hashLen = 32 }; @@ -469,7 +459,7 @@ namespace crypto { static void CalculateHash (const uint8_t * buf, size_t len, uint8_t * digest) { - SHA512 (buf, len, digest); // TODO: implement GOST R 34.11 - 2012 + GOSTR3411_2012_512 (buf, len, digest); } enum { hashLen = 64 }; @@ -566,8 +556,8 @@ namespace crypto BN_free (x); BN_free (y); } - typedef GOSTR3410Verifier GOSTR3410_2001_Verifier; - typedef GOSTR3410Signer GOSTR3410_2001_Signer; + typedef GOSTR3410Verifier GOSTR3410_2001_Verifier; + typedef GOSTR3410Signer GOSTR3410_2001_Signer; typedef GOSTR3410Verifier GOSTR3410_2012_256_Verifier; typedef GOSTR3410Signer GOSTR3410_2012_256_Signer; typedef GOSTR3410Verifier GOSTR3410_2012_512_Verifier;