]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Making a gost provider - Refactor the engine to become a backend
authorRichard Levitte <richard@levitte.org>
Sun, 14 Feb 2021 23:45:40 +0000 (00:45 +0100)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Mon, 11 Oct 2021 16:34:09 +0000 (19:34 +0300)
The gost provider is planned to be a wrapper around the already
existing functionality, designed for ENGINE use.

The easiest way to do this is to let the gost ENGINE continue to exist
within the gost provider, as an internal ENGINE.  To do that, we make
it possible to build gost_eng.c so it only populates the GOST ENGINE
structure, but doesn't perform any of the ENGINE registration.  That
way, the GOST ENGINE structure becomes purely internal, and can be
used as the actual implementation of the offered provider functionality,
through diverse EVP calls that accept an ENGINE pointer.

gost_eng.c

index 92af15ed72daabf09114ca8da297a09f3f453fe3..006710cfa850c34cc9a01f0d896442ca88c7801f 100644 (file)
@@ -312,7 +312,9 @@ static int gost_engine_destroy(ENGINE* e) {
 
     free_cached_groups();
 
+# ifndef BUILDING_GOST_PROVIDER
     ERR_unload_GOST_strings();
+# endif
 
     return 1;
 }
@@ -322,7 +324,10 @@ static int gost_engine_destroy(ENGINE* e) {
  * binds it to OpenSSL libraries
  */
 
-static int populate_gost_engine(ENGINE* e) {
+# ifndef BUILDING_GOST_PROVIDER
+static
+# endif
+int populate_gost_engine(ENGINE* e) {
     int ret = 0;
 
     if (e == NULL)
@@ -391,6 +396,7 @@ static int populate_gost_engine(ENGINE* e) {
     return ret;
 }
 
+#ifndef BUILDING_GOST_PROVIDER
 static int bind_gost_engine(ENGINE* e) {
     int ret = 0;
 
@@ -454,7 +460,6 @@ IMPLEMENT_DYNAMIC_CHECK_FN()
  * it must manually call ENGINE_load_gost() for it to bind itself into the
  * libcrypto libraries.
  */
-
 void ENGINE_load_gost(void) {
     ENGINE* toadd;
     int ret = 0;
@@ -466,6 +471,6 @@ void ENGINE_load_gost(void) {
     if (ret > 0)
         ERR_clear_error();
 }
-
+#endif
 #endif
 /* vim: set expandtab cinoptions=\:0,l1,t0,g0,(0 sw=4 : */