public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Florian Schmaus" <flow@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:master commit in: dev-libs/rsaref/files/, dev-libs/rsaref/
Date: Thu, 30 Dec 2021 14:34:34 +0000 (UTC)	[thread overview]
Message-ID: <1640777886.5bfe94c0f25f07c1f0ca2e371aa8cbe34d8aafb3.flow@gentoo> (raw)

commit:     5bfe94c0f25f07c1f0ca2e371aa8cbe34d8aafb3
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Wed Dec 29 10:37:14 2021 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Dec 29 11:38:06 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5bfe94c0

dev-libs/rsaref: initial import

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 dev-libs/rsaref/Manifest                        |  1 +
 dev-libs/rsaref/files/rsaref-2.0-global.patch   | 47 ++++++++++++++++
 dev-libs/rsaref/files/rsaref-2.0-includes.patch | 72 ++++++++++++++++++++++++
 dev-libs/rsaref/files/rsaref-2.0-libtool.patch  | 44 +++++++++++++++
 dev-libs/rsaref/files/rsaref-2.0-rsa.patch      | 73 +++++++++++++++++++++++++
 dev-libs/rsaref/metadata.xml                    | 30 ++++++++++
 dev-libs/rsaref/rsaref-2.0.ebuild               | 44 +++++++++++++++
 7 files changed, 311 insertions(+)

diff --git a/dev-libs/rsaref/Manifest b/dev-libs/rsaref/Manifest
new file mode 100644
index 000000000..999cd5f16
--- /dev/null
+++ b/dev-libs/rsaref/Manifest
@@ -0,0 +1 @@
+DIST rsaref-2.0.tar.Z 144092 BLAKE2B 341dc102e01ffad31386e1a0f9a60bb20ced4cdf385faaff2fee3efbdc90721d2b1e17e045bb8ad2c1ac86d55ba28aafe2c94d9dbecf99dbef11724a6e5848e5 SHA512 70cf6fe7bbf91ab5b5e09af02e8a9b732d94f1126df720fcdf23fb6f5b4d46515573cb18241eb7354c9a40faadfcf30942044cd4a3a8507de6c783fadec03422

diff --git a/dev-libs/rsaref/files/rsaref-2.0-global.patch b/dev-libs/rsaref/files/rsaref-2.0-global.patch
new file mode 100644
index 000000000..30f35e9a3
--- /dev/null
+++ b/dev-libs/rsaref/files/rsaref-2.0-global.patch
@@ -0,0 +1,47 @@
+--- a/source/global.h
++++ b/source/global.h
+@@ -7,23 +7,17 @@
+ #ifndef _GLOBAL_H_
+ #define _GLOBAL_H_ 1
+ 
+-/* PROTOTYPES should be set to one if and only if the compiler supports
+-     function argument prototyping.
+-   The following makes PROTOTYPES default to 1 if it has not already been
+-     defined as 0 with C compiler flags.
+- */
+-#ifndef PROTOTYPES
+-#define PROTOTYPES 1
+-#endif
++#include <sys/types.h>
++#include <sys/cdefs.h>
+ 
+ /* POINTER defines a generic pointer type */
+-typedef unsigned char *POINTER;
++typedef caddr_t POINTER;
+ 
+ /* UINT2 defines a two byte word */
+-typedef unsigned short int UINT2;
++typedef u_int16_t UINT2;
+ 
+ /* UINT4 defines a four byte word */
+-typedef unsigned long int UINT4;
++typedef u_int32_t UINT4;
+ 
+ #ifndef NULL_PTR
+ #define NULL_PTR ((POINTER)0)
+@@ -33,14 +27,6 @@
+ #define UNUSED_ARG(x) x = *(&x);
+ #endif
+ 
+-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
+-   If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
+-     returns an empty list.  
+- */
+-#if PROTOTYPES
+-#define PROTO_LIST(list) list
+-#else
+-#define PROTO_LIST(list) ()
+-#endif
++#define PROTO_LIST(x) __P(x)
+ 
+ #endif /* end _GLOBAL_H_ */

