use hash size constants from hasher.h
This commit is contained in:
@@ -1364,6 +1364,6 @@ void init_constants(void)
|
|||||||
happy(initsubnet(&ipv6_any, 0, '0', &ipv6_all));
|
happy(initsubnet(&ipv6_any, 0, '0', &ipv6_all));
|
||||||
}
|
}
|
||||||
|
|
||||||
u_char secret_of_the_day[SHA1_DIGEST_SIZE];
|
u_char secret_of_the_day[HASH_SIZE_SHA1];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-20
@@ -18,6 +18,7 @@
|
|||||||
#define _CONSTANTS_H
|
#define _CONSTANTS_H
|
||||||
|
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
extern const char compile_time_interop_options[];
|
extern const char compile_time_interop_options[];
|
||||||
|
|
||||||
@@ -278,32 +279,16 @@ extern const char sparse_end[];
|
|||||||
#define COOKIE_SIZE 8
|
#define COOKIE_SIZE 8
|
||||||
#define MAX_ISAKMP_SPI_SIZE 16
|
#define MAX_ISAKMP_SPI_SIZE 16
|
||||||
|
|
||||||
#define MD2_DIGEST_SIZE (128 / BITS_PER_BYTE)
|
|
||||||
#define MD5_DIGEST_SIZE (128 / BITS_PER_BYTE)
|
|
||||||
#define SHA1_DIGEST_SIZE (160 / BITS_PER_BYTE)
|
|
||||||
#define SHA2_256_DIGEST_SIZE (256 / BITS_PER_BYTE)
|
|
||||||
#define SHA2_384_DIGEST_SIZE (384 / BITS_PER_BYTE)
|
|
||||||
#define SHA2_512_DIGEST_SIZE (512 / BITS_PER_BYTE)
|
|
||||||
|
|
||||||
#define MD5_BLOCK_SIZE (512 / BITS_PER_BYTE)
|
|
||||||
#define SHA1_BLOCK_SIZE (512 / BITS_PER_BYTE)
|
|
||||||
#define SHA2_256_BLOCK_SIZE (512 / BITS_PER_BYTE)
|
|
||||||
#define SHA2_384_BLOCK_SIZE (1024 / BITS_PER_BYTE)
|
|
||||||
#define SHA2_512_BLOCK_SIZE (1024 / BITS_PER_BYTE)
|
|
||||||
|
|
||||||
#define DES_CBC_BLOCK_SIZE (64 / BITS_PER_BYTE)
|
#define DES_CBC_BLOCK_SIZE (64 / BITS_PER_BYTE)
|
||||||
|
|
||||||
#define DSS_QBITS 160 /* bits in DSS's "q" (FIPS 186-1) */
|
|
||||||
|
|
||||||
/* Maximum is required for SHA2_512 */
|
/* Maximum is required for SHA2_512 */
|
||||||
#define MAX_DIGEST_LEN SHA2_512_DIGEST_SIZE
|
#define MAX_DIGEST_LEN HASH_SIZE_SHA512
|
||||||
#define MAX_HASH_BLOCK_SIZE SHA2_512_BLOCK_SIZE
|
|
||||||
|
|
||||||
/* RFC 2404 "HMAC-SHA-1-96" section 3 */
|
/* RFC 2404 "HMAC-SHA-1-96" section 3 */
|
||||||
#define HMAC_SHA1_KEY_LEN SHA1_DIGEST_SIZE
|
#define HMAC_SHA1_KEY_LEN HASH_SIZE_SHA1
|
||||||
|
|
||||||
/* RFC 2403 "HMAC-MD5-96" section 3 */
|
/* RFC 2403 "HMAC-MD5-96" section 3 */
|
||||||
#define HMAC_MD5_KEY_LEN MD5_DIGEST_SIZE
|
#define HMAC_MD5_KEY_LEN HASH_SIZE_MD5
|
||||||
|
|
||||||
#define IKE_UDP_PORT 500
|
#define IKE_UDP_PORT 500
|
||||||
|
|
||||||
@@ -1269,6 +1254,6 @@ enum dns_auth_level {
|
|||||||
extern const char *const natt_type_bitnames[];
|
extern const char *const natt_type_bitnames[];
|
||||||
|
|
||||||
/* secret value for responder cookies */
|
/* secret value for responder cookies */
|
||||||
extern u_char secret_of_the_day[SHA1_DIGEST_SIZE];
|
extern u_char secret_of_the_day[HASH_SIZE_SHA1];
|
||||||
|
|
||||||
#endif /* _CONSTANTS_H */
|
#endif /* _CONSTANTS_H */
|
||||||
|
|||||||
+3
-2
@@ -29,6 +29,7 @@
|
|||||||
#include <asn1/asn1_parser.h>
|
#include <asn1/asn1_parser.h>
|
||||||
#include <asn1/oid.h>
|
#include <asn1/oid.h>
|
||||||
#include <crypto/rngs/rng.h>
|
#include <crypto/rngs/rng.h>
|
||||||
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
@@ -293,7 +294,7 @@ static const asn1Object_t singleResponseObjects[] = {
|
|||||||
*/
|
*/
|
||||||
static bool build_ocsp_location(const x509cert_t *cert, ocsp_location_t *location)
|
static bool build_ocsp_location(const x509cert_t *cert, ocsp_location_t *location)
|
||||||
{
|
{
|
||||||
static u_char digest[SHA1_DIGEST_SIZE]; /* temporary storage */
|
static u_char digest[HASH_SIZE_SHA1]; /* temporary storage */
|
||||||
|
|
||||||
location->uri = cert->accessLocation;
|
location->uri = cert->accessLocation;
|
||||||
|
|
||||||
@@ -311,7 +312,7 @@ static bool build_ocsp_location(const x509cert_t *cert, ocsp_location_t *locatio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
location->authNameID = chunk_create(digest, SHA1_DIGEST_SIZE);
|
location->authNameID = chunk_create(digest, HASH_SIZE_SHA1);
|
||||||
compute_digest(cert->issuer, OID_SHA1, &location->authNameID);
|
compute_digest(cert->issuer, OID_SHA1, &location->authNameID);
|
||||||
|
|
||||||
location->next = NULL;
|
location->next = NULL;
|
||||||
|
|||||||
+4
-1
@@ -15,11 +15,14 @@
|
|||||||
#ifndef _PGP_H
|
#ifndef _PGP_H
|
||||||
#define _PGP_H
|
#define _PGP_H
|
||||||
|
|
||||||
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
#include "pkcs1.h"
|
#include "pkcs1.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Length of PGP V3 fingerprint
|
* Length of PGP V3 fingerprint
|
||||||
*/
|
*/
|
||||||
#define PGP_FINGERPRINT_SIZE MD5_DIGEST_SIZE
|
#define PGP_FINGERPRINT_SIZE HASH_SIZE_MD5
|
||||||
|
|
||||||
typedef char fingerprint_t[PGP_FINGERPRINT_SIZE];
|
typedef char fingerprint_t[PGP_FINGERPRINT_SIZE];
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include <asn1/asn1_parser.h>
|
#include <asn1/asn1_parser.h>
|
||||||
#include <asn1/oid.h>
|
#include <asn1/oid.h>
|
||||||
#include <crypto/rngs/rng.h>
|
#include <crypto/rngs/rng.h>
|
||||||
|
#include <crypto/hashers/hasher.h>
|
||||||
|
|
||||||
#include "../pluto/constants.h"
|
#include "../pluto/constants.h"
|
||||||
#include "../pluto/defs.h"
|
#include "../pluto/defs.h"
|
||||||
@@ -267,7 +268,7 @@ end:
|
|||||||
*/
|
*/
|
||||||
void scep_generate_pkcs10_fingerprint(chunk_t pkcs10, chunk_t *fingerprint)
|
void scep_generate_pkcs10_fingerprint(chunk_t pkcs10, chunk_t *fingerprint)
|
||||||
{
|
{
|
||||||
char buf[MD5_DIGEST_SIZE];
|
char buf[HASH_SIZE_MD5];
|
||||||
chunk_t digest = { buf, sizeof(buf) };
|
chunk_t digest = { buf, sizeof(buf) };
|
||||||
|
|
||||||
/* the fingerprint is the MD5 hash in hexadecimal format */
|
/* the fingerprint is the MD5 hash in hexadecimal format */
|
||||||
@@ -284,7 +285,7 @@ void scep_generate_pkcs10_fingerprint(chunk_t pkcs10, chunk_t *fingerprint)
|
|||||||
void scep_generate_transaction_id(const RSA_public_key_t *rsak,
|
void scep_generate_transaction_id(const RSA_public_key_t *rsak,
|
||||||
chunk_t *transID, chunk_t *serialNumber)
|
chunk_t *transID, chunk_t *serialNumber)
|
||||||
{
|
{
|
||||||
char buf[MD5_DIGEST_SIZE];
|
char buf[HASH_SIZE_MD5];
|
||||||
|
|
||||||
chunk_t digest = { buf, sizeof(buf) };
|
chunk_t digest = { buf, sizeof(buf) };
|
||||||
chunk_t public_key = pkcs1_build_publicKeyInfo(rsak);
|
chunk_t public_key = pkcs1_build_publicKeyInfo(rsak);
|
||||||
|
|||||||
Reference in New Issue
Block a user