keyring.c (363b02dab09b3226f3bd1420dad9c72b79a42a76) keyring.c (9d6c8711b6a751a694bcfaf49fb557b82092ee46)
1/* Keyring handling
2 *
3 * Copyright (C) 2004-2005, 2008, 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 552 unchanged lines hidden (view full) ---

561 /* ignore keys not of this type */
562 if (key->type != ctx->index_key.type) {
563 kleave(" = 0 [!type]");
564 return 0;
565 }
566
567 /* skip invalidated, revoked and expired keys */
568 if (ctx->flags & KEYRING_SEARCH_DO_STATE_CHECK) {
1/* Keyring handling
2 *
3 * Copyright (C) 2004-2005, 2008, 2013 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 552 unchanged lines hidden (view full) ---

561 /* ignore keys not of this type */
562 if (key->type != ctx->index_key.type) {
563 kleave(" = 0 [!type]");
564 return 0;
565 }
566
567 /* skip invalidated, revoked and expired keys */
568 if (ctx->flags & KEYRING_SEARCH_DO_STATE_CHECK) {
569 time_t expiry = READ_ONCE(key->expiry);
570
569 if (kflags & ((1 << KEY_FLAG_INVALIDATED) |
570 (1 << KEY_FLAG_REVOKED))) {
571 ctx->result = ERR_PTR(-EKEYREVOKED);
572 kleave(" = %d [invrev]", ctx->skipped_ret);
573 goto skipped;
574 }
575
571 if (kflags & ((1 << KEY_FLAG_INVALIDATED) |
572 (1 << KEY_FLAG_REVOKED))) {
573 ctx->result = ERR_PTR(-EKEYREVOKED);
574 kleave(" = %d [invrev]", ctx->skipped_ret);
575 goto skipped;
576 }
577
576 if (key->expiry && ctx->now.tv_sec >= key->expiry) {
578 if (expiry && ctx->now.tv_sec >= expiry) {
577 if (!(ctx->flags & KEYRING_SEARCH_SKIP_EXPIRED))
578 ctx->result = ERR_PTR(-EKEYEXPIRED);
579 kleave(" = %d [expire]", ctx->skipped_ret);
580 goto skipped;
581 }
582 }
583
584 /* keys that don't match */

--- 1008 unchanged lines hidden ---
579 if (!(ctx->flags & KEYRING_SEARCH_SKIP_EXPIRED))
580 ctx->result = ERR_PTR(-EKEYEXPIRED);
581 kleave(" = %d [expire]", ctx->skipped_ret);
582 goto skipped;
583 }
584 }
585
586 /* keys that don't match */

--- 1008 unchanged lines hidden ---