Skip to content

Remove ENGINE initialization from provider startup #506

@VladGud

Description

@VladGud

Remove ENGINE initialization from provider startup

Issue Summary

Remove ENGINE initialization during provider initialization. Provider code must not depend on ENGINE registration.

Problem Description

The current GOST provider implementation creates and populates an internal ENGINE instance during provider startup in provider_ctx_new(). This ENGINE is used as a bridge to access legacy cryptographic implementations, but it creates unnecessary dependencies and complexity.

With the migration to direct provider-native implementations for ciphers, digests, and MACs (issues #116 and #117), the ENGINE layer becomes obsolete and should be removed entirely.

Current Implementation

  • PROV_CTX structure contains ENGINE *e field
  • provider_ctx_new() creates ENGINE_new() and calls populate_gost_engine(ctx->e)
  • populate_gost_engine() in gost_eng.c registers all ENGINE methods (digests, ciphers, pkey methods, etc.)
  • provider_ctx_free() calls ENGINE_free(ctx->e)

Required Changes

1. Remove ENGINE field from PROV_CTX

  • Remove ENGINE *e; from struct provider_ctx_st in gost_prov.h
  • Update all code that accesses ctx->e

2. Simplify provider context creation

  • Remove ENGINE creation and population from provider_ctx_new()
  • Remove populate_gost_engine() call
  • Simplify error handling in context creation

3. Update provider context cleanup

  • Remove ENGINE_free(ctx->e) from provider_ctx_free()

4. Preserve necessary initialization from populate_gost_engine

  • Move create_NIDs() call to provider initialization (NID creation is still needed for algorithm identification)
  • Evaluate if ENGINE control function (gost_control_func) needs to be preserved for provider parameter configuration

5. Remove ENGINE dependencies

Files to Modify

  • gost_prov.h: Remove ENGINE field from PROV_CTX
  • gost_prov.c: Update context creation and cleanup, add NID initialization
  • gost_eng.c: Extract create_NIDs() function for provider use

Dependencies

This task depends on completion of:

Acceptance Criteria

  • Provider initializes without creating ENGINE instance
  • PROV_CTX no longer contains ENGINE pointer
  • All cryptographic operations work through direct provider implementations
  • NID creation happens during provider initialization

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions