miracl去除某些特殊信息

时间:2021-11-03 18:03:43

只需要在mirdef.h中增加定义

#define MR_STRIPPED_DOWN 

即可在编译的时候,去掉错误信息

#define MIRACL 32
#define MR_LITTLE_ENDIAN    /* This may need to be changed        */
#define mr_utype int
                            /* the underlying type is usually int *
                             * but see mrmuldv.any                */
#define mr_unsign32 unsigned int
                            /* 32 bit unsigned type               */
#define MR_IBITS      32    /* bits in int  */
#define MR_LBITS      32    /* bits in long */
#define MR_FLASH      52
                            /* delete this definition if integer  *
                             * only version of MIRACL required    */
                            /* Number of bits per double mantissa */

#define mr_dltype __int64   /* ... or long long for Unix/Linux */
#define mr_unsign64 unsigned __int64

#define MAXBASE ((mr_small)1<<(MIRACL-1))

#define MR_STRIPPED_DOWN

在mrcore.c文件中的mr_berror函数中会判断这个定义

#ifndef MR_STRIPPED_DOWN
mputs((char *)"\nMIRACL error from routine ");
if (mr_mip->depth<MR_MAXDEPTH) mputs(names[mr_mip->trace[mr_mip->depth]]);
else                           mputs((char *)"???");
fputc('\n',stdout);

for (i=mr_mip->depth-1;i>=0;i--)
{
    mputs((char *)"              called from ");
    if (i<MR_MAXDEPTH) mputs(names[mr_mip->trace[i]]);
    else               mputs((char *)"???");
    fputc('\n',stdout);
}

同时,最好也修改另外一处提示字符串

#else
mputs((char *)"MIRACL error\n");
exit(0);
#endif

这个字符串最好也替换一下,这样编译出来的miracl就没有任何明显的提示了。