diff options
author | simon <simon@FreeBSD.org> | 2010-03-13 19:22:41 +0000 |
---|---|---|
committer | simon <simon@FreeBSD.org> | 2010-03-13 19:22:41 +0000 |
commit | 0d816bbd980d8201a2ad23ccd05f7bde16565282 (patch) | |
tree | 909a7c21b7df72ae8c08b80b468a4dd75b3820be /crypto/openssl/fips/des/fips_desmovs.c | |
parent | 7fd3bd147ec574621124307eca10ead5353e34ba (diff) | |
parent | cdb6eef1f013e22a10ab5f5829dcdc3b5e32d385 (diff) | |
download | FreeBSD-src-0d816bbd980d8201a2ad23ccd05f7bde16565282.zip FreeBSD-src-0d816bbd980d8201a2ad23ccd05f7bde16565282.tar.gz |
Merge OpenSSL 0.9.8m into head.
This also "reverts" some FreeBSD local changes so we should now
be back to using entirely stock OpenSSL. The local changes were
simple $FreeBSD$ lines additions, which were required in the CVS
days, and the patch for FreeBSD-SA-09:15.ssl which has been
superseded with OpenSSL 0.9.8m's RFC5746 'TLS renegotiation
extension' support.
MFC after: 3 weeks
Diffstat (limited to 'crypto/openssl/fips/des/fips_desmovs.c')
-rw-r--r-- | crypto/openssl/fips/des/fips_desmovs.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/crypto/openssl/fips/des/fips_desmovs.c b/crypto/openssl/fips/des/fips_desmovs.c index 2d3424c..f96a5ca 100644 --- a/crypto/openssl/fips/des/fips_desmovs.c +++ b/crypto/openssl/fips/des/fips_desmovs.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) #define VERBOSE 0 -int DESTest(EVP_CIPHER_CTX *ctx, +static int DESTest(EVP_CIPHER_CTX *ctx, char *amode, int akeysz, unsigned char *aKey, unsigned char *iVec, int dir, /* 0 = decrypt, 1 = encrypt */ @@ -110,15 +110,10 @@ int DESTest(EVP_CIPHER_CTX *ctx, cipher = EVP_des_ede3_cfb64(); else if (strncasecmp(amode, "OFB", 3) == 0) cipher = EVP_des_ede3_ofb(); -#if 0 - else if(!strcasecmp(amode,"CFB1")) - { - ctx->cbits = 1; - ctx->cmode = EVP_CIPH_CFB_MODE; - } -#endif else if(!strcasecmp(amode,"CFB8")) cipher = EVP_des_ede3_cfb8(); + else if(!strcasecmp(amode,"CFB1")) + cipher = EVP_des_ede3_cfb1(); else { printf("Unknown mode: %s\n", amode); @@ -127,20 +122,22 @@ int DESTest(EVP_CIPHER_CTX *ctx, if (EVP_CipherInit_ex(ctx, cipher, NULL, aKey, iVec, dir) <= 0) return 0; + if(!strcasecmp(amode,"CFB1")) + M_EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS); EVP_Cipher(ctx, out, in, len); return 1; } - -void DebugValue(char *tag, unsigned char *val, int len) +#if 0 +static void DebugValue(char *tag, unsigned char *val, int len) { char obuf[2048]; int olen; olen = bin2hex(val, len, obuf); printf("%s = %.*s\n", tag, olen, obuf); } - -void shiftin(unsigned char *dst,unsigned char *src,int nbits) +#endif +static void shiftin(unsigned char *dst,unsigned char *src,int nbits) { int n; @@ -160,7 +157,7 @@ char *t_mode[6] = {"CBC","ECB","OFB","CFB1","CFB8","CFB64"}; enum Mode {CBC, ECB, OFB, CFB1, CFB8, CFB64}; int Sizes[6]={64,64,64,1,8,64}; -void do_mct(char *amode, +static void do_mct(char *amode, int akeysz, int numkeys, unsigned char *akey,unsigned char *ivec, int dir, unsigned char *text, int len, FILE *rfp) @@ -200,11 +197,11 @@ void do_mct(char *amode, if(imode != ECB) OutputValue("IV",ivec,8,rfp,0); OutputValue(t_tag[dir^1],text,len,rfp,imode == CFB1); - +#if 0 /* compensate for endianness */ if(imode == CFB1) text[0]<<=7; - +#endif memcpy(text0,text,8); for(j=0 ; j < 10000 ; ++j) @@ -267,7 +264,7 @@ void do_mct(char *amode, } } -int proc_file(char *rqfile, char *rspfile) +static int proc_file(char *rqfile, char *rspfile) { char afn[256], rfn[256]; FILE *afp = NULL, *rfp = NULL; @@ -535,7 +532,7 @@ int proc_file(char *rqfile, char *rspfile) err =1; break; } - if (len >= sizeof(plaintext)) + if (len >= (int)sizeof(plaintext)) { printf("Buffer overflow\n"); } |