#ifndef __LIB_6_H__ #define __LIB_6_H__ #include "lib6.h" #include "lib5.h" #include "lib4.h" #include "lib3.h" #include "lib2.h" #include "lib.h" #include "util/doublelinkedlist.h" struct bb_attack { BIGNUM *_2a; BIGNUM *B; BIGNUM *_2B; BIGNUM *_3B; BIGNUM *one; BIGNUM *two; BIGNUM *three; BIGNUM *c_0; }; struct interval { BIGNUM *lower; BIGNUM *upper; struct list list; }; struct dsa_public_params { BIGNUM *p; BIGNUM *q; BIGNUM *g; unsigned int bits; }; struct dsa_per_user_param { BIGNUM *public; BIGNUM *private; // signature data here also because they should not be here BIGNUM *r; BIGNUM *s; }; int rsa_sign_bignum(BIGNUM *message, BIGNUM *signed_message, struct rsa_key_bignum *private); int rsa_verify_bignum(BIGNUM *signed_message, BIGNUM *org_message, struct rsa_key_bignum *public); int shitty_pkcs1_5_padding_verify(char *to_verify, int len, char *message); int pkcs1_5_padding_verify(char *to_verify, int len, char *message); void init_dsa_pub_param(struct dsa_public_params *p); void dsa_compute_per_user_keys(struct dsa_public_params *pub_param, struct dsa_per_user_param *priv_param); void dsa_sign(char *mess, struct dsa_public_params *pub_param, struct dsa_per_user_param *priv_param, BIGNUM *k); int dsa_verify(char *mess, struct dsa_public_params *pub, struct dsa_per_user_param *priv); void dsa_recover_x_from_known_k(struct dsa_public_params *pub, BIGNUM *k, struct dsa_per_user_param *priv, BIGNUM *mess_hash); void dsa_recover_k_from_repeated_nonce(BIGNUM *mess1_hash, BIGNUM *mess2_hash, BIGNUM *s1, BIGNUM *s2, struct dsa_public_params *pub, struct dsa_per_user_param *priv, BIGNUM *k); void dsa_generate_magic_signature(struct dsa_public_params *pub, struct dsa_per_user_param *priv, BIGNUM *mess_hash); int rsa_parity_orcale(BIGNUM *message, struct rsa_key_bignum *private); void pkcs1_5_padding(char *message, char *result, unsigned int target_length_byte); int bleichenbacher_prepare(BIGNUM *c_0, struct rsa_key_bignum *public, struct bb_attack *b); int bleichenbacher_step_2a(BIGNUM *s_i, struct rsa_key_bignum *public, struct rsa_key_bignum *private, struct bb_attack *b); int bleichenbacher_step_2c(struct interval *m, BIGNUM *s_i, struct rsa_key_bignum *public, struct rsa_key_bignum *privat, struct bb_attack *b); //int bleichenbacher_step_3(BIGNUM *s_i, set_t *m_i1); int iv_merge2(struct interval *left, struct interval *right); int iv_merge3(struct interval *left, struct interval *middle, struct interval *rigth); int iv_list_insert(struct interval *iv, struct list *list); void iv_printf(struct interval *e1); #endif /* __LIB_6_H__ */