From 15354bffd4128d1f6c6fd5a33d0c389d29024384 Mon Sep 17 00:00:00 2001 From: wuliaokanke Date: Mon, 16 Jan 2023 20:14:42 +0800 Subject: [PATCH] update kae engine --- kae_engine/README.md | 18 +++++++++--------- kae_engine/configure.ac | 2 +- kae_engine/docs/ReleaseNotes.md | 4 ++-- kae_engine/docs/maintenance.md | 2 +- kae_engine/src/Makefile.am | 2 +- kae_engine/src/uadk_cipher.c | 2 +- kae_engine/src/uadk_rsa.c | 24 ++++++++++++++---------- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/kae_engine/README.md b/kae_engine/README.md index aa80eb0..d44327a 100644 --- a/kae_engine/README.md +++ b/kae_engine/README.md @@ -3,9 +3,9 @@ OpenSSL engine for uadk - [Prerequisites](#prerequisites) - [Installation Instruction](#installation-instruction) - - [Build & Install OpenSSL](#build-&-install-openssl) - - [Build & Install UADK](#build-&-install-uadk) - - [Build & Install OpenSSL UADK engine](#build-&-install-openssl-uadk-engine) + - [Build and install OpenSSL](#build-and-install-openssl) + - [Build and install UADK](#build-and-install-uadk) + - [Build and install UADK engine](#build-and-install-uadk-engine) - [Testing](#testing) - [Install libraries to the temp folder](#Install-libraries-to-the-temp-folder) - [Environment variable of uadk engin](#Environment-variable-of-uadk-engine) @@ -20,7 +20,7 @@ Prerequisites Installation Instruction ======================== -Build & Install OpenSSL +Build and install OpenSSL ----------------------- ``` @@ -34,7 +34,7 @@ Build & Install OpenSSL openssl version ``` -Build & Install UADK +Build and install UADK -------------------- ``` @@ -49,11 +49,11 @@ Build & Install UADK * If get error:"cannot find -lnuma", please install the libnuma-dev * If get error:"fatal error: zlib.h: No such file or directory", please install zlib. -Build & Install OpenSSL UADK Engine +Build and install UADK Engine ----------------------------------- ``` - git clone https://github.com/Linaro/openssl-uadk.git - cd openssl-uadk + git clone https://github.com/Linaro/uadk_engine.git + cd uadk_engine autoreconf -i ./configure --libdir=/usr/local/lib/engines-1.1/ --enable-kae make @@ -92,7 +92,7 @@ Install libraries to the temp folder $ pkg-config libwd --libs -L/tmp/build/lib -lwd - $ cd openssl-uadk + $ cd uadk_engine $ autoreconf $ ./configure --prefix=/tmp/build $ make; make install diff --git a/kae_engine/configure.ac b/kae_engine/configure.ac index c31e099..502cc0c 100644 --- a/kae_engine/configure.ac +++ b/kae_engine/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.69]) -AC_INIT([openssl-uadk], [1.0.1]) +AC_INIT([uadk_engine], [1.1]) AC_CONFIG_SRCDIR([src/e_uadk.c]) AM_INIT_AUTOMAKE([1.10 no-define]) diff --git a/kae_engine/docs/ReleaseNotes.md b/kae_engine/docs/ReleaseNotes.md index f760db8..3041e69 100644 --- a/kae_engine/docs/ReleaseNotes.md +++ b/kae_engine/docs/ReleaseNotes.md @@ -1,5 +1,5 @@ -# UADK engine Release Pre v1.1 November 2022 +# UADK engine Release v1.1 December 2022 ## New Features @@ -41,5 +41,5 @@ ## Working combination -- UADK v2.3.28 +- UADK v2.4 - OpenSSL 1.1.1f diff --git a/kae_engine/docs/maintenance.md b/kae_engine/docs/maintenance.md index e4bcd3e..c0ade14 100644 --- a/kae_engine/docs/maintenance.md +++ b/kae_engine/docs/maintenance.md @@ -5,7 +5,7 @@ Clone UADK from [Github](https://github.com/Linaro/uadk). -Clone openssl-uadk from [Github](https://github.com/Linaro/openssl-uadk). +Clone uadk_engine from [Github](https://github.com/Linaro/uadk_engine). ## License diff --git a/kae_engine/src/Makefile.am b/kae_engine/src/Makefile.am index 9d53d9e..a26ed8d 100644 --- a/kae_engine/src/Makefile.am +++ b/kae_engine/src/Makefile.am @@ -1,4 +1,4 @@ -VERSION = 1:0:1 +VERSION = 1:1 ACLOCAL_AMFLAGS = -I m4 lib_LTLIBRARIES=kae.la diff --git a/kae_engine/src/uadk_cipher.c b/kae_engine/src/uadk_cipher.c index 59d8e2b..5e3cead 100644 --- a/kae_engine/src/uadk_cipher.c +++ b/kae_engine/src/uadk_cipher.c @@ -341,7 +341,7 @@ static int uadk_get_accel_platform(char *alg_name) { struct uacce_dev *dev; - dev = wd_get_accel_dev("cipher"); + dev = wd_get_accel_dev(alg_name); if (dev == NULL) return 0; diff --git a/kae_engine/src/uadk_rsa.c b/kae_engine/src/uadk_rsa.c index 96c898f..a1bb2cf 100644 --- a/kae_engine/src/uadk_rsa.c +++ b/kae_engine/src/uadk_rsa.c @@ -187,7 +187,7 @@ static int rsa_prime_mul_res(int num, struct rsa_prime_param *param, } static int check_rsa_prime_sufficient(int *num, const int *bitsr, - int *bitse, const int *n, + int *bitse, int * const n, struct rsa_prime_param *param, BN_CTX *ctx, BN_GENCB *cb) { @@ -230,7 +230,8 @@ static int check_rsa_prime_sufficient(int *num, const int *bitsr, else return -1; - ret = BN_GENCB_call(cb, GENCB_NEXT, *n++); + ret = BN_GENCB_call(cb, GENCB_NEXT, *n); + (*n)++; if (!ret) return -1; @@ -287,14 +288,15 @@ static int check_rsa_prime_equal(int num, BIGNUM *rsa_p, BIGNUM *rsa_q, return UADK_E_SUCCESS; } -static int check_rsa_prime_useful(const int *n, struct rsa_prime_param *param, +static int check_rsa_prime_useful(int * const n, struct rsa_prime_param *param, BIGNUM *e_pub, BN_CTX *ctx, BN_GENCB *cb) { unsigned long err; + int ret; /* - * BN_sub(r,a,b) substracts b from a and place the result in r, - * r = a-b. + * BN_sub(r, a, b) substracts b from a and place the result in r, + * r = a - b. * BN_value_one() returns a BIGNUM constant of value 1. * r2 = prime - 1. */ @@ -303,11 +305,11 @@ static int check_rsa_prime_useful(const int *n, struct rsa_prime_param *param, ERR_set_mark(); BN_set_flags(param->r2, BN_FLG_CONSTTIME); /* - * BN_mod_inverse(r,a,n,ctx) used to compute inverse modulo n. + * BN_mod_inverse(r, a, n, ctx) used to compute inverse modulo n. * Precisely, it computes the inverse of "a" modulo "n", and places - * the result in "r", which means (a * r) % n==1. + * the result in "r", which means (a * r) % n == 1. * If r == NULL, error. If r != NULL, success. - * The expected result: (r2 * r1) % e_pub ==1, + * The expected result: (r2 * r1) % e_pub == 1, * the inverse of r2 exist, that is r1. */ if (BN_mod_inverse(param->r1, param->r2, e_pub, ctx)) @@ -320,13 +322,15 @@ static int check_rsa_prime_useful(const int *n, struct rsa_prime_param *param, else return BN_ERR; - if (!BN_GENCB_call(cb, GENCB_NEXT, *n++)) + ret = BN_GENCB_call(cb, GENCB_NEXT, *n); + (*n)++; + if (!ret) return BN_ERR; return GET_ERR_FINISH; } -static int get_rsa_prime_once(int num, const int *bitsr, const int *n, +static int get_rsa_prime_once(int num, const int *bitsr, int * const n, BIGNUM *e_pub, struct rsa_prime_param *param, BN_CTX *ctx, BN_GENCB *cb) { -- Gitee