Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/xform_sha2.c
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
#include <opencrypto/xform_auth.h> | #include <opencrypto/xform_auth.h> | ||||
static int SHA224Update_int(void *, const void *, u_int); | static int SHA224Update_int(void *, const void *, u_int); | ||||
static int SHA256Update_int(void *, const void *, u_int); | static int SHA256Update_int(void *, const void *, u_int); | ||||
static int SHA384Update_int(void *, const void *, u_int); | static int SHA384Update_int(void *, const void *, u_int); | ||||
static int SHA512Update_int(void *, const void *, u_int); | static int SHA512Update_int(void *, const void *, u_int); | ||||
/* Plain hashes */ | /* Plain hashes */ | ||||
struct auth_hash auth_hash_sha2_224 = { | const struct auth_hash auth_hash_sha2_224 = { | ||||
.type = CRYPTO_SHA2_224, | .type = CRYPTO_SHA2_224, | ||||
.name = "SHA2-224", | .name = "SHA2-224", | ||||
.hashsize = SHA2_224_HASH_LEN, | .hashsize = SHA2_224_HASH_LEN, | ||||
.ctxsize = sizeof(SHA224_CTX), | .ctxsize = sizeof(SHA224_CTX), | ||||
.blocksize = SHA2_224_BLOCK_LEN, | .blocksize = SHA2_224_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA224_Init, | .Init = (void (*)(void *)) SHA224_Init, | ||||
.Update = SHA224Update_int, | .Update = SHA224Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA224_Final, | .Final = (void (*)(uint8_t *, void *)) SHA224_Final, | ||||
}; | }; | ||||
struct auth_hash auth_hash_sha2_256 = { | const struct auth_hash auth_hash_sha2_256 = { | ||||
.type = CRYPTO_SHA2_256, | .type = CRYPTO_SHA2_256, | ||||
.name = "SHA2-256", | .name = "SHA2-256", | ||||
.keysize = SHA2_256_BLOCK_LEN, | .keysize = SHA2_256_BLOCK_LEN, | ||||
.hashsize = SHA2_256_HASH_LEN, | .hashsize = SHA2_256_HASH_LEN, | ||||
.ctxsize = sizeof(SHA256_CTX), | .ctxsize = sizeof(SHA256_CTX), | ||||
.blocksize = SHA2_256_BLOCK_LEN, | .blocksize = SHA2_256_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA256_Init, | .Init = (void (*)(void *)) SHA256_Init, | ||||
.Update = SHA256Update_int, | .Update = SHA256Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA256_Final, | .Final = (void (*)(uint8_t *, void *)) SHA256_Final, | ||||
}; | }; | ||||
struct auth_hash auth_hash_sha2_384 = { | const struct auth_hash auth_hash_sha2_384 = { | ||||
.type = CRYPTO_SHA2_384, | .type = CRYPTO_SHA2_384, | ||||
.name = "SHA2-384", | .name = "SHA2-384", | ||||
.keysize = SHA2_384_BLOCK_LEN, | .keysize = SHA2_384_BLOCK_LEN, | ||||
.hashsize = SHA2_384_HASH_LEN, | .hashsize = SHA2_384_HASH_LEN, | ||||
.ctxsize = sizeof(SHA384_CTX), | .ctxsize = sizeof(SHA384_CTX), | ||||
.blocksize = SHA2_384_BLOCK_LEN, | .blocksize = SHA2_384_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA384_Init, | .Init = (void (*)(void *)) SHA384_Init, | ||||
.Update = SHA384Update_int, | .Update = SHA384Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA384_Final, | .Final = (void (*)(uint8_t *, void *)) SHA384_Final, | ||||
}; | }; | ||||
struct auth_hash auth_hash_sha2_512 = { | const struct auth_hash auth_hash_sha2_512 = { | ||||
.type = CRYPTO_SHA2_512, | .type = CRYPTO_SHA2_512, | ||||
.name = "SHA2-512", | .name = "SHA2-512", | ||||
.keysize = SHA2_512_BLOCK_LEN, | .keysize = SHA2_512_BLOCK_LEN, | ||||
.hashsize = SHA2_512_HASH_LEN, | .hashsize = SHA2_512_HASH_LEN, | ||||
.ctxsize = sizeof(SHA512_CTX), | .ctxsize = sizeof(SHA512_CTX), | ||||
.blocksize = SHA2_512_BLOCK_LEN, | .blocksize = SHA2_512_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA512_Init, | .Init = (void (*)(void *)) SHA512_Init, | ||||
.Update = SHA512Update_int, | .Update = SHA512Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA512_Final, | .Final = (void (*)(uint8_t *, void *)) SHA512_Final, | ||||
}; | }; | ||||
/* Authentication instances */ | /* Authentication instances */ | ||||
struct auth_hash auth_hash_hmac_sha2_224 = { | const struct auth_hash auth_hash_hmac_sha2_224 = { | ||||
.type = CRYPTO_SHA2_224_HMAC, | .type = CRYPTO_SHA2_224_HMAC, | ||||
.name = "HMAC-SHA2-224", | .name = "HMAC-SHA2-224", | ||||
.keysize = SHA2_224_BLOCK_LEN, | .keysize = SHA2_224_BLOCK_LEN, | ||||
.hashsize = SHA2_224_HASH_LEN, | .hashsize = SHA2_224_HASH_LEN, | ||||
.ctxsize = sizeof(SHA224_CTX), | .ctxsize = sizeof(SHA224_CTX), | ||||
.blocksize = SHA2_224_BLOCK_LEN, | .blocksize = SHA2_224_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA224_Init, | .Init = (void (*)(void *)) SHA224_Init, | ||||
.Update = SHA224Update_int, | .Update = SHA224Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA224_Final, | .Final = (void (*)(uint8_t *, void *)) SHA224_Final, | ||||
}; | }; | ||||
struct auth_hash auth_hash_hmac_sha2_256 = { | const struct auth_hash auth_hash_hmac_sha2_256 = { | ||||
.type = CRYPTO_SHA2_256_HMAC, | .type = CRYPTO_SHA2_256_HMAC, | ||||
.name = "HMAC-SHA2-256", | .name = "HMAC-SHA2-256", | ||||
.keysize = SHA2_256_BLOCK_LEN, | .keysize = SHA2_256_BLOCK_LEN, | ||||
.hashsize = SHA2_256_HASH_LEN, | .hashsize = SHA2_256_HASH_LEN, | ||||
.ctxsize = sizeof(SHA256_CTX), | .ctxsize = sizeof(SHA256_CTX), | ||||
.blocksize = SHA2_256_BLOCK_LEN, | .blocksize = SHA2_256_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA256_Init, | .Init = (void (*)(void *)) SHA256_Init, | ||||
.Update = SHA256Update_int, | .Update = SHA256Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA256_Final, | .Final = (void (*)(uint8_t *, void *)) SHA256_Final, | ||||
}; | }; | ||||
struct auth_hash auth_hash_hmac_sha2_384 = { | const struct auth_hash auth_hash_hmac_sha2_384 = { | ||||
.type = CRYPTO_SHA2_384_HMAC, | .type = CRYPTO_SHA2_384_HMAC, | ||||
.name = "HMAC-SHA2-384", | .name = "HMAC-SHA2-384", | ||||
.keysize = SHA2_384_BLOCK_LEN, | .keysize = SHA2_384_BLOCK_LEN, | ||||
.hashsize = SHA2_384_HASH_LEN, | .hashsize = SHA2_384_HASH_LEN, | ||||
.ctxsize = sizeof(SHA384_CTX), | .ctxsize = sizeof(SHA384_CTX), | ||||
.blocksize = SHA2_384_BLOCK_LEN, | .blocksize = SHA2_384_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA384_Init, | .Init = (void (*)(void *)) SHA384_Init, | ||||
.Update = SHA384Update_int, | .Update = SHA384Update_int, | ||||
.Final = (void (*)(uint8_t *, void *)) SHA384_Final, | .Final = (void (*)(uint8_t *, void *)) SHA384_Final, | ||||
}; | }; | ||||
struct auth_hash auth_hash_hmac_sha2_512 = { | const struct auth_hash auth_hash_hmac_sha2_512 = { | ||||
.type = CRYPTO_SHA2_512_HMAC, | .type = CRYPTO_SHA2_512_HMAC, | ||||
.name = "HMAC-SHA2-512", | .name = "HMAC-SHA2-512", | ||||
.keysize = SHA2_512_BLOCK_LEN, | .keysize = SHA2_512_BLOCK_LEN, | ||||
.hashsize = SHA2_512_HASH_LEN, | .hashsize = SHA2_512_HASH_LEN, | ||||
.ctxsize = sizeof(SHA512_CTX), | .ctxsize = sizeof(SHA512_CTX), | ||||
.blocksize = SHA2_512_BLOCK_LEN, | .blocksize = SHA2_512_BLOCK_LEN, | ||||
.Init = (void (*)(void *)) SHA512_Init, | .Init = (void (*)(void *)) SHA512_Init, | ||||
.Update = SHA512Update_int, | .Update = SHA512Update_int, | ||||
Show All 33 Lines |