diff options
author | deraadt <> | 2002-06-11 16:21:26 +0000 |
---|---|---|
committer | deraadt <> | 2002-06-11 16:21:26 +0000 |
commit | 9786c374f07e9e37fbda76ceae248529a5fbaabc (patch) | |
tree | 3822f129bbbd65a96d7a8b024997b46c2460a7e6 /src | |
parent | 14da1a4449f342ed1a6e07d2c7f91244e782fee6 (diff) | |
download | openbsd-9786c374f07e9e37fbda76ceae248529a5fbaabc.tar.gz openbsd-9786c374f07e9e37fbda76ceae248529a5fbaabc.tar.bz2 openbsd-9786c374f07e9e37fbda76ceae248529a5fbaabc.zip |
KNF
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/engine/hw_cryptodev.c | 35 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/engine/hw_cryptodev.c | 35 |
2 files changed, 32 insertions, 38 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c index 44ac38179f..d58c25ae9a 100644 --- a/src/lib/libcrypto/engine/hw_cryptodev.c +++ b/src/lib/libcrypto/engine/hw_cryptodev.c | |||
@@ -86,7 +86,7 @@ static struct { | |||
86 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | 86 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, |
87 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, | 87 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, |
88 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | 88 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, |
89 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, | 89 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, |
90 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, | 90 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, |
91 | { CRYPTO_ARC4, NID_rc4, 8, 16, }, | 91 | { CRYPTO_ARC4, NID_rc4, 8, 16, }, |
92 | { 0, NID_undef, 0, 0, }, | 92 | { 0, NID_undef, 0, 0, }, |
@@ -265,7 +265,7 @@ int | |||
265 | cryptodev_usable_ciphers(const int **nids) | 265 | cryptodev_usable_ciphers(const int **nids) |
266 | { | 266 | { |
267 | struct syslog_data sd = SYSLOG_DATA_INIT; | 267 | struct syslog_data sd = SYSLOG_DATA_INIT; |
268 | 268 | ||
269 | if (!check_dev_crypto()) { | 269 | if (!check_dev_crypto()) { |
270 | *nids = NULL; | 270 | *nids = NULL; |
271 | return (0); | 271 | return (0); |
@@ -283,7 +283,6 @@ cryptodev_usable_ciphers(const int **nids) | |||
283 | if (ioctl(cryptodev_fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | 283 | if (ioctl(cryptodev_fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { |
284 | syslog_r(LOG_ERR, &sd, "CIOCASYMFEAT failed (%m)"); | 284 | syslog_r(LOG_ERR, &sd, "CIOCASYMFEAT failed (%m)"); |
285 | } | 285 | } |
286 | |||
287 | } | 286 | } |
288 | 287 | ||
289 | int | 288 | int |
@@ -682,7 +681,7 @@ cryptodev_sym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s) | |||
682 | if (s) | 681 | if (s) |
683 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); | 682 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); |
684 | ret = 0; | 683 | ret = 0; |
685 | } | 684 | } |
686 | return (ret); | 685 | return (ret); |
687 | } | 686 | } |
688 | 687 | ||
@@ -701,7 +700,6 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
701 | return (ret); | 700 | return (ret); |
702 | } | 701 | } |
703 | 702 | ||
704 | |||
705 | memset(&kop, 0, sizeof kop); | 703 | memset(&kop, 0, sizeof kop); |
706 | kop.crk_op = CRK_MOD_EXP; | 704 | kop.crk_op = CRK_MOD_EXP; |
707 | 705 | ||
@@ -802,12 +800,12 @@ cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | |||
802 | { | 800 | { |
803 | BIGNUM t2; | 801 | BIGNUM t2; |
804 | int ret = 0; | 802 | int ret = 0; |
805 | 803 | ||
806 | BN_init(&t2); | 804 | BN_init(&t2); |
807 | 805 | ||
808 | /* v = ( g^u1 * y^u2 mod p ) mod q */ | 806 | /* v = ( g^u1 * y^u2 mod p ) mod q */ |
809 | /* let t1 = g ^ u1 mod p */ | 807 | /* let t1 = g ^ u1 mod p */ |
810 | ret = 0; | 808 | ret = 0; |
811 | 809 | ||
812 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) | 810 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) |
813 | goto err; | 811 | goto err; |
@@ -1015,7 +1013,7 @@ ENGINE_load_cryptodev(void) | |||
1015 | if (!check_dev_crypto()) { | 1013 | if (!check_dev_crypto()) { |
1016 | return; | 1014 | return; |
1017 | } | 1015 | } |
1018 | 1016 | ||
1019 | /* | 1017 | /* |
1020 | * find out what asymmetric crypto algorithms we support | 1018 | * find out what asymmetric crypto algorithms we support |
1021 | */ | 1019 | */ |
@@ -1046,7 +1044,7 @@ ENGINE_load_cryptodev(void) | |||
1046 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | 1044 | if (cryptodev_asymfeat & CRF_MOD_EXP) { |
1047 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; | 1045 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; |
1048 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) | 1046 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) |
1049 | cryptodev_rsa.rsa_mod_exp = | 1047 | cryptodev_rsa.rsa_mod_exp = |
1050 | cryptodev_rsa_mod_exp; | 1048 | cryptodev_rsa_mod_exp; |
1051 | else | 1049 | else |
1052 | cryptodev_rsa.rsa_mod_exp = | 1050 | cryptodev_rsa.rsa_mod_exp = |
@@ -1056,18 +1054,17 @@ ENGINE_load_cryptodev(void) | |||
1056 | 1054 | ||
1057 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { | 1055 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { |
1058 | const DSA_METHOD *meth = DSA_OpenSSL(); | 1056 | const DSA_METHOD *meth = DSA_OpenSSL(); |
1059 | 1057 | ||
1060 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); | 1058 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); |
1061 | if (cryptodev_asymfeat & CRF_DSA_SIGN) | 1059 | if (cryptodev_asymfeat & CRF_DSA_SIGN) |
1062 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; | 1060 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; |
1063 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | 1061 | if (cryptodev_asymfeat & CRF_MOD_EXP) { |
1064 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; | 1062 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; |
1065 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; | 1063 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; |
1066 | } | 1064 | } |
1067 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) | 1065 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) |
1068 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; | 1066 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; |
1069 | } | 1067 | } |
1070 | |||
1071 | 1068 | ||
1072 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ | 1069 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ |
1073 | const DH_METHOD *dh_meth = DH_OpenSSL(); | 1070 | const DH_METHOD *dh_meth = DH_OpenSSL(); |
@@ -1082,7 +1079,7 @@ ENGINE_load_cryptodev(void) | |||
1082 | cryptodev_dh_compute_key; | 1079 | cryptodev_dh_compute_key; |
1083 | } | 1080 | } |
1084 | } | 1081 | } |
1085 | 1082 | ||
1086 | ENGINE_add(engine); | 1083 | ENGINE_add(engine); |
1087 | ENGINE_free(engine); | 1084 | ENGINE_free(engine); |
1088 | ERR_clear_error(); | 1085 | ERR_clear_error(); |
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c index 44ac38179f..d58c25ae9a 100644 --- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c +++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c | |||
@@ -86,7 +86,7 @@ static struct { | |||
86 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, | 86 | { CRYPTO_3DES_CBC, NID_des_ede3_cbc, 8, 24, }, |
87 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, | 87 | { CRYPTO_AES_CBC, NID_aes_128_cbc, 16, 16, }, |
88 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, | 88 | { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, }, |
89 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, | 89 | { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, }, |
90 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, | 90 | { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, }, |
91 | { CRYPTO_ARC4, NID_rc4, 8, 16, }, | 91 | { CRYPTO_ARC4, NID_rc4, 8, 16, }, |
92 | { 0, NID_undef, 0, 0, }, | 92 | { 0, NID_undef, 0, 0, }, |
@@ -265,7 +265,7 @@ int | |||
265 | cryptodev_usable_ciphers(const int **nids) | 265 | cryptodev_usable_ciphers(const int **nids) |
266 | { | 266 | { |
267 | struct syslog_data sd = SYSLOG_DATA_INIT; | 267 | struct syslog_data sd = SYSLOG_DATA_INIT; |
268 | 268 | ||
269 | if (!check_dev_crypto()) { | 269 | if (!check_dev_crypto()) { |
270 | *nids = NULL; | 270 | *nids = NULL; |
271 | return (0); | 271 | return (0); |
@@ -283,7 +283,6 @@ cryptodev_usable_ciphers(const int **nids) | |||
283 | if (ioctl(cryptodev_fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { | 283 | if (ioctl(cryptodev_fd, CIOCASYMFEAT, &cryptodev_asymfeat) == -1) { |
284 | syslog_r(LOG_ERR, &sd, "CIOCASYMFEAT failed (%m)"); | 284 | syslog_r(LOG_ERR, &sd, "CIOCASYMFEAT failed (%m)"); |
285 | } | 285 | } |
286 | |||
287 | } | 286 | } |
288 | 287 | ||
289 | int | 288 | int |
@@ -682,7 +681,7 @@ cryptodev_sym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, BIGNUM *s) | |||
682 | if (s) | 681 | if (s) |
683 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); | 682 | crparam2bn(&kop->crk_param[kop->crk_iparams+1], s); |
684 | ret = 0; | 683 | ret = 0; |
685 | } | 684 | } |
686 | return (ret); | 685 | return (ret); |
687 | } | 686 | } |
688 | 687 | ||
@@ -701,7 +700,6 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | |||
701 | return (ret); | 700 | return (ret); |
702 | } | 701 | } |
703 | 702 | ||
704 | |||
705 | memset(&kop, 0, sizeof kop); | 703 | memset(&kop, 0, sizeof kop); |
706 | kop.crk_op = CRK_MOD_EXP; | 704 | kop.crk_op = CRK_MOD_EXP; |
707 | 705 | ||
@@ -802,12 +800,12 @@ cryptodev_dsa_dsa_mod_exp(DSA *dsa, BIGNUM *t1, BIGNUM *g, | |||
802 | { | 800 | { |
803 | BIGNUM t2; | 801 | BIGNUM t2; |
804 | int ret = 0; | 802 | int ret = 0; |
805 | 803 | ||
806 | BN_init(&t2); | 804 | BN_init(&t2); |
807 | 805 | ||
808 | /* v = ( g^u1 * y^u2 mod p ) mod q */ | 806 | /* v = ( g^u1 * y^u2 mod p ) mod q */ |
809 | /* let t1 = g ^ u1 mod p */ | 807 | /* let t1 = g ^ u1 mod p */ |
810 | ret = 0; | 808 | ret = 0; |
811 | 809 | ||
812 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) | 810 | if (!dsa->meth->bn_mod_exp(dsa,t1,dsa->g,u1,dsa->p,ctx,mont)) |
813 | goto err; | 811 | goto err; |
@@ -1015,7 +1013,7 @@ ENGINE_load_cryptodev(void) | |||
1015 | if (!check_dev_crypto()) { | 1013 | if (!check_dev_crypto()) { |
1016 | return; | 1014 | return; |
1017 | } | 1015 | } |
1018 | 1016 | ||
1019 | /* | 1017 | /* |
1020 | * find out what asymmetric crypto algorithms we support | 1018 | * find out what asymmetric crypto algorithms we support |
1021 | */ | 1019 | */ |
@@ -1046,7 +1044,7 @@ ENGINE_load_cryptodev(void) | |||
1046 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | 1044 | if (cryptodev_asymfeat & CRF_MOD_EXP) { |
1047 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; | 1045 | cryptodev_rsa.bn_mod_exp = cryptodev_bn_mod_exp; |
1048 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) | 1046 | if (cryptodev_asymfeat & CRF_MOD_EXP_CRT) |
1049 | cryptodev_rsa.rsa_mod_exp = | 1047 | cryptodev_rsa.rsa_mod_exp = |
1050 | cryptodev_rsa_mod_exp; | 1048 | cryptodev_rsa_mod_exp; |
1051 | else | 1049 | else |
1052 | cryptodev_rsa.rsa_mod_exp = | 1050 | cryptodev_rsa.rsa_mod_exp = |
@@ -1056,18 +1054,17 @@ ENGINE_load_cryptodev(void) | |||
1056 | 1054 | ||
1057 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { | 1055 | if (ENGINE_set_DSA(engine, &cryptodev_dsa)) { |
1058 | const DSA_METHOD *meth = DSA_OpenSSL(); | 1056 | const DSA_METHOD *meth = DSA_OpenSSL(); |
1059 | 1057 | ||
1060 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); | 1058 | memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); |
1061 | if (cryptodev_asymfeat & CRF_DSA_SIGN) | 1059 | if (cryptodev_asymfeat & CRF_DSA_SIGN) |
1062 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; | 1060 | cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; |
1063 | if (cryptodev_asymfeat & CRF_MOD_EXP) { | 1061 | if (cryptodev_asymfeat & CRF_MOD_EXP) { |
1064 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; | 1062 | cryptodev_dsa.bn_mod_exp = cryptodev_dsa_bn_mod_exp; |
1065 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; | 1063 | cryptodev_dsa.dsa_mod_exp = cryptodev_dsa_dsa_mod_exp; |
1066 | } | 1064 | } |
1067 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) | 1065 | if (cryptodev_asymfeat & CRF_DSA_VERIFY) |
1068 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; | 1066 | cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify; |
1069 | } | 1067 | } |
1070 | |||
1071 | 1068 | ||
1072 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ | 1069 | if (ENGINE_set_DH(engine, &cryptodev_dh)){ |
1073 | const DH_METHOD *dh_meth = DH_OpenSSL(); | 1070 | const DH_METHOD *dh_meth = DH_OpenSSL(); |
@@ -1082,7 +1079,7 @@ ENGINE_load_cryptodev(void) | |||
1082 | cryptodev_dh_compute_key; | 1079 | cryptodev_dh_compute_key; |
1083 | } | 1080 | } |
1084 | } | 1081 | } |
1085 | 1082 | ||
1086 | ENGINE_add(engine); | 1083 | ENGINE_add(engine); |
1087 | ENGINE_free(engine); | 1084 | ENGINE_free(engine); |
1088 | ERR_clear_error(); | 1085 | ERR_clear_error(); |