Skip to content

Commit

Permalink
Merge remainder of rsa_crpt.c into rsa_eay.c
Browse files Browse the repository at this point in the history
Most of these are one line wrappers around methods implemented in rsa_eay.c
by default.
  • Loading branch information
tb committed Aug 9, 2023
1 parent c7d7d37 commit bd98bb4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 130 deletions.
3 changes: 1 addition & 2 deletions src/lib/libcrypto/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.154 2023/08/09 09:23:03 tb Exp $
# $OpenBSD: Makefile,v 1.155 2023/08/09 09:32:22 tb Exp $

LIB= crypto
LIBREBUILD=y
Expand Down Expand Up @@ -535,7 +535,6 @@ SRCS+= rsa_ameth.c
SRCS+= rsa_asn1.c
SRCS+= rsa_blinding.c
SRCS+= rsa_chk.c
SRCS+= rsa_crpt.c
SRCS+= rsa_eay.c
SRCS+= rsa_err.c
SRCS+= rsa_gen.c
Expand Down
127 changes: 0 additions & 127 deletions src/lib/libcrypto/rsa/rsa_crpt.c

This file was deleted.

55 changes: 54 additions & 1 deletion src/lib/libcrypto/rsa/rsa_eay.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: rsa_eay.c,v 1.63 2023/08/02 08:44:38 tb Exp $ */
/* $OpenBSD: rsa_eay.c,v 1.64 2023/08/09 09:32:23 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
Expand Down Expand Up @@ -857,3 +857,56 @@ RSA_PKCS1_SSLeay(void)
return RSA_PKCS1_OpenSSL();
}
LCRYPTO_ALIAS(RSA_PKCS1_SSLeay);

int
RSA_bits(const RSA *r)
{
return BN_num_bits(r->n);
}
LCRYPTO_ALIAS(RSA_bits);

int
RSA_size(const RSA *r)
{
return BN_num_bytes(r->n);
}
LCRYPTO_ALIAS(RSA_size);

int
RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
return rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding);
}
LCRYPTO_ALIAS(RSA_public_encrypt);

int
RSA_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
return rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding);
}
LCRYPTO_ALIAS(RSA_private_encrypt);

int
RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
return rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding);
}
LCRYPTO_ALIAS(RSA_private_decrypt);

int
RSA_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
RSA *rsa, int padding)
{
return rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding);
}
LCRYPTO_ALIAS(RSA_public_decrypt);

int
RSA_flags(const RSA *r)
{
return r == NULL ? 0 : r->meth->flags;
}
LCRYPTO_ALIAS(RSA_flags);

0 comments on commit bd98bb4

Please sign in to comment.