/dev/crypto removal (2/3): remove kernel support
this removes /dev/crypto device interface and public key functionality that is only usable via /dev/crypto. OK? diff --git sys/conf/files sys/conf/files index 3941639..9af78cc 100644 --- sys/conf/files +++ sys/conf/files @@ -870,11 +870,10 @@ file crypto/blf.c (inet ipsec) | crypto | vnd file crypto/cast.c (inet ipsec) | crypto file crypto/ecb_enc.c (inet ipsec) | crypto file crypto/set_key.c (inet ipsec) | crypto file crypto/ecb3_enc.c (inet ipsec) | crypto file crypto/crypto.c (inet ipsec) | crypto -file crypto/cryptodev.c((inet ipsec) | crypto) needs-flag file crypto/criov.c(inet ipsec) | crypto file crypto/cryptosoft.c (inet ipsec) | crypto file crypto/xform.c(inet ipsec) | crypto file crypto/xform_ipcomp.c (inet ipsec) | crypto file crypto/arc4.c diff --git sys/crypto/crypto.c sys/crypto/crypto.c index f62752d..4a11ae3 100644 --- sys/crypto/crypto.c +++ sys/crypto/crypto.c @@ -280,39 +280,10 @@ crypto_get_driverid(u_int8_t flags) /* * Register a crypto driver. It should be called once for each algorithm * supported by the driver. */ int -crypto_kregister(u_int32_t driverid, int *kalg, -int (*kprocess)(struct cryptkop *)) -{ - int s, i; - - if (driverid = crypto_drivers_num || kalg == NULL || - crypto_drivers == NULL) - return EINVAL; - - s = splvm(); - - for (i = 0; i = CRK_ALGORITHM_MAX; i++) { - /* -* XXX Do some performance testing to determine -* placing. We probably need an auxiliary data -* structure that describes relative performances. -*/ - - crypto_drivers[driverid].cc_kalg[i] = kalg[i]; - } - - crypto_drivers[driverid].cc_kprocess = kprocess; - - splx(s); - return 0; -} - -/* Register a crypto driver. */ -int crypto_register(u_int32_t driverid, int *alg, int (*newses)(u_int32_t *, struct cryptoini *), int (*freeses)(u_int64_t), int (*process)(struct cryptop *)) { int s, i; @@ -410,71 +381,10 @@ crypto_dispatch(struct cryptop *crp) } return 0; } -int -crypto_kdispatch(struct cryptkop *krp) -{ - if (crypto_taskq) { - task_set(krp-krp_task, (void (*))crypto_kinvoke, krp, NULL); - task_add(crypto_taskq, krp-krp_task); - } else { - crypto_kinvoke(krp); - } - - return 0; -} - -/* - * Dispatch an asymmetric crypto request to the appropriate crypto devices. - */ -int -crypto_kinvoke(struct cryptkop *krp) -{ - extern int cryptodevallowsoft; - u_int32_t hid; - int error; - int s; - - /* Sanity checks. */ - if (krp == NULL || krp-krp_callback == NULL) - return (EINVAL); - - s = splvm(); - for (hid = 0; hid crypto_drivers_num; hid++) { - if ((crypto_drivers[hid].cc_flags CRYPTOCAP_F_SOFTWARE) - cryptodevallowsoft == 0) - continue; - if (crypto_drivers[hid].cc_kprocess == NULL) - continue; - if ((crypto_drivers[hid].cc_kalg[krp-krp_op] - CRYPTO_ALG_FLAG_SUPPORTED) == 0) - continue; - break; - } - - if (hid == crypto_drivers_num) { - krp-krp_status = ENODEV; - crypto_kdone(krp); - splx(s); - return (0); - } - - krp-krp_hid = hid; - - crypto_drivers[hid].cc_koperations++; - - error = crypto_drivers[hid].cc_kprocess(krp); - if (error) { - krp-krp_status = error; - crypto_kdone(krp); - } - splx(s); - return (0); -} - /* * Dispatch a crypto request to the appropriate crypto devices. */ int crypto_invoke(struct cryptop *crp) @@ -624,40 +534,5 @@ crypto_done(struct cryptop *crp) task_set(crp-crp_task, (void (*))crp-crp_callback, crp, NULL); task_add(crypto_taskq, crp-crp_task); } } - -/* - * Invoke the callback on behalf of the driver. - */ -void -crypto_kdone(struct cryptkop *krp) -{ - task_set(krp-krp_task, (void (*))krp-krp_callback, krp, NULL); - task_add(crypto_taskq, krp-krp_task); -} - -int -crypto_getfeat(int *featp) -{ - extern int cryptodevallowsoft, userasymcrypto; - int hid, kalg, feat = 0; - - if (userasymcrypto == 0) - goto out; - for (hid = 0; hid crypto_drivers_num; hid++) { - if ((crypto_drivers[hid].cc_flags CRYPTOCAP_F_SOFTWARE) - cryptodevallowsoft == 0) { - continue; - } - if
Re: /dev/crypto removal (2/3): remove kernel support
On Mon, Aug 18, 2014 at 16:03 +0200, Mike Belopuhov wrote: this removes /dev/crypto device interface and public key functionality that is only usable via /dev/crypto. OK? minor correction: preserve #ifdef _KERNEL in the cryptodev.h. while there are no userland programs including it atm leaving it for the symmetry with cryptosoft.c seems like a good idea. diff --git sys/conf/files sys/conf/files index 3941639..9af78cc 100644 --- sys/conf/files +++ sys/conf/files @@ -870,11 +870,10 @@ file crypto/blf.c (inet ipsec) | crypto | vnd file crypto/cast.c (inet ipsec) | crypto file crypto/ecb_enc.c (inet ipsec) | crypto file crypto/set_key.c (inet ipsec) | crypto file crypto/ecb3_enc.c (inet ipsec) | crypto file crypto/crypto.c (inet ipsec) | crypto -file crypto/cryptodev.c((inet ipsec) | crypto) needs-flag file crypto/criov.c(inet ipsec) | crypto file crypto/cryptosoft.c (inet ipsec) | crypto file crypto/xform.c(inet ipsec) | crypto file crypto/xform_ipcomp.c (inet ipsec) | crypto file crypto/arc4.c diff --git sys/crypto/crypto.c sys/crypto/crypto.c index f62752d..4a11ae3 100644 --- sys/crypto/crypto.c +++ sys/crypto/crypto.c @@ -280,39 +280,10 @@ crypto_get_driverid(u_int8_t flags) /* * Register a crypto driver. It should be called once for each algorithm * supported by the driver. */ int -crypto_kregister(u_int32_t driverid, int *kalg, -int (*kprocess)(struct cryptkop *)) -{ - int s, i; - - if (driverid = crypto_drivers_num || kalg == NULL || - crypto_drivers == NULL) - return EINVAL; - - s = splvm(); - - for (i = 0; i = CRK_ALGORITHM_MAX; i++) { - /* -* XXX Do some performance testing to determine -* placing. We probably need an auxiliary data -* structure that describes relative performances. -*/ - - crypto_drivers[driverid].cc_kalg[i] = kalg[i]; - } - - crypto_drivers[driverid].cc_kprocess = kprocess; - - splx(s); - return 0; -} - -/* Register a crypto driver. */ -int crypto_register(u_int32_t driverid, int *alg, int (*newses)(u_int32_t *, struct cryptoini *), int (*freeses)(u_int64_t), int (*process)(struct cryptop *)) { int s, i; @@ -410,71 +381,10 @@ crypto_dispatch(struct cryptop *crp) } return 0; } -int -crypto_kdispatch(struct cryptkop *krp) -{ - if (crypto_taskq) { - task_set(krp-krp_task, (void (*))crypto_kinvoke, krp, NULL); - task_add(crypto_taskq, krp-krp_task); - } else { - crypto_kinvoke(krp); - } - - return 0; -} - -/* - * Dispatch an asymmetric crypto request to the appropriate crypto devices. - */ -int -crypto_kinvoke(struct cryptkop *krp) -{ - extern int cryptodevallowsoft; - u_int32_t hid; - int error; - int s; - - /* Sanity checks. */ - if (krp == NULL || krp-krp_callback == NULL) - return (EINVAL); - - s = splvm(); - for (hid = 0; hid crypto_drivers_num; hid++) { - if ((crypto_drivers[hid].cc_flags CRYPTOCAP_F_SOFTWARE) - cryptodevallowsoft == 0) - continue; - if (crypto_drivers[hid].cc_kprocess == NULL) - continue; - if ((crypto_drivers[hid].cc_kalg[krp-krp_op] - CRYPTO_ALG_FLAG_SUPPORTED) == 0) - continue; - break; - } - - if (hid == crypto_drivers_num) { - krp-krp_status = ENODEV; - crypto_kdone(krp); - splx(s); - return (0); - } - - krp-krp_hid = hid; - - crypto_drivers[hid].cc_koperations++; - - error = crypto_drivers[hid].cc_kprocess(krp); - if (error) { - krp-krp_status = error; - crypto_kdone(krp); - } - splx(s); - return (0); -} - /* * Dispatch a crypto request to the appropriate crypto devices. */ int crypto_invoke(struct cryptop *crp) @@ -624,40 +534,5 @@ crypto_done(struct cryptop *crp) task_set(crp-crp_task, (void (*))crp-crp_callback, crp, NULL); task_add(crypto_taskq, crp-crp_task); } } - -/* - * Invoke the callback on behalf of the driver. - */ -void -crypto_kdone(struct cryptkop *krp) -{ - task_set(krp-krp_task, (void (*))krp-krp_callback, krp, NULL); - task_add(crypto_taskq, krp-krp_task); -} - -int -crypto_getfeat(int *featp) -{ - extern int cryptodevallowsoft, userasymcrypto; - int hid, kalg, feat = 0; - - if (userasymcrypto == 0) - goto out; - for (hid =