Commit a4949896 authored by Ben Laurie's avatar Ben Laurie
Browse files

Add OAEP.

parent d08d8da4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -5,6 +5,15 @@

 Changes between 0.9.1c and 0.9.2

  *) Add OAEP encryption for the OpenSSL crypto library. OAEP is the improved
     padding method for RSA, which is recommended for new applications in PKCS
     #1 v2.0 (RFC 2437, October 1998).
     OAEP (Optimal Asymmetric Encryption Padding) has better theoretical
     foundations than the ad-hoc padding used in PKCS #1 v1.5. It is secure
     against Bleichbacher's attack on RSA.
     [Ulf Moeller <ulf@fitug.de>, reformatted, corrected and integrated by
      Ben Laurie]

  *) Updates to the new SSL compression code
     [Eric A. Young, (from changes to C2Net SSLeay, integrated by Mark Cox)]

+5 −0
Original line number Diff line number Diff line
@@ -61,6 +61,11 @@
This is an implementation of Triple DES Cipher Block Chaining with Output
Feedback Masking, by Coppersmith, Johnson and Matyas, (IBM and Certicom).

Note that there is a known attack on this by Biham and Knudsen but it takes
a lot of work:

http://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/1998/CS/CS0928.ps.gz

*/

#include "des_locl.h"
+3 −3
Original line number Diff line number Diff line
@@ -18,14 +18,14 @@ CFLAGS= $(INCLUDES) $(CFLAG)
ERR=rsa
ERRC=rsa_err
GENERAL=Makefile
TEST=
TEST=rsa_oaep_test.c
APPS=

LIB=$(TOP)/libcrypto.a
LIBSRC= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c $(ERRC).c \
	rsa_pk1.c rsa_ssl.c rsa_none.c
	rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c
LIBOBJ= rsa_eay.o rsa_gen.o rsa_lib.o rsa_sign.o rsa_saos.o $(ERRC).o \
	rsa_pk1.o rsa_ssl.o rsa_none.o
	rsa_pk1.o rsa_ssl.o rsa_none.o rsa_oaep.o

SRC= $(LIBSRC)

+4 −0
Original line number Diff line number Diff line
@@ -9,10 +9,12 @@
#define RSA_F_RSA_GENERATE_KEY				 105
#define RSA_F_RSA_NEW_METHOD				 106
#define RSA_F_RSA_PADDING_ADD_NONE			 107
#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP		 121
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1		 108
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2		 109
#define RSA_F_RSA_PADDING_ADD_SSLV23			 110
#define RSA_F_RSA_PADDING_CHECK_NONE			 111
#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP		 122
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1		 112
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2		 113
#define RSA_F_RSA_PADDING_CHECK_SSLV23			 114
@@ -37,7 +39,9 @@
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE		 110
#define RSA_R_DATA_TOO_SMALL				 111
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY		 112
#define RSA_R_KEY_SIZE_TOO_SMALL			 120
#define RSA_R_NULL_BEFORE_BLOCK_MISSING			 113
#define RSA_R_OAEP_DECODING_ERROR			 121
#define RSA_R_PADDING_CHECK_FAILED			 114
#define RSA_R_SSLV3_ROLLBACK_ATTACK			 115
#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
+11 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ struct rsa_st
#define RSA_PKCS1_PADDING	1
#define RSA_SSLV23_PADDING	2
#define RSA_NO_PADDING		3
#define RSA_PKCS1_OAEP_PADDING	4

#define RSA_set_app_data(s,arg)         RSA_set_ex_data(s,0,(char *)arg)
#define RSA_get_app_data(s)             RSA_get_ex_data(s,0)
@@ -222,6 +223,12 @@ int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,
	unsigned char *f,int fl);
int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,
	unsigned char *f,int fl,int rsa_len);
int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
			       unsigned char *f,int fl,unsigned char *p,
			       int pl);
int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen,
				 unsigned char *f,int fl,int rsa_len,
				 unsigned char *p,int pl);
int RSA_padding_add_SSLv23(unsigned char *to,int tlen,
	unsigned char *f,int fl);
int RSA_padding_check_SSLv23(unsigned char *to,int tlen,
@@ -307,10 +314,12 @@ char *RSA_get_ex_data();
#define RSA_F_RSA_GENERATE_KEY				 105
#define RSA_F_RSA_NEW_METHOD				 106
#define RSA_F_RSA_PADDING_ADD_NONE			 107
#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP		 121
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1		 108
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2		 109
#define RSA_F_RSA_PADDING_ADD_SSLV23			 110
#define RSA_F_RSA_PADDING_CHECK_NONE			 111
#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP		 122
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1		 112
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2		 113
#define RSA_F_RSA_PADDING_CHECK_SSLV23			 114
@@ -335,7 +344,9 @@ char *RSA_get_ex_data();
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE		 110
#define RSA_R_DATA_TOO_SMALL				 111
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY		 112
#define RSA_R_KEY_SIZE_TOO_SMALL			 120
#define RSA_R_NULL_BEFORE_BLOCK_MISSING			 113
#define RSA_R_OAEP_DECODING_ERROR			 121
#define RSA_R_PADDING_CHECK_FAILED			 114
#define RSA_R_SSLV3_ROLLBACK_ATTACK			 115
#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
Loading