Skip to content

Commit 743229a

Browse files
committed
Add forgotten CHECK_FOR_INTERRUPT calls in pgcrypto's crypt()
Both Blowfish and DES implementations of crypt() can take arbitrarily long time, depending on the number of rounds specified by the caller; make sure they can be interrupted. Author: Andreas Karlsson Reviewer: Jeff Janes Backpatch to 9.1.
1 parent fec1ad9 commit 743229a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

contrib/pgcrypto/crypt-blowfish.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*/
3434

3535
#include "postgres.h"
36+
#include "miscadmin.h"
3637

3738
#include "px-crypt.h"
3839
#include "px.h"
@@ -670,6 +671,8 @@ _crypt_blowfish_rn(const char *key, const char *setting,
670671

671672
do
672673
{
674+
CHECK_FOR_INTERRUPTS();
675+
673676
data.ctx.P[0] ^= data.expanded_key[0];
674677
data.ctx.P[1] ^= data.expanded_key[1];
675678
data.ctx.P[2] ^= data.expanded_key[2];

contrib/pgcrypto/crypt-des.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
*/
6262

6363
#include "postgres.h"
64+
#include "miscadmin.h"
6465

6566
#include "px-crypt.h"
6667

@@ -540,6 +541,8 @@ do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count)
540541

541542
while (count--)
542543
{
544+
CHECK_FOR_INTERRUPTS();
545+
543546
/*
544547
* Do each round.
545548
*/

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy