From 970934039a4481b67c9c6433e20ca3002098cae6 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Wed, 13 May 2020 04:41:13 +0300 Subject: [PATCH] Remove unneeded declarations after registration rework --- gost_crypt.c | 20 -------------------- gost_grasshopper_cipher.c | 1 + gost_grasshopper_cipher.h | 24 +----------------------- gost_lcl.h | 32 -------------------------------- gost_md.c | 10 ---------- gost_md2012.c | 20 -------------------- gost_omac.c | 20 -------------------- gost_omac_acpkm.c | 10 ---------- 8 files changed, 2 insertions(+), 135 deletions(-) diff --git a/gost_crypt.c b/gost_crypt.c index 66885bf..429bdd0 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -270,16 +270,6 @@ GOST_digest Gost28147_89_MAC_digest = { .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, @@ -294,16 +284,6 @@ GOST_digest Gost28147_89_mac_12_digest = { .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 diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c index 22d632d..22ca717 100644 --- a/gost_grasshopper_cipher.c +++ b/gost_grasshopper_cipher.c @@ -929,6 +929,7 @@ int gost_grasshopper_cipher_ctl(EVP_CIPHER_CTX *ctx, int type, int arg, void *pt 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); diff --git a/gost_grasshopper_cipher.h b/gost_grasshopper_cipher.h index f0ad7b3..202133c 100644 --- a/gost_grasshopper_cipher.h +++ b/gost_grasshopper_cipher.h @@ -35,14 +35,6 @@ typedef struct { 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); @@ -94,21 +86,7 @@ int gost_grasshopper_get_asn1_parameters(EVP_CIPHER_CTX* ctx, ASN1_TYPE* params) 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) } diff --git a/gost_lcl.h b/gost_lcl.h index bb441c6..6ca3297 100644 --- a/gost_lcl.h +++ b/gost_lcl.h @@ -194,25 +194,6 @@ struct ossl_gost_digest_ctx { 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; @@ -240,21 +221,8 @@ struct ossl_gost_imit_ctx { 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); diff --git a/gost_md.c b/gost_md.c index e440309..86714ab 100644 --- a/gost_md.c +++ b/gost_md.c @@ -78,16 +78,6 @@ void GOST_deinit_digest(GOST_digest *d) 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); diff --git a/gost_md2012.c b/gost_md2012.c index 2616abe..3ea1e36 100644 --- a/gost_md2012.c +++ b/gost_md2012.c @@ -47,16 +47,6 @@ GOST_digest GostR3411_2012_256_digest = { .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", @@ -66,16 +56,6 @@ GOST_digest GostR3411_2012_512_digest = { .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), diff --git a/gost_omac.c b/gost_omac.c index 57660a6..47ad760 100644 --- a/gost_omac.c +++ b/gost_omac.c @@ -277,23 +277,3 @@ GOST_digest grasshopper_mac_digest = { .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); -} diff --git a/gost_omac_acpkm.c b/gost_omac_acpkm.c index 1d9cdd1..93b9277 100644 --- a/gost_omac_acpkm.c +++ b/gost_omac_acpkm.c @@ -509,13 +509,3 @@ GOST_digest kuznyechik_ctracpkm_omac_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); -} -- 2.39.2