summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsg <>2010-12-16 00:07:25 +0000
committerjsg <>2010-12-16 00:07:25 +0000
commitb09b76a7c63ad74a19cc5bcf8d9642ce521d9e69 (patch)
treef399619400c7ccea3f74b354bdd9b78f56d2a10f
parent2bc6547e9d767adbb1235c01feedc6de29891672 (diff)
downloadopenbsd-b09b76a7c63ad74a19cc5bcf8d9642ce521d9e69.tar.gz
openbsd-b09b76a7c63ad74a19cc5bcf8d9642ce521d9e69.tar.bz2
openbsd-b09b76a7c63ad74a19cc5bcf8d9642ce521d9e69.zip
The VIA ciphers are added to an array of CRYPTO_ALGORITHM_MAX length
which should have been declared as CRYPTO_ALGORITHM_MAX + 1, fix this and reserve enough space for the VIA additions as well. ok/comments from mikeb & deraadt
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c4
-rw-r--r--src/lib/libssl/src/crypto/engine/hw_cryptodev.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c
index 6ac2f9be30..d6d78da9b2 100644
--- a/src/lib/libcrypto/engine/hw_cryptodev.c
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -238,7 +238,7 @@ cipher_nid_to_cryptodev(int nid)
238static int 238static int
239get_cryptodev_ciphers(const int **cnids) 239get_cryptodev_ciphers(const int **cnids)
240{ 240{
241 static int nids[CRYPTO_ALGORITHM_MAX]; 241 static int nids[CRYPTO_ALGORITHM_MAX + CRYPTO_VIAC3_MAX + 1];
242 struct session_op sess; 242 struct session_op sess;
243 int fd, i, count = 0; 243 int fd, i, count = 0;
244 244
@@ -249,7 +249,7 @@ get_cryptodev_ciphers(const int **cnids)
249 memset(&sess, 0, sizeof(sess)); 249 memset(&sess, 0, sizeof(sess));
250 sess.key = (caddr_t)"123456781234567812345678"; 250 sess.key = (caddr_t)"123456781234567812345678";
251 251
252 for (i = 0; ciphers[i].c_id && count < CRYPTO_ALGORITHM_MAX; i++) { 252 for (i = 0; ciphers[i].c_id && count <= CRYPTO_ALGORITHM_MAX; i++) {
253 if (ciphers[i].c_nid == NID_undef) 253 if (ciphers[i].c_nid == NID_undef)
254 continue; 254 continue;
255 sess.cipher = ciphers[i].c_id; 255 sess.cipher = ciphers[i].c_id;
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
index 6ac2f9be30..d6d78da9b2 100644
--- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
+++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
@@ -238,7 +238,7 @@ cipher_nid_to_cryptodev(int nid)
238static int 238static int
239get_cryptodev_ciphers(const int **cnids) 239get_cryptodev_ciphers(const int **cnids)
240{ 240{
241 static int nids[CRYPTO_ALGORITHM_MAX]; 241 static int nids[CRYPTO_ALGORITHM_MAX + CRYPTO_VIAC3_MAX + 1];
242 struct session_op sess; 242 struct session_op sess;
243 int fd, i, count = 0; 243 int fd, i, count = 0;
244 244
@@ -249,7 +249,7 @@ get_cryptodev_ciphers(const int **cnids)
249 memset(&sess, 0, sizeof(sess)); 249 memset(&sess, 0, sizeof(sess));
250 sess.key = (caddr_t)"123456781234567812345678"; 250 sess.key = (caddr_t)"123456781234567812345678";
251 251
252 for (i = 0; ciphers[i].c_id && count < CRYPTO_ALGORITHM_MAX; i++) { 252 for (i = 0; ciphers[i].c_id && count <= CRYPTO_ALGORITHM_MAX; i++) {
253 if (ciphers[i].c_nid == NID_undef) 253 if (ciphers[i].c_nid == NID_undef)
254 continue; 254 continue;
255 sess.cipher = ciphers[i].c_id; 255 sess.cipher = ciphers[i].c_id;