Loading test/rsa_test.c +32 −1 Original line number Diff line number Diff line /* * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy Loading Loading @@ -268,6 +268,36 @@ err: return ret; } static int test_rsa_sslv23(int idx) { int ret = 0; RSA *key; unsigned char ptext[256]; unsigned char ctext[256]; static unsigned char ptext_ex[] = "\x54\x85\x9b\x34\x2c\x49\xea\x2a"; unsigned char ctext_ex[256]; int plen; int clen = 0; int num; plen = sizeof(ptext_ex) - 1; clen = rsa_setkey(&key, ctext_ex, idx); num = RSA_public_encrypt(plen, ptext_ex, ctext, key, RSA_SSLV23_PADDING); if (!TEST_int_eq(num, clen)) goto err; num = RSA_private_decrypt(num, ctext, ptext, key, RSA_SSLV23_PADDING); if (!TEST_mem_eq(ptext, num, ptext_ex, plen)) goto err; ret = 1; err: RSA_free(key); return ret; } static int test_rsa_oaep(int idx) { int ret = 0; Loading Loading @@ -391,6 +421,7 @@ err: int setup_tests(void) { ADD_ALL_TESTS(test_rsa_pkcs1, 3); ADD_ALL_TESTS(test_rsa_sslv23, 3); ADD_ALL_TESTS(test_rsa_oaep, 3); ADD_ALL_TESTS(test_rsa_security_bit, OSSL_NELEM(rsa_security_bits_cases)); return 1; Loading Loading
test/rsa_test.c +32 −1 Original line number Diff line number Diff line /* * Copyright 1999-2018 The OpenSSL Project Authors. All Rights Reserved. * Copyright 1999-2019 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy Loading Loading @@ -268,6 +268,36 @@ err: return ret; } static int test_rsa_sslv23(int idx) { int ret = 0; RSA *key; unsigned char ptext[256]; unsigned char ctext[256]; static unsigned char ptext_ex[] = "\x54\x85\x9b\x34\x2c\x49\xea\x2a"; unsigned char ctext_ex[256]; int plen; int clen = 0; int num; plen = sizeof(ptext_ex) - 1; clen = rsa_setkey(&key, ctext_ex, idx); num = RSA_public_encrypt(plen, ptext_ex, ctext, key, RSA_SSLV23_PADDING); if (!TEST_int_eq(num, clen)) goto err; num = RSA_private_decrypt(num, ctext, ptext, key, RSA_SSLV23_PADDING); if (!TEST_mem_eq(ptext, num, ptext_ex, plen)) goto err; ret = 1; err: RSA_free(key); return ret; } static int test_rsa_oaep(int idx) { int ret = 0; Loading Loading @@ -391,6 +421,7 @@ err: int setup_tests(void) { ADD_ALL_TESTS(test_rsa_pkcs1, 3); ADD_ALL_TESTS(test_rsa_sslv23, 3); ADD_ALL_TESTS(test_rsa_oaep, 3); ADD_ALL_TESTS(test_rsa_security_bit, OSSL_NELEM(rsa_security_bits_cases)); return 1; Loading