diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509.h')
-rw-r--r-- | src/lib/libcrypto/x509/x509.h | 239 |
1 files changed, 226 insertions, 13 deletions
diff --git a/src/lib/libcrypto/x509/x509.h b/src/lib/libcrypto/x509/x509.h index 35f9484f8b..d3336d9ceb 100644 --- a/src/lib/libcrypto/x509/x509.h +++ b/src/lib/libcrypto/x509/x509.h | |||
@@ -176,9 +176,8 @@ typedef struct X509_extension_st | |||
176 | short critical; | 176 | short critical; |
177 | short netscape_hack; | 177 | short netscape_hack; |
178 | ASN1_OCTET_STRING *value; | 178 | ASN1_OCTET_STRING *value; |
179 | long argl; /* used when decoding */ | 179 | struct v3_ext_method *method; /* V3 method to use */ |
180 | char *argp; /* used when decoding */ | 180 | void *ext_val; /* extension value */ |
181 | void (*ex_free)(); /* clear argp stuff */ | ||
182 | } X509_EXTENSION; | 181 | } X509_EXTENSION; |
183 | 182 | ||
184 | DECLARE_STACK_OF(X509_EXTENSION) | 183 | DECLARE_STACK_OF(X509_EXTENSION) |
@@ -231,6 +230,21 @@ typedef struct x509_cinf_st | |||
231 | STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ | 230 | STACK_OF(X509_EXTENSION) *extensions; /* [ 3 ] optional in v3 */ |
232 | } X509_CINF; | 231 | } X509_CINF; |
233 | 232 | ||
233 | /* This stuff is certificate "auxiliary info" | ||
234 | * it contains details which are useful in certificate | ||
235 | * stores and databases. When used this is tagged onto | ||
236 | * the end of the certificate itself | ||
237 | */ | ||
238 | |||
239 | typedef struct x509_cert_aux_st | ||
240 | { | ||
241 | STACK_OF(ASN1_OBJECT) *trust; /* trusted uses */ | ||
242 | STACK_OF(ASN1_OBJECT) *reject; /* rejected uses */ | ||
243 | ASN1_UTF8STRING *alias; /* "friendly name" */ | ||
244 | ASN1_OCTET_STRING *keyid; /* key id of private key */ | ||
245 | STACK_OF(X509_ALGOR) *other; /* other unspecified info */ | ||
246 | } X509_CERT_AUX; | ||
247 | |||
234 | typedef struct x509_st | 248 | typedef struct x509_st |
235 | { | 249 | { |
236 | X509_CINF *cert_info; | 250 | X509_CINF *cert_info; |
@@ -239,11 +253,58 @@ typedef struct x509_st | |||
239 | int valid; | 253 | int valid; |
240 | int references; | 254 | int references; |
241 | char *name; | 255 | char *name; |
256 | CRYPTO_EX_DATA ex_data; | ||
257 | /* These contain copies of various extension values */ | ||
258 | long ex_pathlen; | ||
259 | unsigned long ex_flags; | ||
260 | unsigned long ex_kusage; | ||
261 | unsigned long ex_xkusage; | ||
262 | unsigned long ex_nscert; | ||
263 | #ifndef NO_SHA | ||
264 | unsigned char sha1_hash[SHA_DIGEST_LENGTH]; | ||
265 | #endif | ||
266 | X509_CERT_AUX *aux; | ||
242 | } X509; | 267 | } X509; |
243 | 268 | ||
244 | DECLARE_STACK_OF(X509) | 269 | DECLARE_STACK_OF(X509) |
245 | DECLARE_ASN1_SET_OF(X509) | 270 | DECLARE_ASN1_SET_OF(X509) |
246 | 271 | ||
272 | /* This is used for a table of trust checking functions */ | ||
273 | |||
274 | typedef struct x509_trust_st { | ||
275 | int trust; | ||
276 | int flags; | ||
277 | int (*check_trust)(struct x509_trust_st *, X509 *, int); | ||
278 | char *name; | ||
279 | int arg1; | ||
280 | void *arg2; | ||
281 | } X509_TRUST; | ||
282 | |||
283 | DECLARE_STACK_OF(X509_TRUST) | ||
284 | |||
285 | /* standard trust ids */ | ||
286 | |||
287 | #define X509_TRUST_ANY 1 | ||
288 | #define X509_TRUST_SSL_CLIENT 2 | ||
289 | #define X509_TRUST_SSL_SERVER 3 | ||
290 | #define X509_TRUST_EMAIL 4 | ||
291 | #define X509_TRUST_OBJECT_SIGN 5 | ||
292 | |||
293 | /* Keep these up to date! */ | ||
294 | #define X509_TRUST_MIN 1 | ||
295 | #define X509_TRUST_MAX 5 | ||
296 | |||
297 | |||
298 | /* trust_flags values */ | ||
299 | #define X509_TRUST_DYNAMIC 1 | ||
300 | #define X509_TRUST_DYNAMIC_NAME 2 | ||
301 | |||
302 | /* check_trust return codes */ | ||
303 | |||
304 | #define X509_TRUST_TRUSTED 1 | ||
305 | #define X509_TRUST_REJECTED 2 | ||
306 | #define X509_TRUST_UNTRUSTED 3 | ||
307 | |||
247 | typedef struct X509_revoked_st | 308 | typedef struct X509_revoked_st |
248 | { | 309 | { |
249 | ASN1_INTEGER *serialNumber; | 310 | ASN1_INTEGER *serialNumber; |
@@ -318,7 +379,7 @@ DECLARE_STACK_OF(X509_INFO) | |||
318 | 379 | ||
319 | /* The next 2 structures and their 8 routines were sent to me by | 380 | /* The next 2 structures and their 8 routines were sent to me by |
320 | * Pat Richard <patr@x509.com> and are used to manipulate | 381 | * Pat Richard <patr@x509.com> and are used to manipulate |
321 | * Netscapes spki strucutres - usefull if you are writing a CA web page | 382 | * Netscapes spki structures - useful if you are writing a CA web page |
322 | */ | 383 | */ |
323 | typedef struct Netscape_spkac_st | 384 | typedef struct Netscape_spkac_st |
324 | { | 385 | { |
@@ -372,8 +433,10 @@ X509_ALGOR *prf; | |||
372 | typedef struct pkcs8_priv_key_info_st | 433 | typedef struct pkcs8_priv_key_info_st |
373 | { | 434 | { |
374 | int broken; /* Flag for various broken formats */ | 435 | int broken; /* Flag for various broken formats */ |
375 | #define PKCS8_OK 0 | 436 | #define PKCS8_OK 0 |
376 | #define PKCS8_NO_OCTET 1 | 437 | #define PKCS8_NO_OCTET 1 |
438 | #define PKCS8_EMBEDDED_PARAM 2 | ||
439 | #define PKCS8_NS_DB 3 | ||
377 | ASN1_INTEGER *version; | 440 | ASN1_INTEGER *version; |
378 | X509_ALGOR *pkeyalg; | 441 | X509_ALGOR *pkeyalg; |
379 | ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ | 442 | ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */ |
@@ -552,13 +615,20 @@ int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r); | |||
552 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); | 615 | int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r); |
553 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); | 616 | int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r); |
554 | 617 | ||
618 | NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len); | ||
619 | char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x); | ||
620 | EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x); | ||
621 | int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey); | ||
622 | |||
623 | int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki); | ||
624 | |||
555 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); | 625 | int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); |
556 | int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); | 626 | int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md); |
557 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); | 627 | int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md); |
558 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); | 628 | int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md); |
559 | 629 | ||
560 | int X509_digest(X509 *data,EVP_MD *type,unsigned char *md,unsigned int *len); | 630 | int X509_digest(X509 *data,const EVP_MD *type,unsigned char *md,unsigned int *len); |
561 | int X509_NAME_digest(X509_NAME *data,EVP_MD *type, | 631 | int X509_NAME_digest(X509_NAME *data,const EVP_MD *type, |
562 | unsigned char *md,unsigned int *len); | 632 | unsigned char *md,unsigned int *len); |
563 | #endif | 633 | #endif |
564 | 634 | ||
@@ -574,16 +644,23 @@ RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa); | |||
574 | int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); | 644 | int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa); |
575 | RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); | 645 | RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa); |
576 | int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); | 646 | int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa); |
647 | RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa); | ||
648 | int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa); | ||
577 | #endif | 649 | #endif |
578 | #ifndef NO_DSA | 650 | #ifndef NO_DSA |
651 | DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa); | ||
652 | int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa); | ||
579 | DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); | 653 | DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa); |
580 | int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); | 654 | int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa); |
655 | #endif | ||
581 | X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); | 656 | X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8); |
582 | int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); | 657 | int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8); |
583 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, | 658 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp, |
584 | PKCS8_PRIV_KEY_INFO **p8inf); | 659 | PKCS8_PRIV_KEY_INFO **p8inf); |
585 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); | 660 | int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf); |
586 | #endif | 661 | int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key); |
662 | int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey); | ||
663 | EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a); | ||
587 | #endif | 664 | #endif |
588 | 665 | ||
589 | #ifdef HEADER_BIO_H | 666 | #ifdef HEADER_BIO_H |
@@ -598,8 +675,12 @@ RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa); | |||
598 | int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); | 675 | int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa); |
599 | RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); | 676 | RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa); |
600 | int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); | 677 | int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa); |
678 | RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa); | ||
679 | int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa); | ||
601 | #endif | 680 | #endif |
602 | #ifndef NO_DSA | 681 | #ifndef NO_DSA |
682 | DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa); | ||
683 | int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa); | ||
603 | DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); | 684 | DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa); |
604 | int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); | 685 | int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa); |
605 | #endif | 686 | #endif |
@@ -608,6 +689,9 @@ int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8); | |||
608 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, | 689 | PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp, |
609 | PKCS8_PRIV_KEY_INFO **p8inf); | 690 | PKCS8_PRIV_KEY_INFO **p8inf); |
610 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); | 691 | int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf); |
692 | int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key); | ||
693 | int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey); | ||
694 | EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a); | ||
611 | #endif | 695 | #endif |
612 | 696 | ||
613 | X509 *X509_dup(X509 *x509); | 697 | X509 *X509_dup(X509 *x509); |
@@ -635,7 +719,7 @@ const char * X509_get_default_cert_dir_env(void ); | |||
635 | const char * X509_get_default_cert_file_env(void ); | 719 | const char * X509_get_default_cert_file_env(void ); |
636 | const char * X509_get_default_private_dir(void ); | 720 | const char * X509_get_default_private_dir(void ); |
637 | 721 | ||
638 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, EVP_MD *md); | 722 | X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md); |
639 | X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); | 723 | X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey); |
640 | void ERR_load_X509_strings(void ); | 724 | void ERR_load_X509_strings(void ); |
641 | 725 | ||
@@ -660,7 +744,19 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); | |||
660 | EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); | 744 | EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key); |
661 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, | 745 | int X509_get_pubkey_parameters(EVP_PKEY *pkey, |
662 | STACK_OF(X509) *chain); | 746 | STACK_OF(X509) *chain); |
663 | 747 | int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp); | |
748 | EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,unsigned char **pp, | ||
749 | long length); | ||
750 | #ifndef NO_RSA | ||
751 | int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp); | ||
752 | RSA * d2i_RSA_PUBKEY(RSA **a,unsigned char **pp, | ||
753 | long length); | ||
754 | #endif | ||
755 | #ifndef NO_DSA | ||
756 | int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp); | ||
757 | DSA * d2i_DSA_PUBKEY(DSA **a,unsigned char **pp, | ||
758 | long length); | ||
759 | #endif | ||
664 | 760 | ||
665 | X509_SIG * X509_SIG_new(void ); | 761 | X509_SIG * X509_SIG_new(void ); |
666 | void X509_SIG_free(X509_SIG *a); | 762 | void X509_SIG_free(X509_SIG *a); |
@@ -714,6 +810,25 @@ X509 * X509_new(void); | |||
714 | void X509_free(X509 *a); | 810 | void X509_free(X509 *a); |
715 | int i2d_X509(X509 *a,unsigned char **pp); | 811 | int i2d_X509(X509 *a,unsigned char **pp); |
716 | X509 * d2i_X509(X509 **a,unsigned char **pp,long length); | 812 | X509 * d2i_X509(X509 **a,unsigned char **pp,long length); |
813 | int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
814 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | ||
815 | int X509_set_ex_data(X509 *r, int idx, void *arg); | ||
816 | void *X509_get_ex_data(X509 *r, int idx); | ||
817 | int i2d_X509_AUX(X509 *a,unsigned char **pp); | ||
818 | X509 * d2i_X509_AUX(X509 **a,unsigned char **pp,long length); | ||
819 | |||
820 | X509_CERT_AUX * X509_CERT_AUX_new(void); | ||
821 | void X509_CERT_AUX_free(X509_CERT_AUX *a); | ||
822 | int i2d_X509_CERT_AUX(X509_CERT_AUX *a,unsigned char **pp); | ||
823 | X509_CERT_AUX * d2i_X509_CERT_AUX(X509_CERT_AUX **a,unsigned char **pp, | ||
824 | long length); | ||
825 | int X509_alias_set1(X509 *x, unsigned char *name, int len); | ||
826 | unsigned char * X509_alias_get0(X509 *x, int *len); | ||
827 | int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int); | ||
828 | int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj); | ||
829 | int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj); | ||
830 | void X509_trust_clear(X509 *x); | ||
831 | void X509_reject_clear(X509 *x); | ||
717 | 832 | ||
718 | X509_REVOKED * X509_REVOKED_new(void); | 833 | X509_REVOKED * X509_REVOKED_new(void); |
719 | void X509_REVOKED_free(X509_REVOKED *a); | 834 | void X509_REVOKED_free(X509_REVOKED *a); |
@@ -762,7 +877,7 @@ char * X509_NAME_oneline(X509_NAME *a,char *buf,int size); | |||
762 | int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1, | 877 | int ASN1_verify(int (*i2d)(), X509_ALGOR *algor1, |
763 | ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); | 878 | ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey); |
764 | 879 | ||
765 | int ASN1_digest(int (*i2d)(),EVP_MD *type,char *data, | 880 | int ASN1_digest(int (*i2d)(),const EVP_MD *type,char *data, |
766 | unsigned char *md,unsigned int *len); | 881 | unsigned char *md,unsigned int *len); |
767 | 882 | ||
768 | int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, | 883 | int ASN1_sign(int (*i2d)(), X509_ALGOR *algor1, X509_ALGOR *algor2, |
@@ -787,6 +902,30 @@ int X509_REQ_set_version(X509_REQ *x,long version); | |||
787 | int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); | 902 | int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name); |
788 | int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); | 903 | int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey); |
789 | EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); | 904 | EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req); |
905 | int X509_REQ_extension_nid(int nid); | ||
906 | int * X509_REQ_get_extension_nids(void); | ||
907 | void X509_REQ_set_extension_nids(int *nids); | ||
908 | STACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req); | ||
909 | int X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts, | ||
910 | int nid); | ||
911 | int X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts); | ||
912 | int X509_REQ_get_attr_count(const X509_REQ *req); | ||
913 | int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, | ||
914 | int lastpos); | ||
915 | int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj, | ||
916 | int lastpos); | ||
917 | X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc); | ||
918 | X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc); | ||
919 | int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr); | ||
920 | int X509_REQ_add1_attr_by_OBJ(X509_REQ *req, | ||
921 | ASN1_OBJECT *obj, int type, | ||
922 | unsigned char *bytes, int len); | ||
923 | int X509_REQ_add1_attr_by_NID(X509_REQ *req, | ||
924 | int nid, int type, | ||
925 | unsigned char *bytes, int len); | ||
926 | int X509_REQ_add1_attr_by_txt(X509_REQ *req, | ||
927 | char *attrname, int type, | ||
928 | unsigned char *bytes, int len); | ||
790 | 929 | ||
791 | int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); | 930 | int X509_check_private_key(X509 *x509,EVP_PKEY *pkey); |
792 | 931 | ||
@@ -799,6 +938,7 @@ unsigned long X509_issuer_name_hash(X509 *a); | |||
799 | int X509_subject_name_cmp(X509 *a,X509 *b); | 938 | int X509_subject_name_cmp(X509 *a,X509 *b); |
800 | unsigned long X509_subject_name_hash(X509 *x); | 939 | unsigned long X509_subject_name_hash(X509 *x); |
801 | 940 | ||
941 | int X509_cmp (X509 *a, X509 *b); | ||
802 | int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); | 942 | int X509_NAME_cmp (X509_NAME *a, X509_NAME *b); |
803 | unsigned long X509_NAME_hash(X509_NAME *x); | 943 | unsigned long X509_NAME_hash(X509_NAME *x); |
804 | 944 | ||
@@ -812,6 +952,7 @@ int X509_REQ_print_fp(FILE *bp,X509_REQ *req); | |||
812 | #ifdef HEADER_BIO_H | 952 | #ifdef HEADER_BIO_H |
813 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); | 953 | int X509_NAME_print(BIO *bp, X509_NAME *name, int obase); |
814 | int X509_print(BIO *bp,X509 *x); | 954 | int X509_print(BIO *bp,X509 *x); |
955 | int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent); | ||
815 | int X509_CRL_print(BIO *bp,X509_CRL *x); | 956 | int X509_CRL_print(BIO *bp,X509_CRL *x); |
816 | int X509_REQ_print(BIO *bp,X509_REQ *req); | 957 | int X509_REQ_print(BIO *bp,X509_REQ *req); |
817 | #endif | 958 | #endif |
@@ -823,7 +964,7 @@ int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, | |||
823 | char *buf,int len); | 964 | char *buf,int len); |
824 | 965 | ||
825 | /* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use | 966 | /* NOTE: you should be passsing -1, not 0 as lastpos. The functions that use |
826 | * lastpos, seach after that position on. */ | 967 | * lastpos, search after that position on. */ |
827 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); | 968 | int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos); |
828 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, | 969 | int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj, |
829 | int lastpos); | 970 | int lastpos); |
@@ -831,8 +972,16 @@ X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc); | |||
831 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); | 972 | X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc); |
832 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, | 973 | int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne, |
833 | int loc, int set); | 974 | int loc, int set); |
975 | int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, | ||
976 | unsigned char *bytes, int len, int loc, int set); | ||
977 | int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, | ||
978 | unsigned char *bytes, int len, int loc, int set); | ||
979 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, | ||
980 | char *field, int type, unsigned char *bytes, int len); | ||
834 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, | 981 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, |
835 | int type,unsigned char *bytes, int len); | 982 | int type,unsigned char *bytes, int len); |
983 | int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, | ||
984 | unsigned char *bytes, int len, int loc, int set); | ||
836 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, | 985 | X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |
837 | ASN1_OBJECT *obj, int type,unsigned char *bytes, | 986 | ASN1_OBJECT *obj, int type,unsigned char *bytes, |
838 | int len); | 987 | int len); |
@@ -862,6 +1011,7 @@ int X509_get_ext_by_critical(X509 *x, int crit, int lastpos); | |||
862 | X509_EXTENSION *X509_get_ext(X509 *x, int loc); | 1011 | X509_EXTENSION *X509_get_ext(X509 *x, int loc); |
863 | X509_EXTENSION *X509_delete_ext(X509 *x, int loc); | 1012 | X509_EXTENSION *X509_delete_ext(X509 *x, int loc); |
864 | int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); | 1013 | int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc); |
1014 | void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx); | ||
865 | 1015 | ||
866 | int X509_CRL_get_ext_count(X509_CRL *x); | 1016 | int X509_CRL_get_ext_count(X509_CRL *x); |
867 | int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); | 1017 | int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos); |
@@ -870,6 +1020,7 @@ int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos); | |||
870 | X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); | 1020 | X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc); |
871 | X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); | 1021 | X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc); |
872 | int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); | 1022 | int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc); |
1023 | void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx); | ||
873 | 1024 | ||
874 | int X509_REVOKED_get_ext_count(X509_REVOKED *x); | 1025 | int X509_REVOKED_get_ext_count(X509_REVOKED *x); |
875 | int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); | 1026 | int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos); |
@@ -878,6 +1029,7 @@ int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos); | |||
878 | X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); | 1029 | X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc); |
879 | X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); | 1030 | X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc); |
880 | int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); | 1031 | int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc); |
1032 | void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx); | ||
881 | 1033 | ||
882 | X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, | 1034 | X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, |
883 | int nid, int crit, ASN1_OCTET_STRING *data); | 1035 | int nid, int crit, ASN1_OCTET_STRING *data); |
@@ -891,6 +1043,38 @@ ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex); | |||
891 | ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); | 1043 | ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne); |
892 | int X509_EXTENSION_get_critical(X509_EXTENSION *ex); | 1044 | int X509_EXTENSION_get_critical(X509_EXTENSION *ex); |
893 | 1045 | ||
1046 | int X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x); | ||
1047 | int X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid, | ||
1048 | int lastpos); | ||
1049 | int X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj, | ||
1050 | int lastpos); | ||
1051 | X509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc); | ||
1052 | X509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc); | ||
1053 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x, | ||
1054 | X509_ATTRIBUTE *attr); | ||
1055 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x, | ||
1056 | ASN1_OBJECT *obj, int type, | ||
1057 | unsigned char *bytes, int len); | ||
1058 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x, | ||
1059 | int nid, int type, | ||
1060 | unsigned char *bytes, int len); | ||
1061 | STACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x, | ||
1062 | char *attrname, int type, | ||
1063 | unsigned char *bytes, int len); | ||
1064 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid, | ||
1065 | int atrtype, void *data, int len); | ||
1066 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr, | ||
1067 | ASN1_OBJECT *obj, int atrtype, void *data, int len); | ||
1068 | X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr, | ||
1069 | char *atrname, int type, unsigned char *bytes, int len); | ||
1070 | int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, ASN1_OBJECT *obj); | ||
1071 | int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, void *data, int len); | ||
1072 | void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, | ||
1073 | int atrtype, void *data); | ||
1074 | int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr); | ||
1075 | ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr); | ||
1076 | ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx); | ||
1077 | |||
894 | int X509_verify_cert(X509_STORE_CTX *ctx); | 1078 | int X509_verify_cert(X509_STORE_CTX *ctx); |
895 | 1079 | ||
896 | /* lookup a cert from a X509 STACK */ | 1080 | /* lookup a cert from a X509 STACK */ |
@@ -926,8 +1110,20 @@ void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a); | |||
926 | 1110 | ||
927 | EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); | 1111 | EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8); |
928 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); | 1112 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey); |
1113 | PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken); | ||
929 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); | 1114 | PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); |
930 | 1115 | ||
1116 | int X509_check_trust(X509 *x, int id, int flags); | ||
1117 | int X509_TRUST_get_count(void); | ||
1118 | X509_TRUST * X509_TRUST_get0(int idx); | ||
1119 | int X509_TRUST_get_by_id(int id); | ||
1120 | int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int), | ||
1121 | char *name, int arg1, void *arg2); | ||
1122 | void X509_TRUST_cleanup(void); | ||
1123 | int X509_TRUST_get_flags(X509_TRUST *xp); | ||
1124 | char *X509_TRUST_get0_name(X509_TRUST *xp); | ||
1125 | int X509_TRUST_get_trust(X509_TRUST *xp); | ||
1126 | |||
931 | /* BEGIN ERROR CODES */ | 1127 | /* BEGIN ERROR CODES */ |
932 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1128 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
933 | * made after this point may be overwritten when the script is next run. | 1129 | * made after this point may be overwritten when the script is next run. |
@@ -940,15 +1136,25 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); | |||
940 | #define X509_F_BY_FILE_CTRL 101 | 1136 | #define X509_F_BY_FILE_CTRL 101 |
941 | #define X509_F_DIR_CTRL 102 | 1137 | #define X509_F_DIR_CTRL 102 |
942 | #define X509_F_GET_CERT_BY_SUBJECT 103 | 1138 | #define X509_F_GET_CERT_BY_SUBJECT 103 |
1139 | #define X509_F_NETSCAPE_SPKI_B64_DECODE 129 | ||
1140 | #define X509_F_NETSCAPE_SPKI_B64_ENCODE 130 | ||
943 | #define X509_F_X509V3_ADD_EXT 104 | 1141 | #define X509_F_X509V3_ADD_EXT 104 |
1142 | #define X509_F_X509_ADD_ATTR 135 | ||
1143 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_NID 136 | ||
1144 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ 137 | ||
1145 | #define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT 140 | ||
1146 | #define X509_F_X509_ATTRIBUTE_GET0_DATA 139 | ||
1147 | #define X509_F_X509_ATTRIBUTE_SET1_DATA 138 | ||
944 | #define X509_F_X509_CHECK_PRIVATE_KEY 128 | 1148 | #define X509_F_X509_CHECK_PRIVATE_KEY 128 |
945 | #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 | 1149 | #define X509_F_X509_EXTENSION_CREATE_BY_NID 108 |
946 | #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 | 1150 | #define X509_F_X509_EXTENSION_CREATE_BY_OBJ 109 |
947 | #define X509_F_X509_GET_PUBKEY_PARAMETERS 110 | 1151 | #define X509_F_X509_GET_PUBKEY_PARAMETERS 110 |
1152 | #define X509_F_X509_LOAD_CERT_CRL_FILE 132 | ||
948 | #define X509_F_X509_LOAD_CERT_FILE 111 | 1153 | #define X509_F_X509_LOAD_CERT_FILE 111 |
949 | #define X509_F_X509_LOAD_CRL_FILE 112 | 1154 | #define X509_F_X509_LOAD_CRL_FILE 112 |
950 | #define X509_F_X509_NAME_ADD_ENTRY 113 | 1155 | #define X509_F_X509_NAME_ADD_ENTRY 113 |
951 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 | 1156 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_NID 114 |
1157 | #define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT 131 | ||
952 | #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 | 1158 | #define X509_F_X509_NAME_ENTRY_SET_OBJECT 115 |
953 | #define X509_F_X509_NAME_ONELINE 116 | 1159 | #define X509_F_X509_NAME_ONELINE 116 |
954 | #define X509_F_X509_NAME_PRINT 117 | 1160 | #define X509_F_X509_NAME_PRINT 117 |
@@ -960,15 +1166,19 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); | |||
960 | #define X509_F_X509_REQ_TO_X509 123 | 1166 | #define X509_F_X509_REQ_TO_X509 123 |
961 | #define X509_F_X509_STORE_ADD_CERT 124 | 1167 | #define X509_F_X509_STORE_ADD_CERT 124 |
962 | #define X509_F_X509_STORE_ADD_CRL 125 | 1168 | #define X509_F_X509_STORE_ADD_CRL 125 |
1169 | #define X509_F_X509_STORE_CTX_PURPOSE_INHERIT 134 | ||
963 | #define X509_F_X509_TO_X509_REQ 126 | 1170 | #define X509_F_X509_TO_X509_REQ 126 |
1171 | #define X509_F_X509_TRUST_ADD 133 | ||
964 | #define X509_F_X509_VERIFY_CERT 127 | 1172 | #define X509_F_X509_VERIFY_CERT 127 |
965 | 1173 | ||
966 | /* Reason codes. */ | 1174 | /* Reason codes. */ |
967 | #define X509_R_BAD_X509_FILETYPE 100 | 1175 | #define X509_R_BAD_X509_FILETYPE 100 |
1176 | #define X509_R_BASE64_DECODE_ERROR 118 | ||
968 | #define X509_R_CANT_CHECK_DH_KEY 114 | 1177 | #define X509_R_CANT_CHECK_DH_KEY 114 |
969 | #define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 | 1178 | #define X509_R_CERT_ALREADY_IN_HASH_TABLE 101 |
970 | #define X509_R_ERR_ASN1_LIB 102 | 1179 | #define X509_R_ERR_ASN1_LIB 102 |
971 | #define X509_R_INVALID_DIRECTORY 113 | 1180 | #define X509_R_INVALID_DIRECTORY 113 |
1181 | #define X509_R_INVALID_FIELD_NAME 119 | ||
972 | #define X509_R_KEY_TYPE_MISMATCH 115 | 1182 | #define X509_R_KEY_TYPE_MISMATCH 115 |
973 | #define X509_R_KEY_VALUES_MISMATCH 116 | 1183 | #define X509_R_KEY_VALUES_MISMATCH 116 |
974 | #define X509_R_LOADING_CERT_DIR 103 | 1184 | #define X509_R_LOADING_CERT_DIR 103 |
@@ -979,8 +1189,11 @@ PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken); | |||
979 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 | 1189 | #define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY 108 |
980 | #define X509_R_UNKNOWN_KEY_TYPE 117 | 1190 | #define X509_R_UNKNOWN_KEY_TYPE 117 |
981 | #define X509_R_UNKNOWN_NID 109 | 1191 | #define X509_R_UNKNOWN_NID 109 |
1192 | #define X509_R_UNKNOWN_PURPOSE_ID 121 | ||
1193 | #define X509_R_UNKNOWN_TRUST_ID 120 | ||
982 | #define X509_R_UNSUPPORTED_ALGORITHM 111 | 1194 | #define X509_R_UNSUPPORTED_ALGORITHM 111 |
983 | #define X509_R_WRONG_LOOKUP_TYPE 112 | 1195 | #define X509_R_WRONG_LOOKUP_TYPE 112 |
1196 | #define X509_R_WRONG_TYPE 122 | ||
984 | 1197 | ||
985 | #ifdef __cplusplus | 1198 | #ifdef __cplusplus |
986 | } | 1199 | } |