.ctrl = gost_imit_ctrl,
};
-EVP_MD *imit_gost_cpa(void)
-{
- return GOST_init_digest(&Gost28147_89_MAC_digest);
-}
-
-void imit_gost_cpa_destroy(void)
-{
- GOST_deinit_digest(&Gost28147_89_MAC_digest);
-}
-
GOST_digest Gost28147_89_mac_12_digest = {
.nid = NID_gost_mac_12,
.result_size = 4,
.ctrl = gost_imit_ctrl,
};
-EVP_MD *imit_gost_cp_12(void)
-{
- return GOST_init_digest(&Gost28147_89_mac_12_digest);
-}
-
-void imit_gost_cp_12_destroy(void)
-{
- GOST_deinit_digest(&Gost28147_89_mac_12_digest);
-}
-
/*
* Correspondence between gost parameter OIDs and substitution blocks
* NID field is filed by register_gost_NID function in engine.c
return 1;
}
+/* Called directly by CMAC_ACPKM_Init() */
const GRASSHOPPER_INLINE EVP_CIPHER *cipher_gost_grasshopper_ctracpkm()
{
return GOST_init_cipher(&grasshopper_ctr_acpkm_cipher);
EVP_MD_CTX *omac_ctx;
} gost_grasshopper_cipher_ctx_ctr;
-typedef int (* grasshopper_init_cipher_func)(EVP_CIPHER_CTX* ctx, const unsigned char* key, const unsigned char* iv,
- int enc);
-
-typedef int (* grasshopper_do_cipher_func)(EVP_CIPHER_CTX* ctx, unsigned char* out, const unsigned char* in,
- size_t inl);
-
-typedef void (* grasshopper_destroy_cipher_func)(gost_grasshopper_cipher_ctx* c);
-
void gost_grasshopper_cipher_key(gost_grasshopper_cipher_ctx* c, const uint8_t* k);
void gost_grasshopper_cipher_destroy(gost_grasshopper_cipher_ctx* c);
int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX* ctx, int type, int arg, void* ptr);
-EVP_CIPHER* cipher_gost_grasshopper_create(int cipher_type, int block_size);
-
-const int cipher_gost_grasshopper_setup(EVP_CIPHER* cipher, uint8_t mode, int iv_size, bool padding, int extra_flags);
-
-const EVP_CIPHER* cipher_gost_grasshopper(uint8_t mode, uint8_t num);
-
-extern const EVP_CIPHER* cipher_gost_grasshopper_ecb();
-extern const EVP_CIPHER* cipher_gost_grasshopper_cbc();
-extern const EVP_CIPHER* cipher_gost_grasshopper_ofb();
-extern const EVP_CIPHER* cipher_gost_grasshopper_cfb();
-extern const EVP_CIPHER* cipher_gost_grasshopper_ctr();
-extern const EVP_CIPHER* cipher_gost_grasshopper_ctracpkm();
-extern const EVP_CIPHER* cipher_gost_grasshopper_ctracpkm_omac();
-
-void cipher_gost_grasshopper_destroy(void);
+const EVP_CIPHER* cipher_gost_grasshopper_ctracpkm();
#if defined(__cplusplus)
}
gost_hash_ctx dctx;
gost_ctx cctx;
};
-/* EVP_MD structure for GOST R 34.11 */
-EVP_MD *digest_gost(void);
-void digest_gost_destroy(void);
-/* EVP MD structure for GOST R 34.11-2012 algorithms */
-EVP_MD *digest_gost2012_256(void);
-EVP_MD *digest_gost2012_512(void);
-void digest_gost2012_256_destroy(void);
-void digest_gost2012_512_destroy(void);
-/* EVP_MD structure for GOST 28147 in MAC mode */
-EVP_MD *imit_gost_cpa(void);
-void imit_gost_cpa_destroy(void);
-EVP_MD *imit_gost_cp_12(void);
-void imit_gost_cp_12_destroy(void);
-EVP_MD *magma_omac(void);
-void magma_omac_destroy(void);
-EVP_MD *grasshopper_omac(void);
-EVP_MD *grasshopper_omac_acpkm(void);
-void grasshopper_omac_destroy(void);
-void grasshopper_omac_acpkm_destroy(void);
/* Cipher context used for EVP_CIPHER operation */
struct ossl_gost_cipher_ctx {
int paramNID;
int key_set;
int dgst_size;
};
-/* Table which maps parameter NID to S-blocks */
-extern struct gost_cipher_info gost_cipher_list[];
/* Find encryption params from ASN1_OBJECT */
const struct gost_cipher_info *get_encryption_params(ASN1_OBJECT *obj);
-/* Implementation of GOST 28147-89 cipher in CFB and CNT modes */
-const EVP_CIPHER *cipher_gost_cpacnt();
-const EVP_CIPHER *cipher_gost_cpcnt_12();
-const EVP_CIPHER *cipher_magma_cbc();
-const EVP_CIPHER *cipher_magma_ctr();
-const EVP_CIPHER *cipher_magma_ctr_acpkm();
-const EVP_CIPHER *cipher_magma_ctr_acpkm_omac();
-const EVP_CIPHER *cipher_magma_wrap();
-const EVP_CIPHER *cipher_kuznyechik_wrap();
-void cipher_gost_destroy();
-void wrap_ciphers_destroy();
void inc_counter(unsigned char *counter, size_t counter_bytes);
d->digest = NULL;
}
-EVP_MD *digest_gost(void)
-{
- return GOST_init_digest(&GostR3411_94_digest);
-}
-
-void digest_gost_destroy(void)
-{
- GOST_deinit_digest(&GostR3411_94_digest);
-}
-
int gost_digest_init(EVP_MD_CTX *ctx)
{
struct ossl_gost_digest_ctx *c = EVP_MD_CTX_md_data(ctx);
.ctrl = gost_digest_ctrl_256,
};
-EVP_MD *digest_gost2012_256(void)
-{
- return GOST_init_digest(&GostR3411_2012_256_digest);
-}
-
-void digest_gost2012_256_destroy(void)
-{
- GOST_deinit_digest(&GostR3411_2012_256_digest);
-}
-
GOST_digest GostR3411_2012_512_digest = {
.nid = NID_id_GostR3411_2012_512,
.alias = "streebog512",
.ctrl = gost_digest_ctrl_512,
};
-EVP_MD *digest_gost2012_512(void)
-{
- return GOST_init_digest(&GostR3411_2012_512_digest);
-}
-
-void digest_gost2012_512_destroy(void)
-{
- GOST_deinit_digest(&GostR3411_2012_512_digest);
-}
-
static int gost_digest_init512(EVP_MD_CTX *ctx)
{
init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx),
.result_size = 16,
.init = grasshopper_imit_init,
};
-
-EVP_MD *magma_omac(void)
-{
- return GOST_init_digest(&magma_mac_digest);
-}
-
-void magma_omac_destroy(void)
-{
- GOST_deinit_digest(&magma_mac_digest);
-}
-
-EVP_MD *grasshopper_omac(void)
-{
- return GOST_init_digest(&grasshopper_mac_digest);
-}
-
-void grasshopper_omac_destroy(void)
-{
- GOST_deinit_digest(&grasshopper_mac_digest);
-}
.cleanup = omac_acpkm_imit_cleanup,
.ctrl = omac_acpkm_imit_ctrl,
};
-
-EVP_MD *grasshopper_omac_acpkm(void)
-{
- return GOST_init_digest(&kuznyechik_ctracpkm_omac_digest);
-}
-
-void grasshopper_omac_acpkm_destroy(void)
-{
- GOST_deinit_digest(&kuznyechik_ctracpkm_omac_digest);
-}