Fix: RC4 doesn't support block cipher modes
authorDariusz Michaluk <d.michaluk@samsung.com>
Thu, 14 Jul 2016 08:48:11 +0000 (10:48 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Thu, 14 Jul 2016 11:29:26 +0000 (13:29 +0200)
Change-Id: Iab022f1791712e0670a02ab2262e03fc0b79c365

src/encrypt.c

index a9f097a..1c00abf 100644 (file)
@@ -289,7 +289,10 @@ int encrypt_get_algorithm(yaca_encrypt_algorithm_e algo,
                                       algo_name, bcm_name);
                break;
        case YACA_ENCRYPT_UNSAFE_RC4:
-               ret = snprintf(cipher_name, sizeof(cipher_name), "%s", algo_name);
+               if (bcm != YACA_BCM_NONE)
+                       ret = YACA_ERROR_INVALID_PARAMETER;
+               else
+                       ret = snprintf(cipher_name, sizeof(cipher_name), "%s", algo_name);
                break;
        default:
                return YACA_ERROR_INVALID_PARAMETER;