@@ -1939,6 +1939,8 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
1939
1939
1940
1940
atfm = crypto_alloc_ahash (driver , type , mask );
1941
1941
if (IS_ERR (atfm )) {
1942
+ if (PTR_ERR (atfm ) == - ENOENT )
1943
+ return - ENOENT ;
1942
1944
pr_err ("alg: hash: failed to allocate transform for %s: %ld\n" ,
1943
1945
driver , PTR_ERR (atfm ));
1944
1946
return PTR_ERR (atfm );
@@ -2703,6 +2705,8 @@ static int alg_test_aead(const struct alg_test_desc *desc, const char *driver,
2703
2705
2704
2706
tfm = crypto_alloc_aead (driver , type , mask );
2705
2707
if (IS_ERR (tfm )) {
2708
+ if (PTR_ERR (tfm ) == - ENOENT )
2709
+ return - ENOENT ;
2706
2710
pr_err ("alg: aead: failed to allocate transform for %s: %ld\n" ,
2707
2711
driver , PTR_ERR (tfm ));
2708
2712
return PTR_ERR (tfm );
@@ -3280,6 +3284,8 @@ static int alg_test_skcipher(const struct alg_test_desc *desc,
3280
3284
3281
3285
tfm = crypto_alloc_skcipher (driver , type , mask );
3282
3286
if (IS_ERR (tfm )) {
3287
+ if (PTR_ERR (tfm ) == - ENOENT )
3288
+ return - ENOENT ;
3283
3289
pr_err ("alg: skcipher: failed to allocate transform for %s: %ld\n" ,
3284
3290
driver , PTR_ERR (tfm ));
3285
3291
return PTR_ERR (tfm );
@@ -3693,6 +3699,8 @@ static int alg_test_cipher(const struct alg_test_desc *desc,
3693
3699
3694
3700
tfm = crypto_alloc_cipher (driver , type , mask );
3695
3701
if (IS_ERR (tfm )) {
3702
+ if (PTR_ERR (tfm ) == - ENOENT )
3703
+ return - ENOENT ;
3696
3704
printk (KERN_ERR "alg: cipher: Failed to load transform for "
3697
3705
"%s: %ld\n" , driver , PTR_ERR (tfm ));
3698
3706
return PTR_ERR (tfm );
@@ -3717,6 +3725,8 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
3717
3725
if (algo_type == CRYPTO_ALG_TYPE_ACOMPRESS ) {
3718
3726
acomp = crypto_alloc_acomp (driver , type , mask );
3719
3727
if (IS_ERR (acomp )) {
3728
+ if (PTR_ERR (acomp ) == - ENOENT )
3729
+ return - ENOENT ;
3720
3730
pr_err ("alg: acomp: Failed to load transform for %s: %ld\n" ,
3721
3731
driver , PTR_ERR (acomp ));
3722
3732
return PTR_ERR (acomp );
@@ -3729,6 +3739,8 @@ static int alg_test_comp(const struct alg_test_desc *desc, const char *driver,
3729
3739
} else {
3730
3740
comp = crypto_alloc_comp (driver , type , mask );
3731
3741
if (IS_ERR (comp )) {
3742
+ if (PTR_ERR (comp ) == - ENOENT )
3743
+ return - ENOENT ;
3732
3744
pr_err ("alg: comp: Failed to load transform for %s: %ld\n" ,
3733
3745
driver , PTR_ERR (comp ));
3734
3746
return PTR_ERR (comp );
@@ -3805,6 +3817,8 @@ static int alg_test_cprng(const struct alg_test_desc *desc, const char *driver,
3805
3817
3806
3818
rng = crypto_alloc_rng (driver , type , mask );
3807
3819
if (IS_ERR (rng )) {
3820
+ if (PTR_ERR (rng ) == - ENOENT )
3821
+ return - ENOENT ;
3808
3822
printk (KERN_ERR "alg: cprng: Failed to load transform for %s: "
3809
3823
"%ld\n" , driver , PTR_ERR (rng ));
3810
3824
return PTR_ERR (rng );
@@ -3832,10 +3846,13 @@ static int drbg_cavs_test(const struct drbg_testvec *test, int pr,
3832
3846
3833
3847
drng = crypto_alloc_rng (driver , type , mask );
3834
3848
if (IS_ERR (drng )) {
3849
+ if (PTR_ERR (drng ) == - ENOENT )
3850
+ goto out_no_rng ;
3835
3851
printk (KERN_ERR "alg: drbg: could not allocate DRNG handle for "
3836
3852
"%s\n" , driver );
3853
+ out_no_rng :
3837
3854
kfree_sensitive (buf );
3838
- return - ENOMEM ;
3855
+ return PTR_ERR ( drng ) ;
3839
3856
}
3840
3857
3841
3858
test_data .testentropy = & testentropy ;
@@ -4077,6 +4094,8 @@ static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver,
4077
4094
4078
4095
tfm = crypto_alloc_kpp (driver , type , mask );
4079
4096
if (IS_ERR (tfm )) {
4097
+ if (PTR_ERR (tfm ) == - ENOENT )
4098
+ return - ENOENT ;
4080
4099
pr_err ("alg: kpp: Failed to load tfm for %s: %ld\n" ,
4081
4100
driver , PTR_ERR (tfm ));
4082
4101
return PTR_ERR (tfm );
@@ -4305,6 +4324,8 @@ static int alg_test_akcipher(const struct alg_test_desc *desc,
4305
4324
4306
4325
tfm = crypto_alloc_akcipher (driver , type , mask );
4307
4326
if (IS_ERR (tfm )) {
4327
+ if (PTR_ERR (tfm ) == - ENOENT )
4328
+ return - ENOENT ;
4308
4329
pr_err ("alg: akcipher: Failed to load tfm for %s: %ld\n" ,
4309
4330
driver , PTR_ERR (tfm ));
4310
4331
return PTR_ERR (tfm );
0 commit comments