OpenSSL FIPS module to prevent forbidden digests to be allowed.
No functional change but readability.
ok deraadt@
void OPENSSL_init(void);
-#define fips_md_init(alg) fips_md_init_ctx(alg, alg)
-
-#define fips_md_init_ctx(alg, cx) \
- int alg##_Init(cx##_CTX *c)
-#define fips_cipher_abort(alg) while(0)
-
/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
* takes an amount of time dependent on |len|, but independent of the contents
* of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
#define INIT_DATA_C (unsigned long)0x98badcfeL
#define INIT_DATA_D (unsigned long)0x10325476L
-fips_md_init(MD4)
+int MD4_Init(MD4_CTX *c)
{
memset (c,0,sizeof(*c));
c->A=INIT_DATA_A;
#define INIT_DATA_C (unsigned long)0x98badcfeL
#define INIT_DATA_D (unsigned long)0x10325476L
-fips_md_init(MD5)
+int MD5_Init(MD5_CTX *c)
{
memset (c,0,sizeof(*c));
c->A=INIT_DATA_A;
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len);
-fips_md_init(MDC2)
+int MDC2_Init(MDC2_CTX *c)
{
c->num=0;
c->pad_type=1;
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num);
# endif
-fips_md_init(RIPEMD160)
+int RIPEMD160_Init(RIPEMD160_CTX *c)
{
memset (c,0,sizeof(*c));
c->A=RIPEMD160_A;
const char SHA256_version[]="SHA-256" OPENSSL_VERSION_PTEXT;
-fips_md_init_ctx(SHA224, SHA256)
+int SHA224_Init(SHA256_CTX *c)
{
memset (c,0,sizeof(*c));
c->h[0]=0xc1059ed8UL; c->h[1]=0x367cd507UL;
return 1;
}
-fips_md_init(SHA256)
+int SHA256_Init(SHA256_CTX *c)
{
memset (c,0,sizeof(*c));
c->h[0]=0x6a09e667UL; c->h[1]=0xbb67ae85UL;
#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
#endif
-fips_md_init_ctx(SHA384, SHA512)
+int SHA384_Init(SHA512_CTX *c)
{
c->h[0]=U64(0xcbbb9d5dc1059ed8);
c->h[1]=U64(0x629a292a367cd507);
return 1;
}
-fips_md_init(SHA512)
+int SHA512_Init(SHA512_CTX *c)
{
c->h[0]=U64(0x6a09e667f3bcc908);
c->h[1]=U64(0xbb67ae8584caa73b);
#define INIT_DATA_h4 0xc3d2e1f0UL
#ifdef SHA_0
-fips_md_init(SHA)
+int SHA_Init(SHA_CTX *c)
#else
-fips_md_init_ctx(SHA1, SHA)
+int SHA1_Init(SHA_CTX *c)
#endif
{
memset (c,0,sizeof(*c));
#include <openssl/crypto.h>
#include <string.h>
-fips_md_init(WHIRLPOOL)
+int WHIRLPOOL_Init(WHIRLPOOL_CTX *c)
{
memset (c,0,sizeof(*c));
return(1);
void OPENSSL_init(void);
-#define fips_md_init(alg) fips_md_init_ctx(alg, alg)
-
-#define fips_md_init_ctx(alg, cx) \
- int alg##_Init(cx##_CTX *c)
-#define fips_cipher_abort(alg) while(0)
-
/* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal. It
* takes an amount of time dependent on |len|, but independent of the contents
* of |a| and |b|. Unlike memcmp, it cannot be used to put elements into a
#define INIT_DATA_C (unsigned long)0x98badcfeL
#define INIT_DATA_D (unsigned long)0x10325476L
-fips_md_init(MD4)
+int MD4_Init(MD4_CTX *c)
{
memset (c,0,sizeof(*c));
c->A=INIT_DATA_A;
#define INIT_DATA_C (unsigned long)0x98badcfeL
#define INIT_DATA_D (unsigned long)0x10325476L
-fips_md_init(MD5)
+int MD5_Init(MD5_CTX *c)
{
memset (c,0,sizeof(*c));
c->A=INIT_DATA_A;
*((c)++)=(unsigned char)(((l)>>24L)&0xff))
static void mdc2_body(MDC2_CTX *c, const unsigned char *in, size_t len);
-fips_md_init(MDC2)
+int MDC2_Init(MDC2_CTX *c)
{
c->num=0;
c->pad_type=1;
void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num);
# endif
-fips_md_init(RIPEMD160)
+int RIPEMD160_Init(RIPEMD160_CTX *c)
{
memset (c,0,sizeof(*c));
c->A=RIPEMD160_A;
const char SHA256_version[]="SHA-256" OPENSSL_VERSION_PTEXT;
-fips_md_init_ctx(SHA224, SHA256)
+int SHA224_Init(SHA256_CTX *c)
{
memset (c,0,sizeof(*c));
c->h[0]=0xc1059ed8UL; c->h[1]=0x367cd507UL;
return 1;
}
-fips_md_init(SHA256)
+int SHA256_Init(SHA256_CTX *c)
{
memset (c,0,sizeof(*c));
c->h[0]=0x6a09e667UL; c->h[1]=0xbb67ae85UL;
#define SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
#endif
-fips_md_init_ctx(SHA384, SHA512)
+int SHA384_Init(SHA512_CTX *c)
{
c->h[0]=U64(0xcbbb9d5dc1059ed8);
c->h[1]=U64(0x629a292a367cd507);
return 1;
}
-fips_md_init(SHA512)
+int SHA512_Init(SHA512_CTX *c)
{
c->h[0]=U64(0x6a09e667f3bcc908);
c->h[1]=U64(0xbb67ae8584caa73b);
#define INIT_DATA_h4 0xc3d2e1f0UL
#ifdef SHA_0
-fips_md_init(SHA)
+int SHA_Init(SHA_CTX *c)
#else
-fips_md_init_ctx(SHA1, SHA)
+int SHA1_Init(SHA_CTX *c)
#endif
{
memset (c,0,sizeof(*c));
#include <openssl/crypto.h>
#include <string.h>
-fips_md_init(WHIRLPOOL)
+int WHIRLPOOL_Init(WHIRLPOOL_CTX *c)
{
memset (c,0,sizeof(*c));
return(1);