Message digest stuff.
This commit is contained in:
parent
79df9d6272
commit
d02f751ce1
34 changed files with 67 additions and 24 deletions
|
@ -64,6 +64,7 @@
|
|||
#define HASH SHA1
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "cryptlib.h"
|
||||
|
@ -328,4 +329,4 @@ err:
|
|||
|
||||
return(ok);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_SHA
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include "cryptlib.h"
|
||||
|
@ -108,4 +109,4 @@ err:
|
|||
if (ctx != NULL) BN_CTX_free(ctx);
|
||||
return(ok);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -143,3 +144,4 @@ static void des_cbc_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
&(ctx->iv[0]),
|
||||
ctx->encrypt);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -98,3 +99,4 @@ static void des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
{
|
||||
des_ncbc_encrypt(in,out,inl,ctx->c.des_ks,&(ctx->iv[0]),ctx->encrypt);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -146,3 +147,4 @@ static void des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
ctx->c.des_ede.ks3,
|
||||
&(ctx->iv[0]),&ctx->num,ctx->encrypt);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include <openssl/evp.h>
|
||||
#include <openssl/objects.h>
|
||||
|
||||
#ifndef NO_DES
|
||||
static void des_cfb_init_key(EVP_CIPHER_CTX *ctx, unsigned char *key,
|
||||
unsigned char *iv,int enc);
|
||||
static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
|
@ -104,3 +105,4 @@ static void des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
&(ctx->iv[0]),
|
||||
&ctx->num,ctx->encrypt);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -142,3 +143,4 @@ static void des_ede_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
ctx->encrypt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -102,3 +103,4 @@ static void des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
des_ecb_encrypt(&(in[i]),&(out[i]),ctx->c.des_ks,ctx->encrypt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -144,3 +145,4 @@ static void des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
ctx->c.des_ede.ks2, ctx->c.des_ede.ks3,
|
||||
&(ctx->iv[0]),&ctx->num);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -100,3 +101,4 @@ static void des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
{
|
||||
des_ofb64_encrypt(in,out,inl,ctx->c.des_ks,&(ctx->iv[0]),&ctx->num);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_DES
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -106,3 +107,4 @@ static void desx_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
|||
&(ctx->c.desx_cbc.outw[0]),
|
||||
ctx->encrypt);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -82,7 +82,7 @@ char *EVP_get_pw_prompt(void)
|
|||
}
|
||||
|
||||
#ifdef NO_DES
|
||||
int des_read_pw_string(char *buf,int len,char *prompt,int verify);
|
||||
int des_read_pw_string(char *buf,int len,const char *prompt,int verify);
|
||||
#endif
|
||||
|
||||
int EVP_read_pw_string(char *buf, int len, const char *prompt, int verify)
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
#ifndef NO_SHA
|
||||
static EVP_MD dsa_md=
|
||||
{
|
||||
NID_dsaWithSHA,
|
||||
|
@ -79,4 +80,4 @@ EVP_MD *EVP_dss(void)
|
|||
{
|
||||
return(&dsa_md);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_SHA
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -79,3 +80,4 @@ EVP_MD *EVP_dss1(void)
|
|||
{
|
||||
return(&dss1_md);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_MD2
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -79,4 +80,4 @@ EVP_MD *EVP_md2(void)
|
|||
{
|
||||
return(&md2_md);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_MD5
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -79,3 +80,4 @@ EVP_MD *EVP_md5(void)
|
|||
{
|
||||
return(&md5_md);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_MDC2
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -79,3 +80,4 @@ EVP_MD *EVP_mdc2(void)
|
|||
{
|
||||
return(&mdc2_md);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_SHA
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -79,4 +80,4 @@ EVP_MD *EVP_sha(void)
|
|||
{
|
||||
return(&sha_md);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef NO_SHA
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/evp.h>
|
||||
|
@ -79,3 +80,4 @@ EVP_MD *EVP_sha1(void)
|
|||
{
|
||||
return(&sha1_md);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -77,7 +77,7 @@ clean:
|
|||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
md_rand.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
|
||||
md_rand.o: ../../include/openssl/md5.h ../../include/openssl/opensslv.h
|
||||
md_rand.o: ../../include/openssl/rand.h ../../include/openssl/stack.h
|
||||
md_rand.o: ../../include/openssl/opensslv.h ../../include/openssl/rand.h
|
||||
md_rand.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
|
||||
rand_lib.o: ../../include/openssl/rand.h
|
||||
randfile.o: ../../include/openssl/e_os.h ../../include/openssl/rand.h
|
||||
|
|
|
@ -64,16 +64,16 @@
|
|||
#include <openssl/crypto.h>
|
||||
|
||||
#if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND)
|
||||
#ifndef NO_MD5
|
||||
#define USE_MD5_RAND
|
||||
#elif !defined(NO_SHA1)
|
||||
#if !defined(NO_SHA) && !defined(NO_SHA1)
|
||||
#define USE_SHA1_RAND
|
||||
#elif !defined(NO_MDC2)
|
||||
#elif !defined(NO_MD5)
|
||||
#define USE_MD5_RAND
|
||||
#elif !defined(NO_MDC2) && !defined(NO_DES)
|
||||
#define USE_MDC2_RAND
|
||||
#elif !defined(NO_MD2)
|
||||
#define USE_MD2_RAND
|
||||
#else
|
||||
We need a message digest of some type
|
||||
#error No message digest algorithm available
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
/* EME_OAEP as defined in RFC 2437 (PKCS #1 v2.0) */
|
||||
|
||||
#ifndef NO_SHA
|
||||
#if !defined(NO_SHA) && !defined(NO_SHA1)
|
||||
#include <stdio.h>
|
||||
#include "cryptlib.h"
|
||||
#include <openssl/bn.h>
|
||||
|
|
|
@ -90,16 +90,16 @@ typedef struct SHAstate_st
|
|||
|
||||
#ifndef NO_SHA0
|
||||
void SHA_Init(SHA_CTX *c);
|
||||
void SHA_Update(SHA_CTX *c, unsigned char *data, unsigned long len);
|
||||
void SHA_Update(SHA_CTX *c, const unsigned char *data, unsigned long len);
|
||||
void SHA_Final(unsigned char *md, SHA_CTX *c);
|
||||
unsigned char *SHA(unsigned char *d, unsigned long n,unsigned char *md);
|
||||
unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md);
|
||||
void SHA_Transform(SHA_CTX *c, unsigned char *data);
|
||||
#endif
|
||||
#ifndef NO_SHA1
|
||||
void SHA1_Init(SHA_CTX *c);
|
||||
void SHA1_Update(SHA_CTX *c, unsigned char *data, unsigned long len);
|
||||
void SHA1_Update(SHA_CTX *c, const unsigned char *data, unsigned long len);
|
||||
void SHA1_Final(unsigned char *md, SHA_CTX *c);
|
||||
unsigned char *SHA1(unsigned char *d, unsigned long n,unsigned char *md);
|
||||
unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md);
|
||||
void SHA1_Transform(SHA_CTX *c, unsigned char *data);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
#include <openssl/sha.h>
|
||||
|
||||
#ifndef NO_SHA1
|
||||
unsigned char *SHA1(unsigned char *d, unsigned long n, unsigned char *md)
|
||||
unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md)
|
||||
{
|
||||
SHA_CTX c;
|
||||
static unsigned char m[SHA_DIGEST_LENGTH];
|
||||
|
|
|
@ -114,7 +114,7 @@ void SHA1_Init(SHA_CTX *c)
|
|||
c->num=0;
|
||||
}
|
||||
|
||||
void SHA1_Update(SHA_CTX *c, register unsigned char *data,
|
||||
void SHA1_Update(SHA_CTX *c, const register unsigned char *data,
|
||||
unsigned long len)
|
||||
{
|
||||
register SHA_LONG *p;
|
||||
|
|
|
@ -100,7 +100,8 @@ void SHA_Init(SHA_CTX *c)
|
|||
c->num=0;
|
||||
}
|
||||
|
||||
void SHA_Update(SHA_CTX *c, register unsigned char *data, unsigned long len)
|
||||
void SHA_Update(SHA_CTX *c, const register unsigned char *data,
|
||||
unsigned long len)
|
||||
{
|
||||
register SHA_LONG *p;
|
||||
int ew,ec,sw,sc;
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
#include <openssl/sha.h>
|
||||
|
||||
#ifndef NO_SHA0
|
||||
unsigned char *SHA(unsigned char *d, unsigned long n, unsigned char *md)
|
||||
unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md)
|
||||
{
|
||||
SHA_CTX c;
|
||||
static unsigned char m[SHA_DIGEST_LENGTH];
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include <stdio.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/md5.h>
|
||||
#include "ssl_locl.h"
|
||||
|
||||
static long ssl2_default_timeout(void );
|
||||
|
|
|
@ -60,6 +60,8 @@
|
|||
#include <openssl/buffer.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
#include "ssl_locl.h"
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
#include "ssl_locl.h"
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/objects.h>
|
||||
#include "ssl_locl.h"
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#include <openssl/buffer.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "ssl_locl.h"
|
||||
|
|
|
@ -85,11 +85,11 @@ int SSL_library_init(void)
|
|||
EVP_add_digest_alias(SN_md5,"ssl2-md5");
|
||||
EVP_add_digest_alias(SN_md5,"ssl3-md5");
|
||||
#endif
|
||||
#ifndef NO_SHA1
|
||||
#ifndef NO_SHA
|
||||
EVP_add_digest(EVP_sha1()); /* RSA with sha1 */
|
||||
EVP_add_digest_alias(SN_sha1,"ssl3-sha1");
|
||||
#endif
|
||||
#if !defined(NO_SHA1) && !defined(NO_DSA)
|
||||
#if !defined(NO_SHA) && !defined(NO_DSA)
|
||||
EVP_add_digest(EVP_dss1()); /* DSA with sha1 */
|
||||
#endif
|
||||
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <openssl/comp.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include "ssl_locl.h"
|
||||
|
|
Loading…
Reference in a new issue