summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2020-05-03 23:49:04 +0000
committeragc <agc@pkgsrc.org>2020-05-03 23:49:04 +0000
commit5ae80e8864eba3a1ef695641eeb3458a6092997f (patch)
tree5cccee05c4244767be5e34e88ed8df684f58e543
parent2fc6fa1ec2928aa4e3ae49f3a770cd9e55332496 (diff)
downloadpkgsrc-5ae80e8864eba3a1ef695641eeb3458a6092997f.tar.gz
Update netpgpverify and libnetpgpverify to version 20200503
ensure all exported functions use a unique prfix, so that they don't conflict with symbols (both data and text) in libcrypto. this works for statically linked binaries and libraries, rather then the version map which only works for dynalically-linked.
-rw-r--r--security/netpgpverify/files/Makefile.bsd7
-rw-r--r--security/netpgpverify/files/b64.c6
-rw-r--r--security/netpgpverify/files/b64.h6
-rw-r--r--security/netpgpverify/files/bzlib.c86
-rw-r--r--security/netpgpverify/files/bzlib.h32
-rw-r--r--security/netpgpverify/files/bzlib_private.h26
-rw-r--r--security/netpgpverify/files/libverify.c22
-rw-r--r--security/netpgpverify/files/rsa.c78
-rw-r--r--security/netpgpverify/files/rsa.h91
-rw-r--r--security/netpgpverify/files/verify.h6
-rw-r--r--security/netpgpverify/files/zlib.c62
-rw-r--r--security/netpgpverify/files/zlib.h111
12 files changed, 276 insertions, 257 deletions
diff --git a/security/netpgpverify/files/Makefile.bsd b/security/netpgpverify/files/Makefile.bsd
index 2053f554dd5..a3c4a9591ed 100644
--- a/security/netpgpverify/files/Makefile.bsd
+++ b/security/netpgpverify/files/Makefile.bsd
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.bsd,v 1.12 2016/06/30 21:19:59 agc Exp $
+# $NetBSD: Makefile.bsd,v 1.13 2020/05/03 23:49:04 agc Exp $
PROG=netpgpverify
@@ -12,6 +12,11 @@ SRCS+= md5c.c rmd160.c sha1.c sha2.c
CPPFLAGS+=-I.
+CPPFLAGS.bzlib.c+= -Wno-error=implicit-fallthrough
+CPPFLAGS.zlib.c+= -Wno-error=implicit-fallthrough
+
+LDFLAGS+=-Wl,--version-script=${.CURDIR}/verify.map
+
.ifndef PRODUCTION
CPPFLAGS+=-g -O0
LDFLAGS+=-g -O0
diff --git a/security/netpgpverify/files/b64.c b/security/netpgpverify/files/b64.c
index 50412dece7d..11f7c0858dd 100644
--- a/security/netpgpverify/files/b64.c
+++ b/security/netpgpverify/files/b64.c
@@ -235,7 +235,7 @@ encodeblock(uint8_t *wordin, uint8_t *wordout, int wordlen)
** base64 encode a stream adding padding and line breaks as per spec.
*/
int
-b64encode(const char *in, const size_t insize, void *vp, size_t outsize, int linesize)
+netpgpv_b64encode(const char *in, const size_t insize, void *vp, size_t outsize, int linesize)
{
const char *inp;
unsigned i;
@@ -299,7 +299,7 @@ decodeblock(uint8_t wordin[4], uint8_t wordout[3])
** decode a base64 encoded stream discarding padding, line breaks and noise
*/
int
-b64decode(const char *in, const size_t insize, void *vp, size_t outsize)
+netpgpv_b64decode(const char *in, const size_t insize, void *vp, size_t outsize)
{
const char *inp;
unsigned wordlen;
@@ -349,7 +349,7 @@ b64decode(const char *in, const size_t insize, void *vp, size_t outsize)
/* return the encoded size for n bytes input */
int
-b64_encsize(unsigned n)
+netpgpv_b64_encsize(unsigned n)
{
return ((4 * n) / 3) + 4;
}
diff --git a/security/netpgpverify/files/b64.h b/security/netpgpverify/files/b64.h
index e939857cbdb..af03d0aa0c3 100644
--- a/security/netpgpverify/files/b64.h
+++ b/security/netpgpverify/files/b64.h
@@ -25,8 +25,8 @@
#ifndef B64_H_
#define B64_H_ 20091223
-int b64encode(const char */*in*/, const size_t /*insize*/, void */*vp*/, size_t /*outsize*/, int /*linesize*/);
-int b64decode(const char */*in*/, const size_t /*insize*/, void */*vp*/, size_t /*outsize*/);
-int b64_encsize(unsigned /*n*/);
+int netpgpv_b64encode(const char */*in*/, const size_t /*insize*/, void */*vp*/, size_t /*outsize*/, int /*linesize*/);
+int netpgpv_b64decode(const char */*in*/, const size_t /*insize*/, void */*vp*/, size_t /*outsize*/);
+int netpgpv_b64_encsize(unsigned /*n*/);
#endif
diff --git a/security/netpgpverify/files/bzlib.c b/security/netpgpverify/files/bzlib.c
index 8f397746aed..d66dcdb0b47 100644
--- a/security/netpgpverify/files/bzlib.c
+++ b/security/netpgpverify/files/bzlib.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bzlib.c,v 1.5 2016/02/19 22:41:50 agc Exp $ */
+/* $NetBSD: bzlib.c,v 1.6 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -39,7 +39,7 @@
#define USE_ARG(x) /*LINTED*/(void)&(x)
#endif
-/* $NetBSD: bzlib.c,v 1.5 2016/02/19 22:41:50 agc Exp $ */
+/* $NetBSD: bzlib.c,v 1.6 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -64,7 +64,7 @@
/*---------------------------------------------*/
-Int32 BZ2_rNums[512] = {
+Int32 netpgpv_BZ2_rNums[512] = {
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
@@ -126,7 +126,7 @@ Int32 BZ2_rNums[512] = {
/*---------------------------------------------------*/
#ifndef BZ_NO_STDIO
-void BZ2_bz__AssertH__fail ( int errcode )
+void netpgpv_BZ2_bz__AssertH__fail ( int errcode )
{
fprintf(stderr,
"\n\nbzip2/libbzip2: internal error number %d.\n"
@@ -138,7 +138,7 @@ void BZ2_bz__AssertH__fail ( int errcode )
"timely and accurate bug reports eventually lead to higher\n"
"quality software. Thanks. Julian Seward, 10 December 2007.\n\n",
errcode,
- BZ2_bzlibVersion()
+ netpgpv_BZ2_bzlibVersion()
);
if (errcode == 1007) {
@@ -249,7 +249,7 @@ void default_bzfree ( void* opaque, void* addr )
/*---------------------------------------------------*/
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressInit)
+int BZ_API(netpgpv_BZ2_bzDecompressInit)
( bz_stream* strm,
int verbosity,
int small )
@@ -444,7 +444,7 @@ Bool unRLE_obuf_to_output_FAST ( DState* s )
/*---------------------------------------------------*/
-__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
+__inline__ Int32 netpgpv_BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
{
Int32 nb, na, mid;
nb = 0;
@@ -565,7 +565,7 @@ Bool unRLE_obuf_to_output_SMALL ( DState* s )
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
+int BZ_API(netpgpv_BZ2_bzDecompress) ( bz_stream *strm )
{
Bool corrupt;
DState* s;
@@ -599,7 +599,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
}
}
if (s->state >= BZ_X_MAGIC_1) {
- Int32 r = BZ2_decompress ( s );
+ Int32 r = netpgpv_BZ2_decompress ( s );
if (r == BZ_STREAM_END) {
if (s->verbosity >= 3)
VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x",
@@ -619,7 +619,7 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm )
+int BZ_API(netpgpv_BZ2_bzDecompressEnd) ( bz_stream *strm )
{
DState* s;
if (strm == NULL) return BZ_PARAM_ERROR;
@@ -673,7 +673,7 @@ static Bool myfeof ( FILE* f )
/*---------------------------------------------------*/
-BZFILE* BZ_API(BZ2_bzReadOpen)
+BZFILE* BZ_API(netpgpv_BZ2_bzReadOpen)
( int* bzerror,
FILE* f,
int verbosity,
@@ -720,7 +720,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen)
nUnused--;
}
- ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
+ ret = netpgpv_BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
if (ret != BZ_OK)
{ BZ_SETERR(ret); free(bzf); return NULL; };
@@ -733,7 +733,7 @@ BZFILE* BZ_API(BZ2_bzReadOpen)
/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
+void BZ_API(netpgpv_BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
{
bzFile* bzf = (bzFile*)b;
@@ -745,13 +745,13 @@ void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b )
{ BZ_SETERR(BZ_SEQUENCE_ERROR); return; };
if (bzf->initialisedOk)
- (void)BZ2_bzDecompressEnd ( &(bzf->strm) );
+ (void)netpgpv_BZ2_bzDecompressEnd ( &(bzf->strm) );
free ( bzf );
}
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzRead)
+int BZ_API(netpgpv_BZ2_bzRead)
( int* bzerror,
BZFILE* b,
void* buf,
@@ -789,7 +789,7 @@ int BZ_API(BZ2_bzRead)
bzf->strm.next_in = bzf->buf;
}
- ret = BZ2_bzDecompress ( &(bzf->strm) );
+ ret = netpgpv_BZ2_bzDecompress ( &(bzf->strm) );
if (ret != BZ_OK && ret != BZ_STREAM_END)
{ BZ_SETERR(ret); return 0; };
@@ -811,7 +811,7 @@ int BZ_API(BZ2_bzRead)
/*---------------------------------------------------*/
-void BZ_API(BZ2_bzReadGetUnused)
+void BZ_API(netpgpv_BZ2_bzReadGetUnused)
( int* bzerror,
BZFILE* b,
void** unused,
@@ -833,7 +833,7 @@ void BZ_API(BZ2_bzReadGetUnused)
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzBuffToBuffDecompress)
+int BZ_API(netpgpv_BZ2_bzBuffToBuffDecompress)
( char* dest,
unsigned int* destLen,
char* source,
@@ -853,7 +853,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
strm.bzalloc = NULL;
strm.bzfree = NULL;
strm.opaque = NULL;
- ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
+ ret = netpgpv_BZ2_bzDecompressInit ( &strm, verbosity, small );
if (ret != BZ_OK) return ret;
strm.next_in = source;
@@ -861,26 +861,26 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
- ret = BZ2_bzDecompress ( &strm );
+ ret = netpgpv_BZ2_bzDecompress ( &strm );
if (ret == BZ_OK) goto output_overflow_or_eof;
if (ret != BZ_STREAM_END) goto errhandler;
/* normal termination */
*destLen -= strm.avail_out;
- BZ2_bzDecompressEnd ( &strm );
+ netpgpv_BZ2_bzDecompressEnd ( &strm );
return BZ_OK;
output_overflow_or_eof:
if (strm.avail_out > 0) {
- BZ2_bzDecompressEnd ( &strm );
+ netpgpv_BZ2_bzDecompressEnd ( &strm );
return BZ_UNEXPECTED_EOF;
} else {
- BZ2_bzDecompressEnd ( &strm );
+ netpgpv_BZ2_bzDecompressEnd ( &strm );
return BZ_OUTBUFF_FULL;
};
errhandler:
- BZ2_bzDecompressEnd ( &strm );
+ netpgpv_BZ2_bzDecompressEnd ( &strm );
return ret;
}
@@ -900,7 +900,7 @@ int BZ_API(BZ2_bzBuffToBuffDecompress)
/*--
return version like "0.9.5d, 4-Sept-1999".
--*/
-const char * BZ_API(BZ2_bzlibVersion)(void)
+const char * BZ_API(netpgpv_BZ2_bzlibVersion)(void)
{
return BZ_VERSION;
}
@@ -973,7 +973,7 @@ BZFILE * bzopen_or_bzdopen
if (writing) {
} else {
- bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
+ bzfp = netpgpv_BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
unused,nUnused);
}
if (bzfp == NULL) {
@@ -990,7 +990,7 @@ BZFILE * bzopen_or_bzdopen
ex) bzopen("file","w9")
case path="" or NULL => use stdin or stdout.
--*/
-BZFILE * BZ_API(BZ2_bzopen)
+BZFILE * BZ_API(netpgpv_BZ2_bzopen)
( const char *path,
const char *mode )
{
@@ -999,7 +999,7 @@ BZFILE * BZ_API(BZ2_bzopen)
/*---------------------------------------------------*/
-BZFILE * BZ_API(BZ2_bzdopen)
+BZFILE * BZ_API(netpgpv_BZ2_bzdopen)
( int fd,
const char *mode )
{
@@ -1008,11 +1008,11 @@ BZFILE * BZ_API(BZ2_bzdopen)
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
+int BZ_API(netpgpv_BZ2_bzread) (BZFILE* b, void* buf, int len )
{
int bzerr, nread;
if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0;
- nread = BZ2_bzRead(&bzerr,b,buf,len);
+ nread = netpgpv_BZ2_bzRead(&bzerr,b,buf,len);
if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) {
return nread;
} else {
@@ -1022,7 +1022,7 @@ int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len )
/*---------------------------------------------------*/
-int BZ_API(BZ2_bzflush) (BZFILE *b)
+int BZ_API(netpgpv_BZ2_bzflush) (BZFILE *b)
{
USE_ARG(b);
/* do nothing now... */
@@ -1031,7 +1031,7 @@ int BZ_API(BZ2_bzflush) (BZFILE *b)
/*---------------------------------------------------*/
-void BZ_API(BZ2_bzclose) (BZFILE* b)
+void BZ_API(netpgpv_BZ2_bzclose) (BZFILE* b)
{
int bzerr;
FILE *fp;
@@ -1040,7 +1040,7 @@ void BZ_API(BZ2_bzclose) (BZFILE* b)
fp = ((bzFile *)b)->handle;
if(((bzFile*)b)->writing){
}else{
- BZ2_bzReadClose(&bzerr,b);
+ netpgpv_BZ2_bzReadClose(&bzerr,b);
}
if(fp!=stdin && fp!=stdout){
fclose(fp);
@@ -1072,7 +1072,7 @@ static const char *bzerrorstrings[] = {
};
-const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
+const char * BZ_API(netpgpv_BZ2_bzerror) (BZFILE *b, int *errnum)
{
int err = ((bzFile *)b)->lastErr;
@@ -1086,7 +1086,7 @@ const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum)
/*-------------------------------------------------------------*/
/*--- end bzlib.c ---*/
/*-------------------------------------------------------------*/
-/* $NetBSD: bzlib.c,v 1.5 2016/02/19 22:41:50 agc Exp $ */
+/* $NetBSD: bzlib.c,v 1.6 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -1191,7 +1191,7 @@ void makeMaps_d ( DState* s )
/*---------------------------------------------------*/
-Int32 BZ2_decompress ( DState* s )
+Int32 netpgpv_BZ2_decompress ( DState* s )
{
UChar uc;
Int32 retVal;
@@ -1424,7 +1424,7 @@ Int32 BZ2_decompress ( DState* s )
if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
if (s->len[t][i] < minLen) minLen = s->len[t][i];
}
- BZ2_hbCreateDecodeTables (
+ netpgpv_BZ2_hbCreateDecodeTables (
&(s->limit[t][0]),
&(s->base[t][0]),
&(s->perm[t][0]),
@@ -1732,7 +1732,7 @@ Int32 BZ2_decompress ( DState* s )
/*-------------------------------------------------------------*/
/*--- end decompress.c ---*/
/*-------------------------------------------------------------*/
-/* $NetBSD: bzlib.c,v 1.5 2016/02/19 22:41:50 agc Exp $ */
+/* $NetBSD: bzlib.c,v 1.6 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -1762,7 +1762,7 @@ Int32 BZ2_decompress ( DState* s )
comp.compression FAQ.
--*/
-UInt32 BZ2_crc32Table[256] = {
+UInt32 netpgpv_BZ2_crc32Table[256] = {
/*-- Ugly, innit? --*/
@@ -1836,7 +1836,7 @@ UInt32 BZ2_crc32Table[256] = {
/*-------------------------------------------------------------*/
/*--- end crctable.c ---*/
/*-------------------------------------------------------------*/
-/* $NetBSD: bzlib.c,v 1.5 2016/02/19 22:41:50 agc Exp $ */
+/* $NetBSD: bzlib.c,v 1.6 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -1898,7 +1898,7 @@ UInt32 BZ2_crc32Table[256] = {
/*---------------------------------------------------*/
-void BZ2_hbMakeCodeLengths ( UChar *len,
+void netpgpv_BZ2_hbMakeCodeLengths ( UChar *len,
Int32 *freq,
Int32 alphaSize,
Int32 maxLen )
@@ -1987,7 +1987,7 @@ void BZ2_hbMakeCodeLengths ( UChar *len,
/*---------------------------------------------------*/
-void BZ2_hbAssignCodes ( Int32 *code,
+void netpgpv_BZ2_hbAssignCodes ( Int32 *code,
UChar *length,
Int32 minLen,
Int32 maxLen,
@@ -2005,7 +2005,7 @@ void BZ2_hbAssignCodes ( Int32 *code,
/*---------------------------------------------------*/
-void BZ2_hbCreateDecodeTables ( Int32 *limit,
+void netpgpv_BZ2_hbCreateDecodeTables ( Int32 *limit,
Int32 *base,
Int32 *perm,
UChar *length,
diff --git a/security/netpgpverify/files/bzlib.h b/security/netpgpverify/files/bzlib.h
index 09bc523ea9f..d176425e17a 100644
--- a/security/netpgpverify/files/bzlib.h
+++ b/security/netpgpverify/files/bzlib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: bzlib.h,v 1.1 2013/03/16 07:32:34 agc Exp $ */
+/* $NetBSD: bzlib.h,v 1.2 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -115,17 +115,17 @@ BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
bz_stream* strm
);
-BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzDecompressInit) (
bz_stream *strm,
int verbosity,
int small
);
-BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzDecompress) (
bz_stream* strm
);
-BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzDecompressEnd) (
bz_stream *strm
);
@@ -138,7 +138,7 @@ BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
typedef void BZFILE;
-BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
+BZ_EXTERN BZFILE* BZ_API(netpgpv_BZ2_bzReadOpen) (
int* bzerror,
FILE* f,
int verbosity,
@@ -147,19 +147,19 @@ BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
int nUnused
);
-BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
+BZ_EXTERN void BZ_API(netpgpv_BZ2_bzReadClose) (
int* bzerror,
BZFILE* b
);
-BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
+BZ_EXTERN void BZ_API(netpgpv_BZ2_bzReadGetUnused) (
int* bzerror,
BZFILE* b,
void** unused,
int* nUnused
);
-BZ_EXTERN int BZ_API(BZ2_bzRead) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzRead) (
int* bzerror,
BZFILE* b,
void* buf,
@@ -213,7 +213,7 @@ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
int workFactor
);
-BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzBuffToBuffDecompress) (
char* dest,
unsigned int* destLen,
char* source,
@@ -232,22 +232,22 @@ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
If this code breaks, please contact both Yoshioka and me.
--*/
-BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
+BZ_EXTERN const char * BZ_API(netpgpv_BZ2_bzlibVersion) (
void
);
#ifndef BZ_NO_STDIO
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
+BZ_EXTERN BZFILE * BZ_API(netpgpv_BZ2_bzopen) (
const char *path,
const char *mode
);
-BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
+BZ_EXTERN BZFILE * BZ_API(netpgpv_BZ2_bzdopen) (
int fd,
const char *mode
);
-BZ_EXTERN int BZ_API(BZ2_bzread) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzread) (
BZFILE* b,
void* buf,
int len
@@ -259,15 +259,15 @@ BZ_EXTERN int BZ_API(BZ2_bzwrite) (
int len
);
-BZ_EXTERN int BZ_API(BZ2_bzflush) (
+BZ_EXTERN int BZ_API(netpgpv_BZ2_bzflush) (
BZFILE* b
);
-BZ_EXTERN void BZ_API(BZ2_bzclose) (
+BZ_EXTERN void BZ_API(netpgpv_BZ2_bzclose) (
BZFILE* b
);
-BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
+BZ_EXTERN const char * BZ_API(netpgpv_BZ2_bzerror) (
BZFILE *b,
int *errnum
);
diff --git a/security/netpgpverify/files/bzlib_private.h b/security/netpgpverify/files/bzlib_private.h
index 5c6c5a23a3f..52908d4b7dc 100644
--- a/security/netpgpverify/files/bzlib_private.h
+++ b/security/netpgpverify/files/bzlib_private.h
@@ -1,4 +1,4 @@
-/* $NetBSD: bzlib_private.h,v 1.3 2015/02/03 21:13:17 agc Exp $ */
+/* $NetBSD: bzlib_private.h,v 1.4 2020/05/03 23:49:04 agc Exp $ */
/*-------------------------------------------------------------*/
@@ -61,9 +61,9 @@ typedef unsigned short UInt16;
#define __dead
#endif
-void BZ2_bz__AssertH__fail ( int errcode ) __dead;
+void netpgpv_BZ2_bz__AssertH__fail ( int errcode ) __dead;
#define AssertH(cond,errcode) \
- { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
+ { if (!(cond)) netpgpv_BZ2_bz__AssertH__fail ( errcode ); }
#if BZ_DEBUG
#define AssertD(cond,msg) \
@@ -134,7 +134,7 @@ extern void bz_internal_error ( int errcode );
/*-- Stuff for randomising repetitive blocks. --*/
-extern Int32 BZ2_rNums[512];
+extern Int32 netpgpv_BZ2_rNums[512];
#define BZ_RAND_DECLS \
Int32 rNToGo; \
@@ -148,7 +148,7 @@ extern Int32 BZ2_rNums[512];
#define BZ_RAND_UPD_MASK \
if (s->rNToGo == 0) { \
- s->rNToGo = BZ2_rNums[s->rTPos]; \
+ s->rNToGo = netpgpv_BZ2_rNums[s->rTPos]; \
s->rTPos++; \
if (s->rTPos == 512) s->rTPos = 0; \
} \
@@ -158,7 +158,7 @@ extern Int32 BZ2_rNums[512];
/*-- Stuff for doing CRCs. --*/
-extern UInt32 BZ2_crc32Table[256];
+extern UInt32 netpgpv_BZ2_crc32Table[256];
#define BZ_INITIALISE_CRC(crcVar) \
{ \
@@ -173,7 +173,7 @@ extern UInt32 BZ2_crc32Table[256];
#define BZ_UPDATE_CRC(crcVar,cha) \
{ \
crcVar = (crcVar << 8) ^ \
- BZ2_crc32Table[(crcVar >> 24) ^ \
+ netpgpv_BZ2_crc32Table[(crcVar >> 24) ^ \
((UChar)cha)]; \
}
@@ -285,10 +285,10 @@ extern void
BZ2_bsInitWrite ( EState* );
extern void
-BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
+netpgpv_BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
extern void
-BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
+netpgpv_BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
@@ -481,20 +481,20 @@ typedef
#define BZ_GET_SMALL(cccc) \
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
- cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \
+ cccc = netpgpv_BZ2_indexIntoF ( s->tPos, s->cftab ); \
s->tPos = GET_LL(s->tPos);
/*-- externs for decompression. --*/
extern Int32
-BZ2_indexIntoF ( Int32, Int32* );
+netpgpv_BZ2_indexIntoF ( Int32, Int32* );
extern Int32
-BZ2_decompress ( DState* );
+netpgpv_BZ2_decompress ( DState* );
extern void
-BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
+netpgpv_BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
Int32, Int32, Int32 );
diff --git a/security/netpgpverify/files/libverify.c b/security/netpgpverify/files/libverify.c
index 6555c459bbd..9b5f6cfd9e4 100644
--- a/security/netpgpverify/files/libverify.c
+++ b/security/netpgpverify/files/libverify.c
@@ -1316,7 +1316,7 @@ read_compressed(pgpv_t *pgp, pgpv_compress_t *compressed, uint8_t *p, size_t len
ok = (inflateInit(&z) == Z_OK);
break;
case BZIP2_COMPRESSION:
- ok = (BZ2_bzDecompressInit(&bz, 1, 0) == BZ_OK);
+ ok = (netpgpv_BZ2_bzDecompressInit(&bz, 1, 0) == BZ_OK);
break;
}
if (!ok) {
@@ -1330,7 +1330,7 @@ read_compressed(pgpv_t *pgp, pgpv_compress_t *compressed, uint8_t *p, size_t len
unzmem->size = z.total_out;
break;
case BZIP2_COMPRESSION:
- ok = (BZ2_bzDecompress(&bz) == BZ_STREAM_END);
+ ok = (netpgpv_BZ2_bzDecompress(&bz) == BZ_STREAM_END);
unzmem->size = ((uint64_t)bz.total_out_hi32 << 32) | bz.total_out_lo32;
break;
}
@@ -1881,7 +1881,7 @@ rsa_padding_check_none(uint8_t *to, int tlen, const uint8_t *from, int flen, int
/* check against the exponent/moudulo operation */
static int
-lowlevel_rsa_public_check(const uint8_t *encbuf, int enclen, uint8_t *dec, const rsa_pubkey_t *rsa)
+lowlevel_rsa_public_check(const uint8_t *encbuf, int enclen, uint8_t *dec, const netpgpv_rsa_pubkey_t *rsa)
{
uint8_t *decbuf;
PGPV_BIGNUM *decbn;
@@ -1947,10 +1947,10 @@ err:
/* verify */
static int
-rsa_public_decrypt(int enclen, const unsigned char *enc, unsigned char *dec, RSA *rsa, int padding)
+rsa_public_decrypt(int enclen, const unsigned char *enc, unsigned char *dec, NETPGPV_RSA *rsa, int padding)
{
- rsa_pubkey_t pub;
- int ret;
+ netpgpv_rsa_pubkey_t pub;
+ int ret;
if (enc == NULL || dec == NULL || rsa == NULL) {
return 0;
@@ -1985,7 +1985,7 @@ estimate_primarykey_size(pgpv_primarykey_t *primary)
static int
pgpv_rsa_public_decrypt(uint8_t *out, const uint8_t *in, size_t length, const pgpv_pubkey_t *pubkey)
{
- RSA *orsa;
+ NETPGPV_RSA *orsa;
int n;
if ((orsa = calloc(1, sizeof(*orsa))) == NULL) {
@@ -1993,7 +1993,7 @@ pgpv_rsa_public_decrypt(uint8_t *out, const uint8_t *in, size_t length, const pg
}
orsa->n = pubkey->bn[RSA_N].bn;
orsa->e = pubkey->bn[RSA_E].bn;
- n = rsa_public_decrypt((int)length, in, out, orsa, RSA_NO_PADDING);
+ n = rsa_public_decrypt((int)length, in, out, orsa, NETPGPV_RSA_NO_PADDING);
orsa->n = orsa->e = NULL;
free(orsa);
return n;
@@ -2313,7 +2313,7 @@ read_ascii_armor(pgpv_cursor_t *cursor, pgpv_mem_t *mem, const char *filename)
(size_t)(p - mem->mem));
return 0;
}
- binsigsize = b64decode((char *)p, (size_t)(sigend - p), binsig, sizeof(binsig));
+ binsigsize = netpgpv_b64decode((char *)p, (size_t)(sigend - p), binsig, sizeof(binsig));
read_binary_memory(cursor->pgp, "signature", cons_onepass, 15);
ARRAY_APPEND(cursor->pgp->pkts, litdata);
@@ -2738,8 +2738,8 @@ read_ssh_file(pgpv_t *pgp, pgpv_primarykey_t *primary, const char *fmt, ...)
memset(&userid, 0x0, sizeof(userid));
(void) gethostname(hostname, sizeof(hostname));
if (strlen(space + 1) - 1 == 0) {
- (void) snprintf(owner, sizeof(owner), "<root@%s>",
- hostname);
+ (void) snprintf(owner, sizeof(owner), "<root@%.*s>",
+ 240, hostname);
} else {
(void) snprintf(owner, sizeof(owner), "<%.*s>",
(int)strlen(space + 1) - 1,
diff --git a/security/netpgpverify/files/rsa.c b/security/netpgpverify/files/rsa.c
index e18ab178a23..2ff6179109c 100644
--- a/security/netpgpverify/files/rsa.c
+++ b/security/netpgpverify/files/rsa.c
@@ -61,7 +61,7 @@ rsa_padding_check_none(uint8_t *to, int tlen, const uint8_t *from, int flen, int
}
static int
-lowlevel_rsa_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa)
+lowlevel_rsa_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, NETPGPV_RSA *rsa)
{
PGPV_BIGNUM *decbn;
PGPV_BIGNUM *signedbn;
@@ -100,7 +100,7 @@ err:
}
static int
-lowlevel_rsa_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa)
+lowlevel_rsa_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, NETPGPV_RSA *rsa)
{
PGPV_BIGNUM *decbn;
PGPV_BIGNUM *encbn;
@@ -143,7 +143,7 @@ err:
}
static int
-lowlevel_rsa_private_decrypt(int enclen, const unsigned char *encbuf, unsigned char *to, RSA *rsa)
+lowlevel_rsa_private_decrypt(int enclen, const unsigned char *encbuf, unsigned char *to, NETPGPV_RSA *rsa)
{
PGPV_BIGNUM *encbn;
PGPV_BIGNUM *decbn;
@@ -185,7 +185,7 @@ err:
}
static int
-lowlevel_rsa_public_decrypt(const uint8_t *encbuf, int enclen, uint8_t *dec, const rsa_pubkey_t *rsa)
+lowlevel_rsa_public_decrypt(const uint8_t *encbuf, int enclen, uint8_t *dec, const netpgpv_rsa_pubkey_t *rsa)
{
uint8_t *decbuf;
PGPV_BIGNUM *decbn;
@@ -404,7 +404,7 @@ cleanup:
#define DSA_MAX_MODULUS_BITS 10000
static int
-dsa_do_verify(const unsigned char *calculated, int dgst_len, const dsasig_t *sig, mpi_dsa_t *dsa)
+dsa_do_verify(const unsigned char *calculated, int dgst_len, const netpgpv_dsasig_t *sig, netpgpv_mpi_dsa_t *dsa)
{
PGPV_BIGNUM *M;
PGPV_BIGNUM *W;
@@ -491,24 +491,26 @@ err:
/*************************************************************************/
int
-RSA_size(const RSA *rsa)
+netpgpv_RSA_size(const NETPGPV_RSA *rsa)
{
return (rsa == NULL) ? 0 : PGPV_BN_num_bits(rsa->n);
}
int
-DSA_size(const DSA *dsa)
+netpgpv_DSA_size(const NETPGPV_DSA *dsa)
{
return (dsa == NULL) ? 0 : PGPV_BN_num_bits(dsa->p);
}
unsigned
-dsa_verify(const signature_t *signature, const dsa_pubkey_t *pubdsa, const uint8_t *calculated, size_t hash_length)
+netpgpv_dsa_verify(const signature_t *signature,
+ const netpgpv_dsa_pubkey_t *pubdsa, const uint8_t *calculated,
+ size_t hash_length)
{
- mpi_dsa_t odsa;
- dsasig_t osig;
- unsigned qlen;
- int ret;
+ netpgpv_mpi_dsa_t odsa;
+ netpgpv_dsasig_t osig;
+ unsigned qlen;
+ int ret;
if (signature == NULL || pubdsa == NULL || calculated == NULL) {
return -1;
@@ -539,14 +541,14 @@ dsa_verify(const signature_t *signature, const dsa_pubkey_t *pubdsa, const uint8
return (unsigned)ret;
}
-RSA *
-RSA_new(void)
+NETPGPV_RSA *
+netpgpv_RSA_new(void)
{
- return netpgp_allocate(1, sizeof(RSA));
+ return netpgp_allocate(1, sizeof(NETPGPV_RSA));
}
void
-RSA_free(RSA *rsa)
+netpgpv_RSA_free(NETPGPV_RSA *rsa)
{
if (rsa) {
netpgp_deallocate(rsa, sizeof(*rsa));
@@ -554,7 +556,7 @@ RSA_free(RSA *rsa)
}
int
-RSA_check_key(RSA *rsa)
+netpgpv_RSA_check_key(NETPGPV_RSA *rsa)
{
PGPV_BIGNUM *calcn;
int ret;
@@ -580,8 +582,8 @@ errout:
return ret;
}
-RSA *
-RSA_generate_key(int num, unsigned long e, void (*callback)(int,int,void *), void *cb_arg)
+NETPGPV_RSA *
+netpgpv_RSA_generate_key(int num, unsigned long e, void (*callback)(int,int,void *), void *cb_arg)
{
/* STUBBED */
USE_ARG(num);
@@ -589,12 +591,12 @@ RSA_generate_key(int num, unsigned long e, void (*callback)(int,int,void *), voi
USE_ARG(callback);
USE_ARG(cb_arg);
printf("RSA_generate_key stubbed\n");
- return RSA_new();
+ return netpgpv_RSA_new();
}
/* encrypt */
int
-RSA_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa, int padding)
+netpgpv_RSA_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, NETPGPV_RSA *rsa, int padding)
{
USE_ARG(padding);
if (plain == NULL || encbuf == NULL || rsa == NULL) {
@@ -605,7 +607,7 @@ RSA_public_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf
/* decrypt */
int
-RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
+netpgpv_RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, NETPGPV_RSA *rsa, int padding)
{
USE_ARG(padding);
if (from == NULL || to == NULL || rsa == NULL) {
@@ -616,7 +618,7 @@ RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA
/* sign */
int
-RSA_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, RSA *rsa, int padding)
+netpgpv_RSA_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbuf, NETPGPV_RSA *rsa, int padding)
{
USE_ARG(padding);
if (plain == NULL || encbuf == NULL || rsa == NULL) {
@@ -627,10 +629,10 @@ RSA_private_encrypt(int plainc, const unsigned char *plain, unsigned char *encbu
/* verify */
int
-RSA_public_decrypt(int enclen, const unsigned char *enc, unsigned char *dec, RSA *rsa, int padding)
+netpgpv_RSA_public_decrypt(int enclen, const unsigned char *enc, unsigned char *dec, NETPGPV_RSA *rsa, int padding)
{
- rsa_pubkey_t pub;
- int ret;
+ netpgpv_rsa_pubkey_t pub;
+ int ret;
if (enc == NULL || dec == NULL || rsa == NULL) {
return 0;
@@ -647,47 +649,47 @@ RSA_public_decrypt(int enclen, const unsigned char *enc, unsigned char *dec, RSA
/***********************************************************************/
-DSA *
-DSA_new(void)
+NETPGPV_DSA *
+netpgpv_DSA_new(void)
{
- return netpgp_allocate(1, sizeof(DSA));
+ return netpgp_allocate(1, sizeof(NETPGPV_DSA));
}
void
-DSA_free(DSA *dsa)
+netpgpv_DSA_free(NETPGPV_DSA *dsa)
{
if (dsa) {
netpgp_deallocate(dsa, sizeof(*dsa));
}
}
-DSA_SIG *
-DSA_SIG_new(void)
+NETPGPV_DSA_SIG *
+netpgpv_DSA_SIG_new(void)
{
- return netpgp_allocate(1, sizeof(DSA_SIG));
+ return netpgp_allocate(1, sizeof(NETPGPV_DSA_SIG));
}
void
-DSA_SIG_free(DSA_SIG *sig)
+netpgpv_DSA_SIG_free(NETPGPV_DSA_SIG *sig)
{
if (sig) {
netpgp_deallocate(sig, sizeof(*sig));
}
}
-DSA_SIG *
-DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
+NETPGPV_DSA_SIG *
+netpgpv_DSA_do_sign(const unsigned char *dgst, int dlen, NETPGPV_DSA *dsa)
{
/* STUBBED */
USE_ARG(dgst);
USE_ARG(dlen);
USE_ARG(dsa);
printf("DSA_do_sign stubbed\n");
- return DSA_SIG_new();
+ return netpgpv_DSA_SIG_new();
}
int
-DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa)
+netpgpv_DSA_do_verify(const unsigned char *dgst, int dgst_len, NETPGPV_DSA_SIG *sig, NETPGPV_DSA *dsa)
{
if (dgst == NULL || dgst_len == 0 || sig == NULL || dsa == NULL) {
return -1;
diff --git a/security/netpgpverify/files/rsa.h b/security/netpgpverify/files/rsa.h
index 1eb72d0fabe..8cfa3d505af 100644
--- a/security/netpgpverify/files/rsa.h
+++ b/security/netpgpverify/files/rsa.h
@@ -39,12 +39,12 @@
__BEGIN_DECLS
-typedef struct rsa_pubkey_t {
+typedef struct netpgpv_rsa_pubkey_t {
PGPV_BIGNUM *n; /* RSA public modulus n */
PGPV_BIGNUM *e; /* RSA public encryption exponent e */
-} rsa_pubkey_t;
+} netpgpv_rsa_pubkey_t;
-typedef struct mpi_rsa_t {
+typedef struct netpgpv_mpi_rsa_t {
int f1; /* openssl pad */
long f2; /* openssl version */
const void *f3; /* openssl method */
@@ -57,18 +57,18 @@ typedef struct mpi_rsa_t {
PGPV_BIGNUM *dmp1;
PGPV_BIGNUM *dmq1;
PGPV_BIGNUM *iqmp;
-} mpi_rsa_t;
+} netpgpv_mpi_rsa_t;
-#define RSA mpi_rsa_t
+#define NETPGPV_RSA netpgpv_mpi_rsa_t
-typedef struct dsa_pubkey_t {
+typedef struct netpgpv_dsa_pubkey_t {
PGPV_BIGNUM *p; /* DSA public modulus n */
PGPV_BIGNUM *q; /* DSA public encryption exponent e */
PGPV_BIGNUM *g;
PGPV_BIGNUM *y;
-} dsa_pubkey_t;
+} netpgpv_dsa_pubkey_t;
-typedef struct mpi_dsa_t {
+typedef struct netpgpv_mpi_dsa_t {
PGPV_BIGNUM *p;
PGPV_BIGNUM *q;
PGPV_BIGNUM *g;
@@ -76,29 +76,29 @@ typedef struct mpi_dsa_t {
PGPV_BIGNUM *x;
PGPV_BIGNUM *pub_key;
PGPV_BIGNUM *priv_key;
-} mpi_dsa_t;
+} netpgpv_mpi_dsa_t;
-#define DSA mpi_dsa_t
+#define NETPGPV_DSA netpgpv_mpi_dsa_t
-typedef struct rsasig_t {
+typedef struct netpgpv_rsasig_t {
PGPV_BIGNUM *sig; /* mpi which is actual signature */
-} rsasig_t;
+} netpgpv_rsasig_t;
-typedef struct dsasig_t {
+typedef struct netpgpv_dsasig_t {
PGPV_BIGNUM *r; /* mpi which is actual signature */
PGPV_BIGNUM *s; /* mpi which is actual signature */
-} dsasig_t;
+} netpgpv_dsasig_t;
-#define DSA_SIG dsasig_t
+#define NETPGPV_DSA_SIG netpgpv_dsasig_t
/* misc defs */
-#define RSA_NO_PADDING 3
+#define NETPGPV_RSA_NO_PADDING 3
#define SIGNETBSD_ID_SIZE 8
#define SIGNETBSD_NAME_SIZE 128
-#define RSA_PUBKEY_ALG 1
-#define DSA_PUBKEY_ALG 17
+#define NETPGPV_RSA_PUBKEY_ALG 1
+#define NETPGPV_DSA_PUBKEY_ALG 17
/* the public part of the key */
typedef struct pubkey_t {
@@ -109,8 +109,8 @@ typedef struct pubkey_t {
int64_t expiry; /* expiration time of the key */
uint32_t validity; /* validity in days */
uint32_t alg; /* pubkey algorithm - rsa/dss etc */
- rsa_pubkey_t rsa; /* specific RSA keys */
- dsa_pubkey_t dsa; /* specific DSA keys */
+ netpgpv_rsa_pubkey_t rsa; /* specific RSA keys */
+ netpgpv_dsa_pubkey_t dsa; /* specific DSA keys */
} pubkey_t;
/* signature details (for a specific file) */
@@ -122,33 +122,42 @@ typedef struct signature_t {
uint8_t id[SIGNETBSD_ID_SIZE]; /* binary id */
uint32_t key_alg; /* public key algorithm number */
uint32_t hash_alg; /* hashing algorithm number */
- rsasig_t rsa; /* RSA signature */
- dsasig_t dsa; /* DSA signature */
+ netpgpv_rsasig_t rsa; /* RSA signature */
+ netpgpv_dsasig_t dsa; /* DSA signature */
size_t v4_hashlen; /* length of hashed info */
uint8_t *v4_hashed; /* hashed info */
uint8_t hash2[2]; /* high 2 bytes of hashed value - for quick test */
pubkey_t *signer; /* pubkey of signer */
} signature_t;
-unsigned dsa_verify(const signature_t */*sig*/, const dsa_pubkey_t */*pubdsa*/, const uint8_t */*calc*/, size_t /*hashlen*/);
-
-RSA *RSA_new(void);
-int RSA_size(const RSA */*rsa*/);
-void RSA_free(RSA */*rsa*/);
-int RSA_check_key(RSA */*rsa*/);
-RSA *RSA_generate_key(int /*num*/, unsigned long /*e*/, void (*callback)(int,int,void *), void */*cb_arg*/);
-int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
-int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
-int RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
-int RSA_public_decrypt(int flen, const uint8_t *from, uint8_t *to, RSA *rsa, int padding);
-
-DSA *DSA_new(void);
-int DSA_size(const DSA */*rsa*/);
-void DSA_free(DSA */*dsa*/);
-DSA_SIG *DSA_SIG_new(void);
-void DSA_SIG_free(DSA_SIG */*sig*/);
-int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa);
-DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
+unsigned netpgpv_dsa_verify(const signature_t */*sig*/,
+ const netpgpv_dsa_pubkey_t */*pubdsa*/, const uint8_t */*calc*/,
+ size_t /*hashlen*/);
+
+NETPGPV_RSA *netpgpv_RSA_new(void);
+int netpgpv_RSA_size(const NETPGPV_RSA */*rsa*/);
+void netpgpv_RSA_free(NETPGPV_RSA */*rsa*/);
+int netpgpv_RSA_check_key(NETPGPV_RSA */*rsa*/);
+NETPGPV_RSA *netpgpv_RSA_generate_key(int /*num*/, unsigned long /*e*/,
+ void (*callback)(int,int,void *), void */*cb_arg*/);
+int netpgpv_RSA_public_encrypt(int /*flen*/, const unsigned char */*from*/,
+ unsigned char */*to*/, NETPGPV_RSA */*rsa*/, int /*padding*/);
+int netpgpv_RSA_private_decrypt(int /*flen*/, const unsigned char */*from*/,
+ unsigned char */*to*/, NETPGPV_RSA */*rsa*/, int /*padding*/);
+int netpgpv_RSA_private_encrypt(int /*flen*/, const unsigned char */*from*/,
+ unsigned char */*to*/, NETPGPV_RSA */*rsa*/, int /*padding*/);
+int netpgpv_RSA_public_decrypt(int /*flen*/, const uint8_t */*from*/,
+ uint8_t */*to*/, NETPGPV_RSA */*rsa*/, int /*padding*/);
+
+NETPGPV_DSA *netpgpv_DSA_new(void);
+int netpgpv_DSA_size(const NETPGPV_DSA */*rsa*/);
+void netpgpv_DSA_free(NETPGPV_DSA */*dsa*/);
+NETPGPV_DSA_SIG *netpgpv_DSA_SIG_new(void);
+void netpgpv_DSA_SIG_free(NETPGPV_DSA_SIG */*sig*/);
+int netpgpv_DSA_do_verify(const unsigned char */*dgst*/, int /*dgst_len*/,
+ NETPGPV_DSA_SIG */*sig*/, NETPGPV_DSA */*dsa*/);
+NETPGPV_DSA_SIG *netpgpv_DSA_do_sign(const unsigned char */*dgst*/,
+ int /*dlen*/, NETPGPV_DSA */*dsa*/);
__END_DECLS
diff --git a/security/netpgpverify/files/verify.h b/security/netpgpverify/files/verify.h
index d772ec2acf1..c39bc2d04d4 100644
--- a/security/netpgpverify/files/verify.h
+++ b/security/netpgpverify/files/verify.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012-2019 Alistair Crooks <agc@NetBSD.org>
+ * Copyright (c) 2012-2020 Alistair Crooks <agc@NetBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -23,9 +23,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NETPGP_VERIFY_H_
-#define NETPGP_VERIFY_H_ 20191003
+#define NETPGP_VERIFY_H_ 20200503
-#define NETPGPVERIFY_VERSION "netpgpverify portable 20191003"
+#define NETPGPVERIFY_VERSION "netpgpverify portable 20200503"
#include <sys/types.h>
diff --git a/security/netpgpverify/files/zlib.c b/security/netpgpverify/files/zlib.c
index 6db633f9f1e..c96d1483e3b 100644
--- a/security/netpgpverify/files/zlib.c
+++ b/security/netpgpverify/files/zlib.c
@@ -1,4 +1,4 @@
-/* $NetBSD: zlib.c,v 1.2 2015/02/03 21:13:17 agc Exp $ */
+/* $NetBSD: zlib.c,v 1.3 2020/05/03 23:49:04 agc Exp $ */
/* inflate.c -- zlib decompression
* Copyright (C) 1995-2005 Mark Adler
@@ -34,23 +34,23 @@
* - Fix bug in reuse of allocated window after inflateReset()
* - Remove bit fields--back to byte structure for speed
* - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
- * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
+ * - Change post-increments to pre-increments in netpgpv_inflate_fast(), PPC biased?
* - Add compile time option, POSTINC, to use post-increments instead (Intel?)
- * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
+ * - Make MATCH copy in inflate() much faster for when netpgpv_inflate_fast() not used
* - Use local copies of stream next and avail values, as well as local bit
- * buffer and bit count in inflate()--for speed when inflate_fast() not used
+ * buffer and bit count in inflate()--for speed when netpgpv_inflate_fast() not used
*
* 1.2.beta4 1 Jan 2003
- * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
+ * - Split ptr - 257 statements in netpgpv_inflate_table() to avoid compiler warnings
* - Move a comment on output buffer sizes from inffast.c to inflate.c
- * - Add comments in inffast.c to introduce the inflate_fast() routine
- * - Rearrange window copies in inflate_fast() for speed and simplification
- * - Unroll last copy for window match in inflate_fast()
- * - Use local copies of window variables in inflate_fast() for speed
- * - Pull out common write == 0 case for speed in inflate_fast()
- * - Make op and len in inflate_fast() unsigned for consistency
- * - Add FAR to lcode and dcode declarations in inflate_fast()
- * - Simplified bad distance check in inflate_fast()
+ * - Add comments in inffast.c to introduce the netpgpv_inflate_fast() routine
+ * - Rearrange window copies in netpgpv_inflate_fast() for speed and simplification
+ * - Unroll last copy for window match in netpgpv_inflate_fast()
+ * - Use local copies of window variables in netpgpv_inflate_fast() for speed
+ * - Pull out common write == 0 case for speed in netpgpv_inflate_fast()
+ * - Make op and len in netpgpv_inflate_fast() unsigned for consistency
+ * - Add FAR to lcode and dcode declarations in netpgpv_inflate_fast()
+ * - Simplified bad distance check in netpgpv_inflate_fast()
* - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
* source file infback.c to provide a call-back interface to inflate for
* programs like gzip and unzip -- uses window as output buffer to avoid
@@ -237,14 +237,14 @@ struct inflate_state {
code codes[ENOUGH]; /* space for code tables */
};
-voidpf zcalloc(voidpf /*opaque*/, unsigned /*items*/, unsigned /*size*/);
-void zcfree (voidpf /*opaque*/, voidpf /*ptr*/);
-int inflate_table(codetype /*type*/, unsigned short FAR */*lens*/, unsigned /*codes*/,
+voidpf netpgpv_zcalloc(voidpf /*opaque*/, unsigned /*items*/, unsigned /*size*/);
+void netpgpv_zcfree (voidpf /*opaque*/, voidpf /*ptr*/);
+int netpgpv_inflate_table(codetype /*type*/, unsigned short FAR */*lens*/, unsigned /*codes*/,
code FAR * FAR */*table*/, unsigned FAR */*bits*/, unsigned short FAR */*work*/);
-void inflate_fast(z_streamp /*strm*/, unsigned /*start*/);
+void netpgpv_inflate_fast(z_streamp /*strm*/, unsigned /*start*/);
voidpf
-zcalloc (voidpf opaque, unsigned items, unsigned size)
+netpgpv_zcalloc (voidpf opaque, unsigned items, unsigned size)
{
if (opaque) items += size - size; /* make compiler happy */
return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
@@ -252,7 +252,7 @@ zcalloc (voidpf opaque, unsigned items, unsigned size)
}
void
-zcfree (voidpf opaque, voidpf ptr)
+netpgpv_zcfree (voidpf opaque, voidpf ptr)
{
free(ptr);
if (opaque) return; /* make compiler happy */
@@ -291,7 +291,7 @@ int ZEXPORT inflateReset(z_streamp strm)
return Z_OK;
}
-int ZEXPORT inflatePrime(z_streamp strm, int bits, int value)
+int ZEXPORT netpgpv_inflatePrime(z_streamp strm, int bits, int value)
{
struct inflate_state FAR *state;
@@ -314,10 +314,10 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, i
if (strm == Z_NULL) return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
- strm->zalloc = zcalloc;
+ strm->zalloc = netpgpv_zcalloc;
strm->opaque = (voidpf)0;
}
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ if (strm->zfree == (free_func)0) strm->zfree = netpgpv_zcfree;
state = (struct inflate_state FAR *)
ZALLOC(strm, 1, sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
@@ -361,7 +361,7 @@ int ZEXPORT inflateInit_( z_streamp strm, const char *version, int stream_size)
local void
fixedtables(struct inflate_state FAR *state)
{
-/* $NetBSD: zlib.c,v 1.2 2015/02/03 21:13:17 agc Exp $ */
+/* $NetBSD: zlib.c,v 1.3 2020/05/03 23:49:04 agc Exp $ */
/* inffixed.h -- table for decoding fixed codes
* Generated automatically by makefixed().
@@ -762,7 +762,7 @@ adler32(uLong adler, const Bytef *buf, uInt len)
longest code or if it is less than the shortest code.
*/
int
-inflate_table(codetype type, unsigned short FAR *lens, unsigned codes,
+netpgpv_inflate_table(codetype type, unsigned short FAR *lens, unsigned codes,
code FAR * FAR *table, unsigned FAR *bits, unsigned short FAR *work)
{
unsigned len; /* a code's length in bits */
@@ -1106,12 +1106,12 @@ inflate_table(codetype type, unsigned short FAR *lens, unsigned codes,
checking for available input while decoding.
- The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
+ bytes, which is the maximum length that can be coded. netpgpv_inflate_fast()
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
void
-inflate_fast(z_streamp strm, unsigned start)
+netpgpv_inflate_fast(z_streamp strm, unsigned start)
/* inflate()'s starting value for strm->avail_out */
{
struct inflate_state FAR *state;
@@ -1748,7 +1748,7 @@ inflate(z_streamp strm, int flush)
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
+ ret = netpgpv_inflate_table(CODES, state->lens, 19, &(state->next),
&(state->lenbits), state->work);
if (ret) {
strm->msg = __UNCONST("invalid code lengths set");
@@ -1814,7 +1814,7 @@ inflate(z_streamp strm, int flush)
state->next = state->codes;
state->lencode = (code const FAR *)(state->next);
state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
+ ret = netpgpv_inflate_table(LENS, state->lens, state->nlen, &(state->next),
&(state->lenbits), state->work);
if (ret) {
strm->msg = __UNCONST("invalid literal/lengths set");
@@ -1823,7 +1823,7 @@ inflate(z_streamp strm, int flush)
}
state->distcode = (code const FAR *)(state->next);
state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
+ ret = netpgpv_inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
strm->msg = __UNCONST("invalid distances set");
@@ -1835,7 +1835,7 @@ inflate(z_streamp strm, int flush)
case LEN:
if (have >= 6 && left >= 258) {
RESTORE();
- inflate_fast(strm, out);
+ netpgpv_inflate_fast(strm, out);
LOAD();
break;
}
@@ -2092,7 +2092,7 @@ inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
}
int ZEXPORT
-inflateGetHeader(z_streamp strm, gz_headerp head)
+netpgpv_inflateGetHeader(z_streamp strm, gz_headerp head)
{
struct inflate_state FAR *state;
diff --git a/security/netpgpverify/files/zlib.h b/security/netpgpverify/files/zlib.h
index c79c2d2ac2d..20ea9bca98a 100644
--- a/security/netpgpverify/files/zlib.h
+++ b/security/netpgpverify/files/zlib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: zlib.h,v 1.1 2013/03/16 07:32:35 agc Exp $ */
+/* $NetBSD: zlib.h,v 1.2 2020/05/03 23:49:04 agc Exp $ */
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.3, July 18th, 2005
@@ -35,7 +35,7 @@
#include "config.h"
-/* $NetBSD: zlib.h,v 1.1 2013/03/16 07:32:35 agc Exp $ */
+/* $NetBSD: zlib.h,v 1.2 2020/05/03 23:49:04 agc Exp $ */
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-2005 Jean-loup Gailly.
@@ -49,55 +49,58 @@
#include <sys/types.h>
+/* we don't want these colliding with anything else out there */
+#define Z_PREFIX 1
+
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
-# define deflateInit_ z_deflateInit_
-# define deflate z_deflate
-# define deflateEnd z_deflateEnd
-# define inflateInit_ z_inflateInit_
-# define inflate z_inflate
-# define inflateEnd z_inflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateCopy z_deflateCopy
-# define deflateReset z_deflateReset
-# define deflateParams z_deflateParams
-# define deflateBound z_deflateBound
-# define deflatePrime z_deflatePrime
-# define inflateInit2_ z_inflateInit2_
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateCopy z_inflateCopy
-# define inflateReset z_inflateReset
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# define uncompress z_uncompress
-# define adler32 z_adler32
-# define crc32 z_crc32
-# define get_crc_table z_get_crc_table
-# define zError z_zError
-
-# define alloc_func z_alloc_func
-# define free_func z_free_func
-# define in_func z_in_func
-# define out_func z_out_func
-# define Byte z_Byte
-# define uInt z_uInt
-# define uLong z_uLong
-# define Bytef z_Bytef
-# define charf z_charf
-# define intf z_intf
-# define uIntf z_uIntf
-# define uLongf z_uLongf
-# define voidpf z_voidpf
-# define voidp z_voidp
+# define deflateInit_ netpgpv_z_deflateInit_
+# define deflate netpgpv_z_deflate
+# define deflateEnd netpgpv_z_deflateEnd
+# define inflateInit_ netpgpv_z_inflateInit_
+# define inflate netpgpv_z_inflate
+# define inflateEnd netpgpv_z_inflateEnd
+# define deflateInit2_ netpgpv_z_deflateInit2_
+# define deflateSetDictionary netpgpv_z_deflateSetDictionary
+# define deflateCopy netpgpv_z_deflateCopy
+# define deflateReset netpgpv_z_deflateReset
+# define deflateParams netpgpv_z_deflateParams
+# define deflateBound netpgpv_z_deflateBound
+# define deflatePrime netpgpv_z_deflatePrime
+# define inflateInit2_ netpgpv_z_inflateInit2_
+# define inflateSetDictionary netpgpv_z_inflateSetDictionary
+# define inflateSync netpgpv_z_inflateSync
+# define inflateSyncPoint netpgpv_z_inflateSyncPoint
+# define inflateCopy netpgpv_z_inflateCopy
+# define inflateReset netpgpv_z_inflateReset
+# define inflateBack netpgpv_z_inflateBack
+# define inflateBackEnd netpgpv_z_inflateBackEnd
+# define compress netpgpv_z_compress
+# define compress2 netpgpv_z_compress2
+# define compressBound netpgpv_z_compressBound
+# define uncompress netpgpv_z_uncompress
+# define adler32 netpgpv_z_adler32
+# define crc32 netpgpv_z_crc32
+# define get_crc_table netpgpv_z_get_crc_table
+# define zError netpgpv_z_zError
+
+# define alloc_func netpgpv_z_alloc_func
+# define free_func netpgpv_z_free_func
+# define in_func netpgpv_z_in_func
+# define out_func netpgpv_z_out_func
+# define Byte netpgpv_z_Byte
+# define uInt netpgpv_z_uInt
+# define uLong netpgpv_z_uLong
+# define Bytef netpgpv_z_Bytef
+# define charf netpgpv_z_charf
+# define intf netpgpv_z_intf
+# define uIntf netpgpv_z_uIntf
+# define uLongf netpgpv_z_uLongf
+# define voidpf netpgpv_z_voidpf
+# define voidp netpgpv_z_voidp
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
@@ -1138,7 +1141,7 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
stream state was inconsistent (such as zalloc or state being NULL).
*/
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+ZEXTERN int ZEXPORT netpgpv_inflatePrime OF((z_streamp strm,
int bits,
int value));
/*
@@ -1150,15 +1153,15 @@ ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
inflateReset(). bits must be less than or equal to 16, and that many of the
least significant bits of value will be inserted in the input.
- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+ netpgpv_inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+ZEXTERN int ZEXPORT netpgpv_inflateGetHeader OF((z_streamp strm,
gz_headerp head));
/*
- inflateGetHeader() requests that gzip header information be stored in the
- provided gz_header structure. inflateGetHeader() may be called after
+ netpgpv_inflateGetHeader() requests that gzip header information be stored in the
+ provided gz_header structure. netpgpv_inflateGetHeader() may be called after
inflateInit2() or inflateReset(), and before the first call of inflate().
As inflate() processes the gzip stream, head->done is zero until the header
is completed, at which time head->done is set to one. If a zlib stream is
@@ -1184,13 +1187,13 @@ ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
allocated memory, then the application will need to save those pointers
elsewhere so that they can be eventually freed.
- If inflateGetHeader is not used, then the header information is simply
+ If netpgpv_inflateGetHeader is not used, then the header information is simply
discarded. The header is always checked for validity, including the header
CRC if present. inflateReset() will reset the process to discard the header
- information. The application would need to call inflateGetHeader() again to
+ information. The application would need to call netpgpv_inflateGetHeader() again to
retrieve the header from the next gzip stream.
- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+ netpgpv_inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
stream state was inconsistent.
*/