summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-02-26 21:43:15 +0000
committered <ed@FreeBSD.org>2009-02-26 21:43:15 +0000
commitfa4082de198dcb08fb0798fdf991d3c880c765e3 (patch)
tree5b0afd074d7bb26b1e443eb2abbda20979f70b42 /lib
parentbb22735cfd8d9750d7d63bbe7a69bb5e7f68060c (diff)
downloadFreeBSD-src-fa4082de198dcb08fb0798fdf991d3c880c765e3.zip
FreeBSD-src-fa4082de198dcb08fb0798fdf991d3c880c765e3.tar.gz
Rename all symbols in libmp(3) to mp_*, just like Solaris.
The function pow() in libmp(3) clashes with pow(3) in libm. We could rename this single function, but we can just take the same approach as the Solaris folks did, which is to prefix all function names with mp_. libmp(3) isn't really popular nowadays. I suspect not a single application in ports depends on it. There's still a chance, so I've increased the SHLIB_MAJOR and __FreeBSD_version. Reviewed by: deischen, rdivacky
Diffstat (limited to 'lib')
-rw-r--r--lib/libmp/Makefile7
-rw-r--r--lib/libmp/Symbol.map23
-rw-r--r--lib/libmp/libmp.390
-rw-r--r--lib/libmp/mp.h34
-rw-r--r--lib/libmp/mpasbn.c34
-rw-r--r--lib/libtelnet/Makefile2
6 files changed, 104 insertions, 86 deletions
diff --git a/lib/libmp/Makefile b/lib/libmp/Makefile
index 2aed4e9..6c51c57 100644
--- a/lib/libmp/Makefile
+++ b/lib/libmp/Makefile
@@ -1,14 +1,17 @@
# $FreeBSD$
LIB= mp
-SHLIB_MAJOR= 6
+SHLIB_MAJOR= 7
DPADD= ${LIBCRYPTO}
LDADD= -lcrypto
MAN= libmp.3
INCS= mp.h
SRCS= mpasbn.c
-WARNS?= 0
+WARNS?= 6
CFLAGS+= -I${.CURDIR}/../../crypto
+VERSION_DEF= ${.CURDIR}/../libc/Versions.def
+SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+
.include <bsd.lib.mk>
diff --git a/lib/libmp/Symbol.map b/lib/libmp/Symbol.map
new file mode 100644
index 0000000..0bd8684
--- /dev/null
+++ b/lib/libmp/Symbol.map
@@ -0,0 +1,23 @@
+/*
+ * $FreeBSD$
+ */
+
+FBSD_1.1 {
+ mp_gcd;
+ mp_itom;
+ mp_madd;
+ mp_mcmp;
+ mp_mdiv;
+ mp_mfree;
+ mp_min;
+ mp_mout;
+ mp_move;
+ mp_msqrt;
+ mp_msub;
+ mp_mtox;
+ mp_mult;
+ mp_pow;
+ mp_rpow;
+ mp_sdiv;
+ mp_xtom;
+};
diff --git a/lib/libmp/libmp.3 b/lib/libmp/libmp.3
index 9be21d7..b826aa8 100644
--- a/lib/libmp/libmp.3
+++ b/lib/libmp/libmp.3
@@ -70,47 +70,47 @@ stored using the defined type
Pointers to
.Vt MINT
are initialized using
-.Fn itom
+.Fn mp_itom
or
-.Fn xtom ,
+.Fn mp_xtom ,
and must be recycled with
-.Fn mfree
+.Fn mp_mfree
when they are no longer needed.
Routines which store a result in one of their arguments expect that
the latter has also been initialized prior to being passed to it.
The following routines are defined and implemented:
.Pp
.Ft "MINT *" Ns
-.Fn itom "short n" ;
+.Fn mp_itom "short n" ;
.Pp
.Ft "MINT *" Ns
-.Fn xtom "const char *s" ;
+.Fn mp_xtom "const char *s" ;
.Pp
.Ft "char *" Ns
-.Fn mtox "const MINT *mp" ;
+.Fn mp_mtox "const MINT *mp" ;
.Pp
.Ft void
-.Fn mfree "MINT *mp" ;
+.Fn mp_mfree "MINT *mp" ;
.Bd -ragged -offset indent
-.Fn itom
+.Fn mp_itom
returns an
.Vt MINT
with the value of
.Fa n .
-.Fn xtom
+.Fn mp_xtom
returns an
.Vt MINT
with the value of
.Fa s ,
which is treated to be in hexadecimal.
The return values from
-.Fn itom
+.Fn mp_itom
and
-.Fn xtom
+.Fn mp_xtom
must be released with
-.Fn mfree
+.Fn mp_mfree
when they are no longer needed.
-.Fn mtox
+.Fn mp_mtox
returns a null-terminated hexadecimal string having the value of
.Fa mp ;
its return value must be released with
@@ -120,18 +120,18 @@ when it is no longer needed.
.Ed
.Pp
.Ft void
-.Fn madd "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
+.Fn mp_madd "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
.Pp
.Ft void
-.Fn msub "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
+.Fn mp_msub "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
.Pp
.Ft void
-.Fn mult "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
+.Fn mp_mult "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
.Bd -ragged -offset indent
-.Fn madd ,
-.Fn msub ,
+.Fn mp_madd ,
+.Fn mp_msub ,
and
-.Fn mult
+.Fn mp_mult
store the sum, difference, or product, respectively, of
.Fa mp1
and
@@ -141,12 +141,12 @@ in
.Ed
.Pp
.Ft void
-.Fn mdiv "const MINT *nmp" "const MINT *dmp" "MINT *qmp" "MINT *rmp" ;
+.Fn mp_mdiv "const MINT *nmp" "const MINT *dmp" "MINT *qmp" "MINT *rmp" ;
.Pp
.Ft void
-.Fn sdiv "const MINT *nmp" "short d" "MINT *qmp" "short *ro" ;
+.Fn mp_sdiv "const MINT *nmp" "short d" "MINT *qmp" "short *ro" ;
.Bd -ragged -offset indent
-.Fn mdiv
+.Fn mp_mdiv
computes the quotient and remainder of
.Fa nmp
and
@@ -156,9 +156,9 @@ and stores the result in
and
.Fa rmp ,
respectively.
-.Fn sdiv
+.Fn mp_sdiv
is similar to
-.Fn mdiv
+.Fn mp_mdiv
except the divisor
.Fa ( dmp
or
@@ -171,12 +171,12 @@ are ordinary integers.
.Ed
.Pp
.Ft void
-.Fn pow "const MINT *bmp" "const MINT *emp" "const MINT *mmp" "MINT *rmp" ;
+.Fn mp_pow "const MINT *bmp" "const MINT *emp" "const MINT *mmp" "MINT *rmp" ;
.Pp
.Ft void
-.Fn rpow "const MINT *bmp" "short e" "MINT *rmp" ;
+.Fn mp_rpow "const MINT *bmp" "short e" "MINT *rmp" ;
.Bd -ragged -offset indent
-.Fn rpow
+.Fn mp_rpow
computes the result of
.Fa bmp
raised to the
@@ -185,7 +185,7 @@ power and reduced modulo
.Fa mmp ;
the result is stored in
.Fa rmp .
-.Fn pow
+.Fn mp_pow
computes the result of
.Fa bmp
raised to the
@@ -195,25 +195,25 @@ power and stores the result in
.Ed
.Pp
.Ft void
-.Fn min "MINT *mp" ;
+.Fn mp_min "MINT *mp" ;
.Pp
.Ft void
-.Fn mout "const MINT *mp" ;
+.Fn mp_mout "const MINT *mp" ;
.Bd -ragged -offset indent
-.Fn min
+.Fn mp_min
reads a line from standard input, tries to interpret it as a decimal
number, and if successful, stores the result in
.Fa mp .
-.Fn mout
+.Fn mp_mout
prints the value, in decimal, of
.Fa mp
to standard output (without a trailing newline).
.Ed
.Pp
.Ft void
-.Fn gcd "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
+.Fn mp_gcd "const MINT *mp1" "const MINT *mp2" "MINT *rmp" ;
.Bd -ragged -offset indent
-.Fn gcd
+.Fn mp_gcd
computes the greatest common divisor of
.Fa mp1
and
@@ -223,7 +223,7 @@ and stores the result in
.Ed
.Pp
.Ft int
-.Fn mcmp "const MINT *mp1" "const MINT *mp2" ;
+.Fn mp_mcmp "const MINT *mp1" "const MINT *mp2" ;
.Bd -ragged -offset indent
.Fa mcmp
compares the values of
@@ -243,9 +243,9 @@ is greater than
.Ed
.Pp
.Ft void
-.Fn move "const MINT *smp" "MINT *tmp" ;
+.Fn mp_move "const MINT *smp" "MINT *tmp" ;
.Bd -ragged -offset indent
-.Fn move
+.Fn mp_move
copies the value of
.Fa smp
to
@@ -254,9 +254,9 @@ to
.Ed
.Pp
.Ft void
-.Fn msqrt "const MINT *nmp" "MINT *xmp" "MINT *rmp" ;
+.Fn mp_msqrt "const MINT *nmp" "MINT *xmp" "MINT *rmp" ;
.Bd -ragged -offset indent
-.Fn msqrt
+.Fn mp_msqrt
computes the square root and remainder of
.Fa nmp
and stores them in
@@ -296,24 +296,16 @@ implemented in terms of
This implementation appeared in
.Fx 5.0 .
.Sh BUGS
-The
-.Fn pow
-routine exists in both
-.Nm libmp
-and
-.Nm libm
-with incompatible semantics.
-.Pp
Errors are reported via output to standard error and abnormal
program termination instead of via return values.
The application cannot control this behavior.
.Pp
It is not clear whether the string returned by
-.Fn mtox
+.Fn mp_mtox
may be written to by the caller.
This implementation allows it, but others may not.
Ideally,
-.Fn mtox
+.Fn mp_mtox
would take a pointer to a buffer to fill in.
.Pp
It is not clear whether using the same variable as both source and
diff --git a/lib/libmp/mp.h b/lib/libmp/mp.h
index 4c2c94d..78f09fd 100644
--- a/lib/libmp/mp.h
+++ b/lib/libmp/mp.h
@@ -11,22 +11,22 @@ typedef struct _mint {
BIGNUM *bn;
} MINT;
-void gcd(const MINT *, const MINT *, MINT *);
-MINT *itom(short);
-void madd(const MINT *, const MINT *, MINT *);
-int mcmp(const MINT *, const MINT *);
-void mdiv(const MINT *, const MINT *, MINT *, MINT *);
-void mfree(MINT *);
-void min(MINT *);
-void mout(const MINT *);
-void move(const MINT *, MINT *);
-void msqrt(const MINT *, MINT *, MINT *);
-void msub(const MINT *, const MINT *, MINT *);
-char *mtox(const MINT *);
-void mult(const MINT *, const MINT *, MINT *);
-void pow(const MINT *, const MINT *, const MINT *, MINT *);
-void rpow(const MINT *, short, MINT *);
-void sdiv(const MINT *, short, MINT *, short *);
-MINT *xtom(const char *);
+void mp_gcd(const MINT *, const MINT *, MINT *);
+MINT *mp_itom(short);
+void mp_madd(const MINT *, const MINT *, MINT *);
+int mp_mcmp(const MINT *, const MINT *);
+void mp_mdiv(const MINT *, const MINT *, MINT *, MINT *);
+void mp_mfree(MINT *);
+void mp_min(MINT *);
+void mp_mout(const MINT *);
+void mp_move(const MINT *, MINT *);
+void mp_msqrt(const MINT *, MINT *, MINT *);
+void mp_msub(const MINT *, const MINT *, MINT *);
+char *mp_mtox(const MINT *);
+void mp_mult(const MINT *, const MINT *, MINT *);
+void mp_pow(const MINT *, const MINT *, const MINT *, MINT *);
+void mp_rpow(const MINT *, short, MINT *);
+void mp_sdiv(const MINT *, short, MINT *, short *);
+MINT *mp_xtom(const char *);
#endif /* !_MP_H_ */
diff --git a/lib/libmp/mpasbn.c b/lib/libmp/mpasbn.c
index 797960d..bc5556d 100644
--- a/lib/libmp/mpasbn.c
+++ b/lib/libmp/mpasbn.c
@@ -140,7 +140,7 @@ _dtom(const char *msg, const char *s)
* Compute the greatest common divisor of mp1 and mp2; result goes in rmp.
*/
void
-gcd(const MINT *mp1, const MINT *mp2, MINT *rmp)
+mp_gcd(const MINT *mp1, const MINT *mp2, MINT *rmp)
{
BIGNUM b;
BN_CTX *c;
@@ -173,7 +173,7 @@ _itom(const char *msg, short n)
}
MINT *
-itom(short n)
+mp_itom(short n)
{
return (_itom("itom", n));
@@ -194,7 +194,7 @@ _madd(const char *msg, const MINT *mp1, const MINT *mp2, MINT *rmp)
}
void
-madd(const MINT *mp1, const MINT *mp2, MINT *rmp)
+mp_madd(const MINT *mp1, const MINT *mp2, MINT *rmp)
{
_madd("madd", mp1, mp2, rmp);
@@ -204,7 +204,7 @@ madd(const MINT *mp1, const MINT *mp2, MINT *rmp)
* Return -1, 0, or 1 if mp1<mp2, mp1==mp2, or mp1>mp2, respectivley.
*/
int
-mcmp(const MINT *mp1, const MINT *mp2)
+mp_mcmp(const MINT *mp1, const MINT *mp2)
{
return (BN_cmp(mp1->bn, mp2->bn));
@@ -239,7 +239,7 @@ _mdiv(const char *msg, const MINT *nmp, const MINT *dmp, MINT *qmp, MINT *rmp,
}
void
-mdiv(const MINT *nmp, const MINT *dmp, MINT *qmp, MINT *rmp)
+mp_mdiv(const MINT *nmp, const MINT *dmp, MINT *qmp, MINT *rmp)
{
BN_CTX *c;
@@ -263,7 +263,7 @@ _mfree(const char *msg __unused, MINT *mp)
}
void
-mfree(MINT *mp)
+mp_mfree(MINT *mp)
{
_mfree("mfree", mp);
@@ -277,7 +277,7 @@ mfree(MINT *mp)
* exported.)
*/
void
-min(MINT *mp)
+mp_min(MINT *mp)
{
MINT *rmp;
char *line, *nline;
@@ -302,7 +302,7 @@ min(MINT *mp)
* above min() for why this is so useless.
*/
void
-mout(const MINT *mp)
+mp_mout(const MINT *mp)
{
char *s;
@@ -315,7 +315,7 @@ mout(const MINT *mp)
* Set the value of tmp to the value of smp (i.e., tmp=smp).
*/
void
-move(const MINT *smp, MINT *tmp)
+mp_move(const MINT *smp, MINT *tmp)
{
_movem("move", smp, tmp);
@@ -357,7 +357,7 @@ _movem(const char *msg, const MINT *smp, MINT *tmp)
* although suboptimal, works, too; this is that is used below.
*/
void
-msqrt(const MINT *nmp, MINT *xmp, MINT *rmp)
+mp_msqrt(const MINT *nmp, MINT *xmp, MINT *rmp)
{
BN_CTX *c;
MINT *tolerance;
@@ -409,7 +409,7 @@ _msub(const char *msg, const MINT *mp1, const MINT *mp2, MINT *rmp)
}
void
-msub(const MINT *mp1, const MINT *mp2, MINT *rmp)
+mp_msub(const MINT *mp1, const MINT *mp2, MINT *rmp)
{
_msub("msub", mp1, mp2, rmp);
@@ -467,7 +467,7 @@ _mtox(const char *msg, const MINT *mp)
}
char *
-mtox(const MINT *mp)
+mp_mtox(const MINT *mp)
{
return (_mtox("mtox", mp));
@@ -488,7 +488,7 @@ _mult(const char *msg, const MINT *mp1, const MINT *mp2, MINT *rmp, BN_CTX *c)
}
void
-mult(const MINT *mp1, const MINT *mp2, MINT *rmp)
+mp_mult(const MINT *mp1, const MINT *mp2, MINT *rmp)
{
BN_CTX *c;
@@ -504,7 +504,7 @@ mult(const MINT *mp1, const MINT *mp2, MINT *rmp)
* means 'raise to power', not 'bitwise XOR'.)
*/
void
-pow(const MINT *bmp, const MINT *emp, const MINT *mmp, MINT *rmp)
+mp_pow(const MINT *bmp, const MINT *emp, const MINT *mmp, MINT *rmp)
{
BIGNUM b;
BN_CTX *c;
@@ -523,7 +523,7 @@ pow(const MINT *bmp, const MINT *emp, const MINT *mmp, MINT *rmp)
* Compute rmp=bmp^e. (See note above pow().)
*/
void
-rpow(const MINT *bmp, short e, MINT *rmp)
+mp_rpow(const MINT *bmp, short e, MINT *rmp)
{
MINT *emp;
BIGNUM b;
@@ -572,7 +572,7 @@ _sdiv(const char *msg, const MINT *nmp, short d, MINT *qmp, short *ro,
}
void
-sdiv(const MINT *nmp, short d, MINT *qmp, short *ro)
+mp_sdiv(const MINT *nmp, short d, MINT *qmp, short *ro)
{
BN_CTX *c;
@@ -602,7 +602,7 @@ _xtom(const char *msg, const char *s)
}
MINT *
-xtom(const char *s)
+mp_xtom(const char *s)
{
return (_xtom("xtom", s));
diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile
index 37eb8f6..1cf52a0 100644
--- a/lib/libtelnet/Makefile
+++ b/lib/libtelnet/Makefile
@@ -13,7 +13,7 @@ INTERNALLIB=
SRCS= genget.c getent.c misc.c
CFLAGS+= -I${TELNETDIR}
-WARNS?= 0
+WARNS?= 2
.if !defined(RELEASE_CRUNCH)
.if ${MK_OPENSSL} != "no"
OpenPOWER on IntegriCloud