mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-10 07:33:19 -04:00
dev-libs/rsaref: initial import
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
1
dev-libs/rsaref/Manifest
Normal file
1
dev-libs/rsaref/Manifest
Normal file
@@ -0,0 +1 @@
|
||||
DIST rsaref-2.0.tar.Z 144092 BLAKE2B 341dc102e01ffad31386e1a0f9a60bb20ced4cdf385faaff2fee3efbdc90721d2b1e17e045bb8ad2c1ac86d55ba28aafe2c94d9dbecf99dbef11724a6e5848e5 SHA512 70cf6fe7bbf91ab5b5e09af02e8a9b732d94f1126df720fcdf23fb6f5b4d46515573cb18241eb7354c9a40faadfcf30942044cd4a3a8507de6c783fadec03422
|
||||
47
dev-libs/rsaref/files/rsaref-2.0-global.patch
Normal file
47
dev-libs/rsaref/files/rsaref-2.0-global.patch
Normal file
@@ -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_ */
|
||||
72
dev-libs/rsaref/files/rsaref-2.0-includes.patch
Normal file
72
dev-libs/rsaref/files/rsaref-2.0-includes.patch
Normal file
@@ -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" {
|
||||
44
dev-libs/rsaref/files/rsaref-2.0-libtool.patch
Normal file
44
dev-libs/rsaref/files/rsaref-2.0-libtool.patch
Normal file
@@ -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
|
||||
73
dev-libs/rsaref/files/rsaref-2.0-rsa.patch
Normal file
73
dev-libs/rsaref/files/rsaref-2.0-rsa.patch
Normal file
@@ -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 */
|
||||
30
dev-libs/rsaref/metadata.xml
Normal file
30
dev-libs/rsaref/metadata.xml
Normal file
@@ -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>
|
||||
44
dev-libs/rsaref/rsaref-2.0.ebuild
Normal file
44
dev-libs/rsaref/rsaref-2.0.ebuild
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user