diff --git a/dev-libs/rsaref/files/rsaref-2.0-includes.patch b/dev-libs/rsaref/files/rsaref-2.0-includes.patch
new file mode 100644
index 000000000..1f6b6f008
--- /dev/null
+++ b/dev-libs/rsaref/files/rsaref-2.0-includes.patch
@@ -0,0 +1,72 @@
+--- a/source/des.h
++++ b/source/des.h
+@@ -4,6 +4,8 @@
+ #ifndef _DES_H_
+ #define _DES_H_ 1
+ 
++#include <rsaref/global.h>
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+--- a/source/md2.h
++++ b/source/md2.h
+@@ -22,6 +22,8 @@
+ #ifndef _MD2_H_
+ #define _MD2_H_ 1
+ 
++#include <rsaref/global.h>
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+--- a/source/r_random.c
++++ b/source/r_random.c
+@@ -8,7 +8,7 @@
+ #include "global.h"
+ #include "rsaref.h"
+ #include "r_random.h"
+-#include "md5.h"
++#include <rsaref/md5.h>
+ 
+ #define RANDOM_BYTES_NEEDED 256
+ 
+--- a/source/rsa.h
++++ b/source/rsa.h
+@@ -5,6 +5,11 @@
+      Inc., created 1991. All rights reserved.
+  */
+ 
++#ifndef _RSA_H_
++#define _RSA_H_ 1
++
++#include <rsaref/global.h>
++
+ int RSAPublicEncrypt PROTO_LIST 
+   ((unsigned char *, unsigned int *, unsigned char *, unsigned int,
+     R_RSA_PUBLIC_KEY *, R_RANDOM_STRUCT *));
+@@ -17,3 +22,5 @@
+ int RSAPrivateDecrypt PROTO_LIST
+   ((unsigned char *, unsigned int *, unsigned char *, unsigned int,
+     R_RSA_PRIVATE_KEY *));
++
++#endif
+$NetBSD: patch-af,v 1.2 1998/08/07 11:13:48 agc Exp $
+
+--- a/source/rsaref.h
++++ b/source/rsaref.h
+@@ -8,9 +8,9 @@
+ #ifndef _RSAREF_H_
+ #define _RSAREF_H_ 1
+ 
+-#include "md2.h"
+-#include "md5.h"
+-#include "des.h"
++#include <rsaref/md2.h>
++#include <rsaref/md5.h>
++#include <rsaref/des.h>
+ 
+ #ifdef __cplusplus
+ extern "C" {

diff --git a/dev-libs/rsaref/files/rsaref-2.0-libtool.patch b/dev-libs/rsaref/files/rsaref-2.0-libtool.patch
new file mode 100644
index 000000000..ab0798241
--- /dev/null
+++ b/dev-libs/rsaref/files/rsaref-2.0-libtool.patch
@@ -0,0 +1,44 @@
+--- a/install/unix/makefile
++++ b/install/unix/makefile
+@@ -4,8 +4,7 @@
+ O = o
+ 
+ # commands
+-CC = cc
+-LIB = ar
++CC := ${LIBTOOL} --tag=CC --mode=compile ${CC}
+ 
+ # name of temporary library script
+ TEMPFILE = $(TEMP)/temp.mak
+@@ -14,18 +13,18 @@
+ STDINCDIR=/usr/include
+ 
+ # The places to look for include files (in order).
+-INCL =  -I. -I$(RSAREFDIR) -I$(STDINCDIR)
++INCL =  -I. -I$(RSAREFDIR)
+ 
+ # name of main executable to build
+ PROG = all
+ 
+ # Normal C flags.
+-CFLAGS = $(INCL) -O -c -DPROTOTYPES=1
++CFLAGS += $(INCL) -c -DPROTOTYPES=1
+ MFLAGS = -I. -I$(RSAREFDIR)
+ 
+ # The location of the common source directory.
+ RSAREFDIR = ../source/
+-RSAREFLIB = rsaref.a
++RSAREFLIB = librsaref.la
+ 
+ # The location of the demo source directory.
+ RDEMODIR = ../rdemo/
+@@ -41,8 +40,7 @@
+ $(RSAREFLIB) : desc.$(O) digit.$(O) md2c.$(O) md5c.$(O) nn.$(O) prime.$(O)\
+   rsa.$(O) r_encode.$(O) r_dh.$(O) r_enhanc.$(O) r_keygen.$(O) r_random.$(O)\
+   r_stdlib.$(O)
+-	$(LIB) r $@ $?
+-	ranlib $@
++	${LIBTOOL} --tag=CC --mode=link cc -o $@ ${?:.o=.lo} -rpath ${LIBDIR} -version-info 3:0 ${LDFLAGS}
+ 
+ rdemo.$(O) : $(RDEMODIR)rdemo.c $(RSAREFDIR)global.h $(RSAREFDIR)rsaref.h
+ 	$(CC) $(CFLAGS) $(RDEMODIR)rdemo.c

diff --git a/dev-libs/rsaref/files/rsaref-2.0-rsa.patch b/dev-libs/rsaref/files/rsaref-2.0-rsa.patch
new file mode 100644
index 000000000..1f31080c8
--- /dev/null
+++ b/dev-libs/rsaref/files/rsaref-2.0-rsa.patch
@@ -0,0 +1,73 @@
+--- a/source/rsa.c
++++ b/source/rsa.c
+@@ -11,10 +11,10 @@
+ #include "rsa.h"
+ #include "nn.h"
+ 
+-static int RSAPublicBlock PROTO_LIST 
++int RSAPublicBlock PROTO_LIST 
+   ((unsigned char *, unsigned int *, unsigned char *, unsigned int,
+     R_RSA_PUBLIC_KEY *));
+-static int RSAPrivateBlock PROTO_LIST 
++int RSAPrivateBlock PROTO_LIST 
+   ((unsigned char *, unsigned int *, unsigned char *, unsigned int,
+     R_RSA_PRIVATE_KEY *));
+ 
+@@ -33,6 +33,9 @@
+   unsigned char byte, pkcsBlock[MAX_RSA_MODULUS_LEN];
+   unsigned int i, modulusLen;
+   
++  if (inputLen+3>MAX_RSA_MODULUS_LEN) return (RE_LEN);
++  if (publicKey->bits > MAX_RSA_MODULUS_BITS) return (RE_LEN);
++
+   modulusLen = (publicKey->bits + 7) / 8;
+   if (inputLen + 11 > modulusLen)
+     return (RE_LEN);
+@@ -78,6 +81,9 @@
+   unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
+   unsigned int i, modulusLen, pkcsBlockLen;
+   
++  if (inputLen>MAX_RSA_MODULUS_LEN) return (RE_LEN);
++  if (publicKey->bits > MAX_RSA_MODULUS_BITS) return (RE_LEN);
++
+   modulusLen = (publicKey->bits + 7) / 8;
+   if (inputLen > modulusLen)
+     return (RE_LEN);
+@@ -129,6 +135,9 @@
+   unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
+   unsigned int i, modulusLen;
+   
++  if (inputLen+3>MAX_RSA_MODULUS_LEN) return (RE_LEN);
++  if (privateKey->bits > MAX_RSA_MODULUS_BITS) return (RE_LEN);
++
+   modulusLen = (privateKey->bits + 7) / 8;
+   if (inputLen + 11 > modulusLen)
+     return (RE_LEN);
+@@ -168,6 +177,9 @@
+   unsigned char pkcsBlock[MAX_RSA_MODULUS_LEN];
+   unsigned int i, modulusLen, pkcsBlockLen;
+   
++  if (inputLen>MAX_RSA_MODULUS_LEN) return (RE_LEN);
++  if (privateKey->bits > MAX_RSA_MODULUS_BITS) return (RE_LEN);
++
+   modulusLen = (privateKey->bits + 7) / 8;
+   if (inputLen > modulusLen)
+     return (RE_LEN);
+@@ -212,7 +224,7 @@
+    Assumes inputLen < length of modulus.
+    Requires input < modulus.
+  */
+-static int RSAPublicBlock (output, outputLen, input, inputLen, publicKey)
++int RSAPublicBlock (output, outputLen, input, inputLen, publicKey)
+ unsigned char *output;                                      /* output block */
+ unsigned int *outputLen;                          /* length of output block */
+ unsigned char *input;                                        /* input block */
+@@ -252,7 +264,7 @@
+    Assumes inputLen < length of modulus.
+    Requires input < modulus.
+  */
+-static int RSAPrivateBlock (output, outputLen, input, inputLen, privateKey)
++int RSAPrivateBlock (output, outputLen, input, inputLen, privateKey)
+ unsigned char *output;                                      /* output block */
+ unsigned int *outputLen;                          /* length of output block */
+ unsigned char *input;                                        /* input block */

diff --git a/dev-libs/rsaref/metadata.xml b/dev-libs/rsaref/metadata.xml
new file mode 100644
index 000000000..496077d78
--- /dev/null
+++ b/dev-libs/rsaref/metadata.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="person">
+	<email>cyber+gentoo@sysrq.in</email>
+	<name>Anna</name>
+</maintainer>
+<longdescription>
+RSAREF is a free, portable software developer's library of popular
+encryption and authentication algorithms. The name "RSAREF" means
+"RSA reference." RSA Laboratories intends RSAREF to serve as a free,
+educational reference implementation of modern public- and secret-key
+cryptography.
+
+RSAREF 2.0 supports the following algorithms:
+
+     o    RSA encryption and key generation, as defined by RSA
+          Laboratories' Public-Key Cryptography Standards (PKCS)
+
+     o    MD2 and MD5 message digests
+
+     o    DES (Data Encryption Standard) in cipher-block chaining mode
+
+     o    Diffie-Hellman key agreement
+
+     o    DESX, RSA Data Security's efficient, secure DES enhancement
+
+     o    Triple-DES, for added security with three DES operations
+</longdescription>
+</pkgmetadata>

diff --git a/dev-libs/rsaref/rsaref-2.0.ebuild b/dev-libs/rsaref/rsaref-2.0.ebuild
new file mode 100644
index 000000000..621e794ce
--- /dev/null
+++ b/dev-libs/rsaref/rsaref-2.0.ebuild
@@ -0,0 +1,44 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Encryption/authentication library, RSA/MDX/DES"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
+SRC_URI="https://archive.netbsd.org/pub/pkgsrc-archive/distfiles/2021Q3/${PN}.tar.Z -> ${P}.tar.Z"
+S="${WORKDIR}"
+
+LICENSE="RSAREF"
+SLOT="0/3"
+KEYWORDS="~amd64"
+
+BDEPEND="sys-devel/libtool"
+
+PATCHES=(
+	"${FILESDIR}"/${P}-global.patch
+	"${FILESDIR}"/${P}-includes.patch
+	"${FILESDIR}"/${P}-libtool.patch
+	"${FILESDIR}"/${P}-rsa.patch
+)
+
+DOCS=( doc )
+
+src_unpack() {
+	default
+
+	cd "${S}"/source || die
+	mkdir ${PN} || die
+	cp *.h ${PN} || die
+}
+
+src_compile() {
+	# XXX: fails with slibtool
+	emake -C install -f unix/makefile librsaref.la \
+		LIBTOOL=libtool LIBDIR="${EPREFIX}/usr/$(get_libdir)"
+}
+
+src_install() {
+	dolib.so install/.libs/lib${PN}.so*
+	doheader -r source/${PN}
+	einstalldocs
+}


             reply	other threads:[~2021-12-30 14:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30 14:34 Florian Schmaus [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-12-07 19:50 [gentoo-commits] repo/proj/guru:master commit in: dev-libs/rsaref/files/, dev-libs/rsaref/ Ronny Gutbrod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1640777886.5bfe94c0f25f07c1f0ca2e371aa8cbe34d8aafb3.flow@gentoo \
    --to=flow@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox