ssl_des/inc/ft_pbkdf2.h

80 lines
2 KiB
C
Raw Permalink Normal View History

2019-04-10 17:20:22 +03:00
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_pbkdf2.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/10 15:56:11 by gtertysh #+# #+# */
/* Updated: 2019/04/10 15:56:16 by gtertysh ### ########.fr */
/* */
/* ************************************************************************** */
2019-03-27 12:55:47 +02:00
#ifndef FT_PBKDF2_H
# define FT_PBKDF2_H
2019-03-29 02:06:29 +02:00
# include "ft_sha.h"
2019-04-10 17:20:22 +03:00
typedef struct s_pbkdf2_sha256_ctx
2019-03-29 02:06:29 +02:00
{
unsigned char *pass;
unsigned char *salt;
unsigned char *key;
unsigned int key_len;
unsigned int pass_len;
unsigned int salt_len;
unsigned int iterations;
} t_pbkdf2_sha256_ctx;
2019-03-27 01:29:06 +02:00
2019-04-10 17:20:22 +03:00
typedef struct s_hmac_sha256_ctx
2019-03-27 01:29:06 +02:00
{
unsigned char *key;
unsigned char *msg;
unsigned int key_size;
unsigned int msg_size;
2019-03-29 02:06:29 +02:00
unsigned char ipad[FT_SHA256_BLOCK_SIZE];
unsigned char opad[FT_SHA256_BLOCK_SIZE];
t_sha256_ctx sha_ctx;
2019-03-27 01:29:06 +02:00
} t_hmac_sha256_ctx;
2019-03-29 02:06:29 +02:00
void ft_hmac_sha256_init_ctx
2019-03-27 01:29:06 +02:00
(
t_hmac_sha256_ctx *ctx
);
2019-03-29 02:06:29 +02:00
void ft_hmac_sha256
(
t_hmac_sha256_ctx *ctx,
unsigned char out[FT_SHA256_DIGEST_LENGTH_BYTE]
);
void ft_hmac_sha256_start
2019-03-27 01:29:06 +02:00
(
t_hmac_sha256_ctx *ctx
2019-03-27 12:55:47 +02:00
);
2019-03-29 02:06:29 +02:00
void ft_hmac_sha256_update
(
t_hmac_sha256_ctx *ctx,
unsigned char *msg,
unsigned int msg_size
);
void ft_hmac_sha256_finish
(
t_hmac_sha256_ctx *ctx,
unsigned char out[FT_SHA256_DIGEST_LENGTH_BYTE]
);
void ft_pbkdf2_sha256_init_ctx
(
t_pbkdf2_sha256_ctx *ctx
);
void ft_pbkdf2_sha256
(
t_pbkdf2_sha256_ctx *ctx
);
2019-04-10 17:20:22 +03:00
#endif