Commit 2186cd8e authored by Ulf Möller's avatar Ulf Möller
Browse files

Document the RSA library.

parent de73e397
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -354,14 +354,8 @@ install: all
		chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
	done
	@echo installing man 1
	@for i in doc/man/*.pod ; \
	do pod2man --section=1 --date=`date +%Y-%m-%d` --center=OpenSSL \
		 --release=$(VERSION) $$i > $(INSTALL_PREFIX)$(INSTALLTOP)/man/man1/`basename $$i .pod`.1; \
	done
	@for i in doc/man/*.pod; do (cd `dirname $$i`; pod2man --section=1 --date=`date +%Y-%m-%d` --center=OpenSSL --release=$(VERSION) `basename $$i` >  $(INSTALL_PREFIX)$(INSTALLTOP)/man/man1/`basename $$i .pod`.1); done
	@echo installing man 3
	@for i in doc/crypto.pod doc/ssl.pod ; \
	do pod2man --section=3 --date=`date +%Y-%m-%d` --center=OpenSSL \
		 --release=$(VERSION) $$i > $(INSTALL_PREFIX)$(INSTALLTOP)/man/man3/`basename $$i .pod`.3; \
	done
	@for i in doc/crypto/*.pod doc/ssl.pod; do (cd `dirname $$i`; pod2man --section=3 --date=`date +%Y-%m-%d` --center=OpenSSL --release=$(VERSION) `basename $$i` >  $(INSTALL_PREFIX)$(INSTALLTOP)/man/man3/`basename $$i .pod`.3); done

# DO NOT DELETE THIS LINE -- make depend depends on it.
+43 −0
Original line number Diff line number Diff line
=pod

=head1 NAME

RSA_blinding_on, RSA_blinding_off - Protect the RSA operation from timing attacks

=head1 SYNOPSIS

 #include <openssl/rsa.h>

 int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);

 void RSA_blinding_off(RSA *rsa);

=head1 DESCRIPTION

RSA is vulnerable from timing attacks. In a setup where attackers can
measure the time of RSA decryption or signature operations, blinding
must be used to protect the RSA operation from that attack.

RSA_blinding_on() turns blinding on for key B<rsa> and generates a
random blinding factor. B<ctx> is B<NULL> or a pre-allocated and
initialized B<BN_CTX>. The random number generator must be seeded
prior to calling RSA_blinding_on().

RSA_blinding_off() turns blinding off and frees the memory used for
the blinding factor.

=head1 RETURN VALUES

RSA_blinding_on() returns 1 on success, and 0 if an error occurred.

RSA_blinding_off() returns no value.

=head1 SEE ALSO

rsa(3), rand(3)

=head1 HISTORY

RSA_blinding_on() and RSA_blinding_off() appeared in SSLeay 0.9.0.

=cut
+39 −0
Original line number Diff line number Diff line
=pod

=head1 NAME

RSA_check_key - Validate RSA keys

=head1 SYNOPSIS

 #include <openssl/rsa.h>

 int RSA_check_key(RSA *rsa);

=head1 DESCRIPTION

This function validates RSA keys. It checks that B<p> and B<q> are
in fact prime, and that B<n = p*q>.

In the case of private keys, it also checks that B<d*e = 1 mod (p-1*q-1)>,
and that B<dmp1>, B<dmq1> and B<iqmp> are set correctly or are B<NULL>.

The key's public components may not be B<NULL>.

=head1 RETURN VALUE

RSA_check_key() returns 1 if B<rsa> is a valid RSA key, and 0 otherwise.
-1 is returned if an error occurs while checking the key.

If the key is invalid or an error occurred, the reason code can be
obtained using ERR_get_error(3).

=head1 SEE ALSO

rsa(3), err(3)

=head1 HISTORY

RSA_check() appeared in OpenSSL 0.9.4.

=cut
+68 −0
Original line number Diff line number Diff line
=pod

=head1 NAME

RSA_generate_key - Generate RSA key pair

=head1 SYNOPSIS

 #include <openssl/rsa.h>

 RSA *RSA_generate_key(int num, unsigned long e,
    void (*callback)(int,int,void *), void *cb_arg);

=head1 DESCRIPTION

RSA_generate_key() generates a key pair and returns it in a newly
allocated B<RSA> structure. The pseudo-random number generator must
be seeded prior to calling RSA_generate_key().

The modulus size will be B<num> bits, and the public exponent will be
B<e>. Key sizes with B<num> E<lt> 1024 should be considered insecure.
The exponent is an odd number, typically 3 or 65535.

A callback function may be used to provide feedback about the
progress of the key generation. If B<callback> is not B<NULL>, it
will be called as follows:

=over 4

=item *

While a random prime number is generated, it is called as
described in L<BN_generate_prime(3)>.

=item *

When the n-th randomly generated prime is rejected as not
suitable for the key, B<callback(2, n, cb_arg)> is called.

=item *

When a random p has been found with p-1 relatively prime to B<e>,
it is called as B<callback(3, 0, cb_arg)>.

=back

The process is then repeated for prime q with B<callback(3, 1, cb_arg)>.

=head1 RETURN VALUES

If key generation fails, RSA_generate_key() returns B<NULL>; the
error codes can be obtained by ERR_get_error(3).

=head1 BUGS

B<callback(2, x, cb_arg)> is used with two different meanings.

RSA_generate_key() goes into an infinite loop for illegal input values.

=head1 SEE ALSO

err(3), rand(3), rsa(3), RSA_free(3)

=head1 HISTORY

The B<cb_arg> argument was added in SSLeay 0.9.0.

=cut
+34 −0
Original line number Diff line number Diff line
=pod

=head1 NAME

RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data - ...

=head1 SYNOPSIS

 #include <openssl/rsa.h>

 int RSA_get_ex_new_index(long argl, char *argp, int (*new_func)(),
    int (*dup_func)(), void (*free_func)());

 int RSA_set_ex_data(RSA *r,int idx,char *arg);

 char *RSA_get_ex_data(RSA *r, int idx);

=head1 DESCRIPTION

...

=head1 RETURN VALUES

...

=head1 SEE ALSO

...

=head1 HISTORY

...

=cut
Loading