Loading CHANGES +45 −41 Original line number Diff line number Diff line Loading @@ -4,6 +4,10 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] *) Allow the verify time to be set by an application, rather than always using the current time. [Steve Henson] *) Phase 2 verify code reorganisation. The certificate verify code now looks up an issuer certificate by a number of criteria: subject name, authority key id Loading apps/rsautl.c +1 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ int MAIN(int argc, char **argv) argv++; } if(need_priv && (key_type == KEY_PRIVKEY)) { if(need_priv && (key_type != KEY_PRIVKEY)) { BIO_printf(bio_err, "A private key is needed for this operation\n"); goto end; } Loading crypto/x509/x509.h +2 −0 Original line number Diff line number Diff line Loading @@ -800,7 +800,9 @@ RSA *RSAPrivateKey_dup(RSA *rsa); #endif /* !SSLEAY_MACROS */ int X509_cmp_time(ASN1_TIME *s, time_t *t); int X509_cmp_current_time(ASN1_TIME *s); ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); const char * X509_get_default_cert_area(void ); Loading crypto/x509/x509_vfy.c +31 −6 Original line number Diff line number Diff line Loading @@ -429,6 +429,7 @@ static int internal_verify(X509_STORE_CTX *ctx) int i,ok=0,n; X509 *xs,*xi; EVP_PKEY *pkey=NULL; time_t *ptime; int (*cb)(); cb=ctx->verify_cb; Loading @@ -438,8 +439,9 @@ static int internal_verify(X509_STORE_CTX *ctx) ctx->error_depth=n-1; n--; xi=sk_X509_value(ctx->chain,n); if (X509_NAME_cmp(X509_get_subject_name(xi), X509_get_issuer_name(xi)) == 0) if(ctx->flags & X509_V_FLAG_USE_CHECK_TIME) ptime = &ctx->check_time; else ptime = NULL; if (ctx->check_issued(ctx, xi, xi)) xs=xi; else { Loading Loading @@ -485,7 +487,7 @@ static int internal_verify(X509_STORE_CTX *ctx) EVP_PKEY_free(pkey); pkey=NULL; i=X509_cmp_current_time(X509_get_notBefore(xs)); i=X509_cmp_time(X509_get_notBefore(xs), ptime); if (i == 0) { ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD; Loading @@ -503,7 +505,7 @@ static int internal_verify(X509_STORE_CTX *ctx) xs->valid=1; } i=X509_cmp_current_time(X509_get_notAfter(xs)); i=X509_cmp_time(X509_get_notAfter(xs), ptime); if (i == 0) { ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD; Loading Loading @@ -540,6 +542,11 @@ end: } int X509_cmp_current_time(ASN1_TIME *ctm) { return X509_cmp_time(ctm, NULL); } int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) { char *str; ASN1_TIME atm; Loading Loading @@ -594,7 +601,7 @@ int X509_cmp_current_time(ASN1_TIME *ctm) atm.length=sizeof(buff2); atm.data=(unsigned char *)buff2; X509_gmtime_adj(&atm,-offset*60); X509_time_adj(&atm,-offset*60, cmp_time); if(ctm->type == V_ASN1_UTCTIME) { Loading @@ -614,10 +621,17 @@ int X509_cmp_current_time(ASN1_TIME *ctm) } ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj) { return X509_time_adj(s, adj, NULL); } ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm) { time_t t; time(&t); if(in_tm) t = *in_tm; else time(&t); t+=adj; if(!s) return ASN1_TIME_set(s, t); if(s->type == V_ASN1_UTCTIME) return(ASN1_UTCTIME_set(s,t)); Loading Loading @@ -855,6 +869,17 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) memset(&ctx->ex_data,0,sizeof(CRYPTO_EX_DATA)); } void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags) { ctx->flags |= flags; } void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t) { ctx->check_time = t; ctx->flags |= X509_V_FLAG_USE_CHECK_TIME; } IMPLEMENT_STACK_OF(X509) IMPLEMENT_ASN1_SET_OF(X509) Loading crypto/x509/x509_vfy.h +2 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, int purpose, int trust); void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags); void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t); #ifdef __cplusplus } Loading Loading
CHANGES +45 −41 Original line number Diff line number Diff line Loading @@ -4,6 +4,10 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] *) Allow the verify time to be set by an application, rather than always using the current time. [Steve Henson] *) Phase 2 verify code reorganisation. The certificate verify code now looks up an issuer certificate by a number of criteria: subject name, authority key id Loading
apps/rsautl.c +1 −1 Original line number Diff line number Diff line Loading @@ -141,7 +141,7 @@ int MAIN(int argc, char **argv) argv++; } if(need_priv && (key_type == KEY_PRIVKEY)) { if(need_priv && (key_type != KEY_PRIVKEY)) { BIO_printf(bio_err, "A private key is needed for this operation\n"); goto end; } Loading
crypto/x509/x509.h +2 −0 Original line number Diff line number Diff line Loading @@ -800,7 +800,9 @@ RSA *RSAPrivateKey_dup(RSA *rsa); #endif /* !SSLEAY_MACROS */ int X509_cmp_time(ASN1_TIME *s, time_t *t); int X509_cmp_current_time(ASN1_TIME *s); ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t); ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj); const char * X509_get_default_cert_area(void ); Loading
crypto/x509/x509_vfy.c +31 −6 Original line number Diff line number Diff line Loading @@ -429,6 +429,7 @@ static int internal_verify(X509_STORE_CTX *ctx) int i,ok=0,n; X509 *xs,*xi; EVP_PKEY *pkey=NULL; time_t *ptime; int (*cb)(); cb=ctx->verify_cb; Loading @@ -438,8 +439,9 @@ static int internal_verify(X509_STORE_CTX *ctx) ctx->error_depth=n-1; n--; xi=sk_X509_value(ctx->chain,n); if (X509_NAME_cmp(X509_get_subject_name(xi), X509_get_issuer_name(xi)) == 0) if(ctx->flags & X509_V_FLAG_USE_CHECK_TIME) ptime = &ctx->check_time; else ptime = NULL; if (ctx->check_issued(ctx, xi, xi)) xs=xi; else { Loading Loading @@ -485,7 +487,7 @@ static int internal_verify(X509_STORE_CTX *ctx) EVP_PKEY_free(pkey); pkey=NULL; i=X509_cmp_current_time(X509_get_notBefore(xs)); i=X509_cmp_time(X509_get_notBefore(xs), ptime); if (i == 0) { ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD; Loading @@ -503,7 +505,7 @@ static int internal_verify(X509_STORE_CTX *ctx) xs->valid=1; } i=X509_cmp_current_time(X509_get_notAfter(xs)); i=X509_cmp_time(X509_get_notAfter(xs), ptime); if (i == 0) { ctx->error=X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD; Loading Loading @@ -540,6 +542,11 @@ end: } int X509_cmp_current_time(ASN1_TIME *ctm) { return X509_cmp_time(ctm, NULL); } int X509_cmp_time(ASN1_TIME *ctm, time_t *cmp_time) { char *str; ASN1_TIME atm; Loading Loading @@ -594,7 +601,7 @@ int X509_cmp_current_time(ASN1_TIME *ctm) atm.length=sizeof(buff2); atm.data=(unsigned char *)buff2; X509_gmtime_adj(&atm,-offset*60); X509_time_adj(&atm,-offset*60, cmp_time); if(ctm->type == V_ASN1_UTCTIME) { Loading @@ -614,10 +621,17 @@ int X509_cmp_current_time(ASN1_TIME *ctm) } ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj) { return X509_time_adj(s, adj, NULL); } ASN1_TIME *X509_time_adj(ASN1_TIME *s, long adj, time_t *in_tm) { time_t t; time(&t); if(in_tm) t = *in_tm; else time(&t); t+=adj; if(!s) return ASN1_TIME_set(s, t); if(s->type == V_ASN1_UTCTIME) return(ASN1_UTCTIME_set(s,t)); Loading Loading @@ -855,6 +869,17 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx) memset(&ctx->ex_data,0,sizeof(CRYPTO_EX_DATA)); } void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags) { ctx->flags |= flags; } void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t) { ctx->check_time = t; ctx->flags |= X509_V_FLAG_USE_CHECK_TIME; } IMPLEMENT_STACK_OF(X509) IMPLEMENT_ASN1_SET_OF(X509) Loading
crypto/x509/x509_vfy.h +2 −0 Original line number Diff line number Diff line Loading @@ -380,6 +380,8 @@ int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, int purpose, int trust); void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags); void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t); #ifdef __cplusplus } Loading