git: 439291470380 - 2024Q1 - security/pecl-xxtea: Add new port

From: Yasuhiro Kimura <yasu_at_FreeBSD.org>
Date: Wed, 13 Mar 2024 00:59:23 UTC
The branch 2024Q1 has been updated by yasu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=439291470380e1afc631b46ecb02c7345d389f7a

commit 439291470380e1afc631b46ecb02c7345d389f7a
Author:     Yasuhiro Kimura <yasu@FreeBSD.org>
AuthorDate: 2024-03-13 00:12:27 +0000
Commit:     Yasuhiro Kimura <yasu@FreeBSD.org>
CommitDate: 2024-03-13 00:59:02 +0000

    security/pecl-xxtea: Add new port
    
    Add security/pecl-xxtea, XXTEA encryption algorithm extension for PHP.
    
    MFH:            2024Q1
    (cherry picked from commit de40af5ca187d945ab9458d14a62539db33de517)
---
 security/Makefile                            |  1 +
 security/pecl-xxtea/Makefile                 | 14 ++++++++++++++
 security/pecl-xxtea/distinfo                 |  3 +++
 security/pecl-xxtea/files/patch-php__xxtea.c | 29 ++++++++++++++++++++++++++++
 security/pecl-xxtea/pkg-descr                |  4 ++++
 5 files changed, 51 insertions(+)

diff --git a/security/Makefile b/security/Makefile
index 24e5ef2f8ead..c61c48bcc171 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -797,6 +797,7 @@
     SUBDIR += pecl-pkcs11
     SUBDIR += pecl-scrypt
     SUBDIR += pecl-ssh2
+    SUBDIR += pecl-xxtea
     SUBDIR += peda
     SUBDIR += pev
     SUBDIR += pgpdump
diff --git a/security/pecl-xxtea/Makefile b/security/pecl-xxtea/Makefile
new file mode 100644
index 000000000000..9df1ae76aeb6
--- /dev/null
+++ b/security/pecl-xxtea/Makefile
@@ -0,0 +1,14 @@
+PORTNAME=	xxtea
+DISTVERSION=	1.0.11
+CATEGORIES=	security
+
+MAINTAINER=	yasu@FreeBSD.org
+COMMENT=	XXTEA encryption algorithm extension for PHP
+WWW=		https://github.com/xxtea/xxtea-pecl
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE.md
+
+USES=		dos2unix php:pecl
+
+.include <bsd.port.mk>
diff --git a/security/pecl-xxtea/distinfo b/security/pecl-xxtea/distinfo
new file mode 100644
index 000000000000..2cd512de6cb2
--- /dev/null
+++ b/security/pecl-xxtea/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1710288047
+SHA256 (PECL/xxtea-1.0.11.tgz) = 5b1e318d3e70b27ad017d125d09ba3cf7bb3859e11be864a7bc3ddba421108af
+SIZE (PECL/xxtea-1.0.11.tgz) = 7404
diff --git a/security/pecl-xxtea/files/patch-php__xxtea.c b/security/pecl-xxtea/files/patch-php__xxtea.c
new file mode 100644
index 000000000000..2eab88f6ac5f
--- /dev/null
+++ b/security/pecl-xxtea/files/patch-php__xxtea.c
@@ -0,0 +1,29 @@
+--- php_xxtea.c.orig	2024-03-12 22:05:18 UTC
++++ php_xxtea.c
+@@ -275,7 +275,7 @@ ZEND_FUNCTION(xxtea_encrypt) {
+     size_t i, ret_length;
+     uint8_t fixed_key[16];
+ 
+-    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &data, &data_len, &key, &key_len) == FAILURE) {
++    if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &data, &data_len, &key, &key_len) == FAILURE) {
+         return;
+     }
+     if (data_len == 0) {
+@@ -308,7 +308,7 @@ ZEND_FUNCTION(xxtea_decrypt) {
+     size_t i, ret_length;
+     uint8_t fixed_key[16];
+ 
+-    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &data, &data_len, &key, &key_len) == FAILURE) {
++    if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &data, &data_len, &key, &key_len) == FAILURE) {
+         return;
+     }
+     if (data_len == 0) {
+@@ -340,7 +340,7 @@ ZEND_MINIT_FUNCTION(xxtea) {
+ ZEND_MINIT_FUNCTION(xxtea) {
+     zend_class_entry ce;
+     INIT_CLASS_ENTRY(ce, "XXTEA", xxtea_method);
+-    xxtea_ce = zend_register_internal_class(&ce TSRMLS_CC);
++    xxtea_ce = zend_register_internal_class(&ce);
+     return SUCCESS;
+ }
+ 
diff --git a/security/pecl-xxtea/pkg-descr b/security/pecl-xxtea/pkg-descr
new file mode 100644
index 000000000000..589cc44ee983
--- /dev/null
+++ b/security/pecl-xxtea/pkg-descr
@@ -0,0 +1,4 @@
+XXTEA is a fast and secure encryption algorithm. This is a XXTEA
+extension for PHP. It is different from the original XXTEA encryption
+algorithm. It encrypts and decrypts string instead of uint32 array,
+and the key is also string.