From 5d3d83bffd8ad028b278038c372e124efd65d905 Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 5 Oct 2001 05:05:28 +0000 Subject: [PATCH] Remove swab'ed versions of sethex routines, not yet needed. CVS patchset: 5095 CVS date: 2001/10/05 05:05:28 --- beecrypt/base64.c | 5 +++-- beecrypt/mp32barrett.c | 61 -------------------------------------------------- beecrypt/mp32barrett.h | 6 ----- beecrypt/mp32number.c | 52 ------------------------------------------ beecrypt/mp32number.h | 6 ----- 5 files changed, 3 insertions(+), 127 deletions(-) diff --git a/beecrypt/base64.c b/beecrypt/base64.c index e5e0585..a6f54f9 100644 --- a/beecrypt/base64.c +++ b/beecrypt/base64.c @@ -136,7 +136,7 @@ const char * b64decode_whitespace = B64DECODE_WHITESPACE; /*@-internalglobs -modfilesys @*/ int b64decode (const char * s, void ** datap, int *lenp) { - unsigned char b64dec[255]; + unsigned char b64dec[256]; const unsigned char *t; unsigned char *te; int ns, nt; @@ -170,6 +170,7 @@ int b64decode (const char * s, void ** datap, int *lenp) for (t = s; *t != '\0'; t++) { switch (b64dec[ (unsigned)*t ]) { case 0x80: /* invalid chararcter */ +fprintf(stderr, "--- b64decode %c(%02x) %02x\n", *t, (*t & 0xff), b64dec[ (unsigned)*t ]); return 3; /*@notreached@*/ /*@switchbreak@*/ break; case 0x81: /* white space */ @@ -214,7 +215,7 @@ fprintf(stderr, "%7u %02x %02x %02x %02x -> %02x %02x %02x\n", if (ns != 0) { /* XXX can't happen, just in case */ if (t) free((void *)t); - return 3; + return 1; } if (lenp) *lenp = (te - t); diff --git a/beecrypt/mp32barrett.c b/beecrypt/mp32barrett.c index 438d077..b5e8731 100644 --- a/beecrypt/mp32barrett.c +++ b/beecrypt/mp32barrett.c @@ -226,67 +226,6 @@ void mp32bsethex(mp32barrett* b, const char* hex) } /*@=nullstate =compdef @*/ -/*@-nullstate -compdef @*/ /* b->modl may be null @*/ -void mp32bswabhex(mp32barrett* b, const char* hex) -{ - uint32 length = strlen(hex); - uint32 size = (length+7) >> 3; - uint8 rem = (uint8)(length & 0x7); - - if (b->modl) - { - if (b->size != size) - b->modl = (uint32*) realloc(b->modl, (2*size+1) * sizeof(uint32)); - } - else - b->modl = (uint32*) malloc((2*size+1) * sizeof(uint32)); - - if (b->modl != (uint32*) 0) - { - register uint32 val = 0; - register uint32* dst = b->modl; - register uint32* temp = (uint32*) malloc((6*size+4) * sizeof(uint32)); - register char ch; - - b->size = size; - b->mu = b->modl+size; - - while (length-- > 0) - { - ch = *(hex++); - val <<= 4; - if (ch >= '0' && ch <= '9') - val += (ch - '0'); - else if (ch >= 'A' && ch <= 'F') - val += (ch - 'A') + 10; - else if (ch >= 'a' && ch <= 'f') - val += (ch - 'a') + 10; - else - {}; - - if ((length & 0x7) == 0) - { - *(dst++) = swapu32(val); - val = 0; - } - } - if (rem != 0) - *dst = swapu32(val); - - /*@-nullpass@*/ /* temp may be NULL */ - mp32bmu_w(b, temp); - - free(temp); - /*@=nullpass@*/ - } - else - { - b->size = 0; - b->mu = 0; - } -} -/*@=nullstate =compdef @*/ - /** * Computes the Barrett 'mu' coefficient. * needs workspace of (6*size+4) words diff --git a/beecrypt/mp32barrett.h b/beecrypt/mp32barrett.h index 0b77987..8b8a566 100644 --- a/beecrypt/mp32barrett.h +++ b/beecrypt/mp32barrett.h @@ -82,12 +82,6 @@ void mp32bsethex(mp32barrett* b, const char* hex) /** */ -BEEDLLAPI /*@unused@*/ -void mp32bswabhex(mp32barrett* b, const char* hex) - /*@modifies b->size, b->modl, b->mu @*/; - -/** - */ BEEDLLAPI void mp32bsubone(const mp32barrett* b, uint32* result) /*@modifies result @*/; diff --git a/beecrypt/mp32number.c b/beecrypt/mp32number.c index 3cd9755..a4c766d 100644 --- a/beecrypt/mp32number.c +++ b/beecrypt/mp32number.c @@ -229,55 +229,3 @@ void mp32nsethex(mp32number* n, const char* hex) } } /*@=nullstate =compdef @*/ - -/*@-nullstate -compdef @*/ /* n->data may be NULL */ -void mp32nswabhex(mp32number* n, const char* hex) -{ - uint32 length = strlen(hex); - uint32 size = (length+7) >> 3; - uint8 rem = (uint8)(length & 0x7); - - if (n->data) - { - if (n->size != size) - n->data = (uint32*) realloc(n->data, size * sizeof(uint32)); - } - else - n->data = (uint32*) malloc(size * sizeof(uint32)); - - if (n->data) - { - register uint32 val = 0; - register uint32* dst = n->data; - register char ch; - - n->size = size; - - while (length-- > 0) - { - ch = *(hex++); - val <<= 4; - if (ch >= '0' && ch <= '9') - val += (ch - '0'); - else if (ch >= 'A' && ch <= 'F') - val += (ch - 'A') + 10; - else if (ch >= 'a' && ch <= 'f') - val += (ch - 'a') + 10; - else - {}; - - if ((length & 0x7) == 0) - { - *(dst++) = swapu32(val); - val = 0; - } - } - if (rem != 0) - *dst = swapu32(val); - } - else { - n->size = 0; - n->data = (uint32*)0; - } -} -/*@=nullstate =compdef @*/ diff --git a/beecrypt/mp32number.h b/beecrypt/mp32number.h index d091fff..f2cfc2b 100644 --- a/beecrypt/mp32number.h +++ b/beecrypt/mp32number.h @@ -98,12 +98,6 @@ BEEDLLAPI /*@unused@*/ void mp32nsethex(mp32number* n, const char* hex) /*@modifies n->size, n->data @*/; -/** - */ -BEEDLLAPI /*@unused@*/ -void mp32nswabhex(mp32number* n, const char* hex) - /*@modifies n->size, n->data @*/; - #ifdef __cplusplus } #endif -- 2.7.4