shithub: riscv

Download patch

ref: a6fde3edc5ec390d23e50110c93492d42f1e23e1
parent: 85216d3d95505c19a57d3bbe74e8a7eca109a8e6
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Aug 30 03:35:54 EDT 2019

rsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions

--- a/sys/man/2/rsa
+++ b/sys/man/2/rsa
@@ -2,6 +2,8 @@
 .SH NAME
 asn1dump,
 asn1toRSApriv,
+asn1encodeRSApriv,
+asn1encodeRSApub,
 decodePEM,
 rsadecrypt,
 rsaencrypt,
@@ -62,9 +64,15 @@
 RSApriv*	asn1toRSApriv(uchar *priv, int npriv)
 .PP
 .B
-void		asn1dump(uchar *der, int len)
+int	asn1encodeRSApriv(RSApriv *k, uchar *buf, int len)
 .PP
 .B
+int	asn1encodeRSApub(RSApub *pk, uchar *buf, int len)
+.PP
+.B
+void	asn1dump(uchar *der, int len)
+.PP
+.B
 uchar*	decodePEM(char *s, char *type, int *len, char **new_s)
 .PP
 .B
@@ -206,6 +214,21 @@
 converts an ASN1 formatted RSA private key into the corresponding
 .B RSApriv
 structure.
+.PP
+.I Asn1encodeRSApriv
+and
+.I asn1encodeRSApub
+export a
+.B RSApriv
+or
+.B RSApub
+structure to ASN1 format.
+On success,
+.I buf
+is filled and the encoded byte length is returned.
+Otherwise
+.B -1
+is returned and error string is set.
 .PP
 .I Asn1dump
 prints an ASN1 object to standard output.